attacking in Developer Help
|
|
i want the NPC's to run towards each other, Wander() does that, but they don't. all the NPC's do is just stand still. im not sure if they do that because they can't handle having an ally and an enemy in the same oview, or the charge() proc is screwing up the code. if your wandering what the WalkAround() proc is, its like step_rand, except the mobs don't make cheesy movements.
mob/NPC
var/mob/NPC/m
proc/charge()
while(src)
if(m.colorofwar == src.colorofwar)
WalkAround(src)
else
Wander(src)
proc/Wander()
while(src)
if(m in oview(5))
step_towards(src,m)
Wander()
Bump(mob/n)
if(istype(n,/mob/NPC))
attack(n)
proc/attack()
sleep(2)
var/damage = Strength - m.Defence
m.Life -= damage
view(src) << "[src] attacks [m]!"
view(src) << "[damage] damage!"
if(m.Life < 0)
del(src)
|
When you wrote Wander(src) you're actually writing src.Wander(src) because no matter what you've always got to specify what atom (or datum) is calling the proc, verb or modifing the var. You can get away with leaving it blank most of the time because it defualts to src.
Anyway, back to the point. You're passing an arguement to Wander() when Wander() takes no arguements. So cut that out.
Now, onto the actual problem. You're never actually setting m in any of this. You've checked to see if it's in oview(5) but that's it.
I'm not sure how you want your NPCs to target players, but if you give me a brief description of how you want them to and the name of your /mob/player type I'll walk you through making them target players.
Also, it's not that important but you should give better names to your atom vars. Something like targetNPC would be a much more fitting name then 'm'.
One last thing, when posting code in the forum put