ID:179354
 
Say I had a attack verb like this:

verb
Attack(mob/M in oview(1))
var/damage = rand(1,strength)
usr << "You attack [M]!"
usr << "[damage] damage!"
M << "[usr] attacks you!"
M << "[damage] damage!"
M.HP -= damage
M.DeathCheck()

But I dont want this verb to attack NPCs or players just the monsters. What should I do?
Something along the lines of this:


mob/verb/Attack(mob/M as mob in oview(1))
if(istype(M,/mob/monster))
//attack code as normal
else
src<<"You cannot attack the innocent!"
you may also want to do a 'M.DeathCheck()' before hand as well, for I have run into some of those anoying things before....
Tazor07 wrote:

I dont want this verb to attack NPCs or players just the monsters. What should I do?

Change
Attack(mob/M in oview(1))
to
Attack(mob/my/monster/type/path/M in oview(1))
and players won't even be able to target anything but mobs of that type.