ID:146485
 
Code:
mob/monster
Bear
icon = 'monsters123.dmi'
icon_state="Bear"
gold = 38
HP = 52
MHP = 52
player = 0
attack = 9
Expg = 12
level = 19
monster = 1
PK = 1
NPC = 0
New()
. = ..()
spawn()
Wander()
proc/Wander(var/mob/You/P)
while(src)
if(P in oview(1))
step_towards(src,P)
for(P in oview(1))
break
for(P in oview(1))
break
for(P in oview(1))
break
for(P in oview(1))
break
else
step_rand(src)
sleep(5)
for(P in oview(1))
break
sleep(5)
spawn(5)
Wander()
Bump(mob/M)
if(M.player == 1)
Fight(M)
else
return
proc/Fight()
for(var/mob/E in get_step(usr,usr.dir))
var/damage = src.attack
E.HP -= damage
E << "[src] attacks you for [damage] damage!!"
src<<"You attack [E] for [damage] damage!!"
UserDcheck(E)


Problem description: In mny game i have it so the monsters wander around. Can anyone fix this code so they don't move unless you attack them?

You have Wander called when the monster is created. Instead, call it during the attack proc.
i don't get what you mean
In response to CaptFalcon33035
heres what he going on about in basic form

- Player attacks
-- Monser proc Wander is called from the attack (verb or proc what ever you use)

thats it, not hard to work out what he said
In response to Zmadpeter
Make sure it's only called once, or the procedure will be started every time the monster is attacked. That means, once attacked twice, it will be jumping arround twice as fast as normal. When attacked ten times, you'll never catch it.
In response to Yota
i think.... i know what to do now.
You may want to check out hr_monster for further details on something like this!