enemy/Beast |
Problem description:
As you can see in the above, i want the NPC to walk_rand, but if it spots a mob with 5 tiles away i want it to walk_towards it. When i run the game all it does is just walk_rand, ;(, a little help?
Code:
Problem description: As you can see in the above, i want the NPC to walk_rand, but if it spots a mob with 5 tiles away i want it to walk_towards it. When i run the game all it does is just walk_rand, ;(, a little help? | ||
#1 Jul 7 2012, 7:16 am
|
|
instead of using if use for(var/mob/M in oview())
| |
When you used the if(), it's checking if 'null' is in oview(). This makes sense because you declared m and never set a value to it.
The simplest way to get a nearby mob is to look for one. This can be done with the locate() proc, or even a for() loop.
| ||