Oh! My bad. I forgot I took that part out. Either way, if you want that bit taken out AND NPCs not to attack eachother because you don't want your mob to have a special path, that works too.
I had the same issue with the disappearing enemies, except they were only visible when attacking. Turns out I forgot to specify a name for the enemy's walk state.
Another bit of weirdness I had was attacking myself if another enemy was out of range. Adding the following under the Attack verb right above the damage calculation cleared it up:
if (M == src) return 0
Thanks again for the Tutorials. They're a good kickstart even if they aren't perfect.
This is my AI system. But whenever I use this my CPU increase for 2%. What I want to do here is that when players are in AI oview(7-3) he will do projectile.
My goal is also to prevent AI from facing them diagonally!
I also want that if AI is in oview 2 he will walk to player and attack him once he is 1 step away from him. And while non player is in AI oview he will be teleported back to spawn and get his stats refreshed. Ty
#30 May 4 2012, 5:15 am (Edited on May 4 2012, 5:23 am)
There you go. Your code is a ton more complicated than it needs to be.
/mob/monster name = "monster" icon = 'monster.dmi' desc = "a horrible green monster" var/mob/target var/speed = 5 //The lower the speed, the faster the monster is!
New() ..() life()
proc/life() if(!target) for(var/mob/M in view(7, src)) if(M.client) target = M break if(target) if(target in view(1, src)) attack(target) else step_to(src, target) else step_rand(src) spawn(speed) .()
attack(var/mob/M as mob) view(7, src) << "[src] claws [M]!"
ok i dont get this my enemy is not attacking watsoever it just sits there.. could it be because i set the enemy with map editor or wat??? btw yes ive been following since tut. 1