ID:269147
 
how do i make it where instead of the mob walking around and attacking players how do i make it where the player has to attack the NPC for the NPC to attack him/her.

        proc
attacking()
if(src.fight==1)
for(var/mob/M in oview(4))
if(M.client)
walk_towards(src,M,10)
if(src.dir==1||src.dir==2||src.dir==4||src.dir==8)
for(M in get_step(src,src.dir))
src.monsterattacking(M)
else
continue
else
continue
else
walk_rand(src,10)
spawn(7) attacking()
New()
walk_rand(src,10)
attacking()
It would realy be helpful to know, like how Seika has mobs that just stand there until you get close to them or attack them. Im making a game, started today, ive already gotten status but i need to add mobs to increase status. I got 82 monsters to make and i want to use the stand still until attacked in 60 of them.
In response to Contract Jack
create a variable for attack and use that to switch on and off when a player has attacked the mob.

Like your dude is attacking:

attacking = 1
if(M.attacking in oview(1))
//etc
If I understand what you're saying it's as simple as calling an attack procedure for NPCs when they've been attacked.

mob/verb/attack(mob/defender as mob in oview(1))
src.Attack(defender)

mob/proc/Attack(mob/defender)
viewers(src) << "[src] attacked [defender]!"

// Damage and such.

if(!defender.client) // If this isn't a player's mob...
defender.attack(src) // make him defend himself.