I don't exactly know what to do to make mobs move around, so could anyone help me out. I want to make Zeon move if Heck_Leader is within 1 space and if not make Heck_Leader moves to Zeon.Both of them are NPC's.
Ok i have somewhat of a code but it's not making mobs move at all.
so heres my code ,the indenting looks to little here but i had to indent less so the bulky code would fit on the line.
mob
proc
GroupCheck()
if(/mob/Gang1/Heck_Leader in oview(1))
Walk()
else
GetTogether()
spawn(10)GroupCheck()
Walk()
step_rand(/mob/Gang1/Zeon)
GetTogether()
walk_toward(/mob/Gang1/Heck_Leader,/mob/Gang1/Zeon,1)
Gang1
Zeon
Stats//his stats
New()
GroupCheck()
Heck_Leader
Stats//his stats
ID:179479
Dec 18 2001, 3:47 pm
|
|
In response to Gazoot
|
|
that didn't work because I kept getting 1 error so i put this down for GetTogether instead. Now when my Group "GetsTogether" Zeon just keeps running south until he runs into the board.
GetTogether() walk_towards(src,/mob/Gang1/Heck_Leader,1) world << "He is flocking"//so i could see if it was doin this. Also my people don't even walk. Sorry for the trouble but this has had me stumped for weeks and I would like to get it right. Thanks |
In response to BrollyX
|
|
BrollyX wrote:
Also my people don't even walk. Sorry for the trouble but this has had me stumped for weeks and I would like to get it right. Thanks Sorry, I made a mistake in the detection. Naturally you need to specify a leader *before* looking for it. I've made a short example that works. This makes objects follow and move around a player: world/mob = /mob/player mob player icon = 'mob.dmi' thing icon = 'thing.dmi' var mob/player/leader New() spawn() leader = locate(/mob/player) // Find the leader here GroupCheck() proc GroupCheck() if(leader in oview(1,src)) walk_rand(src,9) else walk_towards(src,leader,9) spawn(10) GroupCheck() The reason i used spawn in the New proc is that all objects must be initialized before searching for something, and when the world starts up, no objects are accessible. If you do a spawn, it ensures that you have access to all objects in the world. I shortened down the procs to only one as you see, but this is only an example. Take the bits and pieces you need and make something good out of it. :) /Andreas |
In response to Gazoot
|
|
thank you so much it works perfectly now. I realy apreciate it. Thanks again =)
|
When you do the GroupCheck, you need to locate() the prototype you're looking for. Otherwise your NPC is trying to walk towards a mob prototype instead of a mob!
So in groupcheck, you need these lines:
I called GetTogether with the leader as an argument, to make the mob walk towards it.
I substituted the step procs for walk since you're spawning the functions every second. But feel free to change back.
/Andreas