ID:167561
Feb 26 2006, 5:19 am
|
|
How would I make a mob walk to a specified Location? Like 1,4,3 coordinates on the map?
|
In response to Mechanios
|
|
i knew i could do that, but i was hpoing not to have to use events if i can simply make it go to a location. If Im making things spawn in random spots and if i ever want them to treturn to the spot Id have to dro pevents all over all the time
|
In response to karver
|
|
hmmmm,
Hey! This might work! mob/proc/Gotoyea(Player, x1,y1) Try that, not sure if it'd work. when you call the proc just go
Gotoyea(usr,#,#) //usr or src, x coord, y coord
|
In response to Mechanios
|
|
Mechanios wrote:
> for(var/turf/T in locate(x1,y1,z)) Think about that line for a few seconds. locate() returns a turf, and you are trying to loop through all the turfs in an existing turf's contents. That loop will never start because turfs don't exit in another turf's contents. You can simply do something like this. walk_to(src, locate(x, y, z)) ~~> Unknown Person |
In response to Unknown Person
|
|
Ohh! Right. thanks for the correction, Unknown.
|
In response to Unknown Person
|
|
Well, i tried to make a mob go back to their start locateion after they kill soemthing but instead they just stand there
walk_to(src, locate(src.startloc))//this is how I try to make the mob go back to its start point
var/startloc |
In response to karver
|
|
make 3 vars: oldX, oldY, oldZ (though you don't need z becuase that would just be dumb) and when New() is called set the oldX to the monsters current x and then the same for oldY and thier y. Then to make them walk back do
walk_to(src, locate(src.oldX,src.oldY,src.z)) and you're done. |
In response to FinalFantasyGamer
|
|
Thx, sorry to bother you even more but how do I get only the x or the y? Ive looked around and having trouble finding that,
I tried.. oldx=x in my 'New()' but that didnt work. |
In response to karver
|
|
src.x?
|
In response to karver
|
|
Try startloc=loc
|
walk_to(Ref,Trg,Min=0,Lag=0)
Ref: A mob or obj.
Trg: An object on the map.
Min: The minimum distance between Ref and Trg before movement halts.
Lag: Delay in world 1/10 seconds between movement
You could place an object on the map like, /obj/event1
and you'd call it like so:
I'm pretty sure that'd work. I jus woke up, so dun blame me. :P