ID:150109
 
I have made this but i can't ge it to work can some one plz help me to make a pet code were u get a pet and it follows you

got frustrated and deleted it :(

So plz help

Unix
Unix wrote:
I have made this but i can't ge it to work can some one plz help me to make a pet code were u get a pet and it follows you

Well, you could try something along these lines:
mob/player
var/list/pets

New()
pets=list() // fill this in later

Move(atom/newloc)
.=..()
for(var/obj/pet/P in pets)
P.Follow(src)

Bump(O)
if(O in pets)
// switch places
var/obj/pet/P=O
var/atom/loc1=loc
var/atom/loc2=P.loc
loc1.Exited(src)
loc2.Exited(P)
loc=loc2
P.loc=loc1
loc2.Entered(src)
loc1.Entered(P)

obj/pet
var/owner
density=1

proc/Follow(mob/player/P)
step_to(src,P,0)

That ought to give you some of the basics. To make an animal your pet, set its owner var to your mob, and add it to your mob's pets list. It will move whenever you do. If you find step_to() doesn't work well enough, try Deadron's PathFinding library.

Lummox JR