ID:175864
 
I neeed to make some thing just walk can somebody show me a example?
look up walk_rand()
In response to Koolguy900095
sorry to butt in..but, how do u use walk_rand effectively... i cant seem to figure out where to put it to call it
In response to Jerico2day
In one of my rpgs this is what i did for my guards:

mob/guards/Recruit_Guard
var/mob/monsters/P
icon = 'guards.dmi'
icon_state = "recruit"
New()
.=..()
spawn(1)
Wander()
proc/Wander()
while(src)
if (P in oview(1))
step_towards(src,P)
else
step_rand(src)
for(P in view(src))
break
sleep(10)
spawn(40)
Wander()
In response to Koolguy900095
thanx

[edit] heh, i implemented it and I started walking around randomly when i went idle...thought wtf? realized i forgot to indent it to the NPC side instead of all mobs^_^
In response to Koolguy900095
Erm, that code is error-ridden. Let's go through it, shall we?

proc/Wander()
while(src)
if (P in oview(1)) //oview(1) == oview(usr,1) == BAD! Don't use usr in procs. Change it to oview(src,1).
step_towards(src,P)
else
step_rand(src)
for(P in view(src)) //So you lok for a monster in view(src), and if you find one, stop looking? This is pointless.
break
sleep(10)
spawn(40) Why would you call Wander() when the while(src) check fails? That would mean that src no longer exists, and thus, this is useless.
Wander()
In response to Garthor
I got rid of everything that wasnt required in that code... i was thinking of posting what i had changed, but figured anyone who uses it should be able to figure it out^_^
In response to Garthor
Garthor wrote:
Erm, that code is error-ridden. Let's go through it, shall we?

I think it would be better to say, "That error is code-ridden.". :D

~>Volte
In response to Garthor
shut up it was my first game
In response to Volte
lol, u guys are mean, give the poor guy a break^_^ Hey thanx man for the code, u got my NPCs walkin aruond:D
In response to Jerico2day
could u please post that code? it would help me.
In response to Koolguy900095
Thx man u got my ppl to walk around:)
In response to Coolroman123
me? sure..

let someone okay that before you use it, i may have screwed up, im a newb too^_^


mob
Char
NPC
New()
Wander()

mob
proc
Wander()
step_rand(src)
spawn(20)
Wander()
In response to Jerico2day
why did u post this?
In response to Koolguy900095
Koolguy900095 wrote:
why did u post this?

KitKate20 wrote:
could u please post that code? it would help me.