ID:168650
 
Hey.How do i let an NPC walk random
Call an AI (Artificial Intelligence) proc in New(). The actual proc to make the mob move is called step_rand(). You should look up all the step() procs and walk() procs too by the way.
In response to DeathAwaitsU
DeathAwaitsU wrote:
Call an AI (Artificial Intelligence) proc in New(). The actual proc to make the mob move is called step_rand(). You should look up all the step() procs and walk() procs too by the way.



I tried evry way i know but it dosent work.


Wolf
icon='wolf.dmi'
icon_state="brown"


What do i need to add it to it

In response to Halovader
Halovader wrote:
DeathAwaitsU wrote:
Call an AI (Artificial Intelligence) proc in New(). The actual proc to make the mob move is called step_rand(). You should look up all the step() procs and walk() procs too by the way.



I tried evry way i know but it dosent work.


Wolf
icon='wolf.dmi'
icon_state="brown"


What do i need to add it to it


You, should use <*dm> and <*/dm> tags (without the *'s). But, anyways heres an example how to put it in.

mob/Wolf
icon = 'wolf.dmi'
icon_state = "brown"
New()
..()
spawn(rand(1,50))
BasicWalk() //The proc that will let it walk

mob/proc/BasicWalk() //This is the proc that will let the wolf 'walk'
step_rand(src) //Moving..
spawn(30) //Delaying, the wolf's movement
BasicWalk() //Looping the process all over again infinetely


In response to MasterLink2003
You forgot to indent after that spawn. =)
Plus, instead of calling the procedure again I'd say it'd be better form to use a while loop, like so:

mob/Wolf
icon = 'wolf.dmi'
icon_state = "brown"
New()
..()
spawn(rand(1,50))
BasicWalk() //The proc that will let it walk

mob/proc/BasicWalk() //This is the proc that will let the wolf 'walk'
while(1) //While 1 equals 1, continue to pull off the following code...
step_rand(src) //Moving..
sleep(30) //Delaying, the wolf's movement
In response to Elation
Ah, okay. That, does seem more reasonable.
In response to MasterLink2003
I would suggest you use the example from lummox jrs green tutor tutorial.Its has some problems (grammatical) but nothing a few tests shouldnt fix.
Try to be sure to learn it as its a real good method compared to some other games Ive seen.
(overview)
It makes the movable walk around randomly but only when a player is in the said area.meaning that you get less overhead (much less).

(bugs)
I had to edit the code a bit for it to actually work,nothing a little determination couldnt fix.
(The other areas dont wake up. and some others but I'll leave them to you to find.)

Itanium