mob
Beetle
icon = 'monster.dmi'
icon_state = "1"
Str = 30
Hp = 20
Def=5
expgive=10
//We will begin Wandering and try to target the mob
var/mob/Target
New()
..()
spawn(5)
src.Wander()
proc
Wander()
while(src)
sleep(5)
for(var/mob/M in oview(2)) // how far you want the enemy to target a player
src.Target = M
break
if(src.Target) .
walk_towards(src,Target,5)
else
walk_rand(src,5)
//Here we will actually get the mob to attack.
Bump(mob/M)
if(istype(M,/mob))
var/damage = round(usr.Str/5)
if(damage <=0)
damage = 2
M.Hp -= damage
view() << "The [src] attacks [M] for [damage] damage!"
M.deathcheck(src)
if(src.Hp <=0)
M.exp += src.expgive
del(src)
Problem description:
im having a major problem, i made an ai so that monsters can attack back, but something wrong happend. the monsters are attacking each other! and there killing each other aswell, i just want the monsters to attack me not each other any help?
That should work.