mob
icon='Enemies.dmi'
CircleDemon
icon_state="CircleDemon"
hp = 50
str = 7
def = 10
monster = 1
AI()
New()
. = ..()
Wolf
icon_state="Wolf"
hp = 20
str = 1
def = 2
monster = 1
Elephant
icon_state="Elephant"
hp = 40
str = 3
def = 5
monster = 1
mob
proc
AI()
for(var/mob/M in oview(5,src)) //List of mobs 5 tiles or closer to monster
if(M.client) //If M's monster var is 0
walk_to(src,M,1,3) // Walk to it every .3 secs until it is 1 tile away
if(get_dist(src,M)<=1) //If it is 1 tile or less away
src.attack(M) //Attack it
spawn(2)src.AI() //Repeat
else //If M's monster var is 1
return // Screw it.
mob
proc
AIdef()
for(var/mob/M in oview(5,src))
if(src.monster == 1)
walk_to(src,M,1,3)
src.attack(M)
mob
proc
attack(mob/defender)
if(atking == 1)
return
else
if(src.str-defender.def <=0)
oview(2)<<"[defender] has dodged [src]'s attack!"
atking = 1
sleep(5)
atking = 0
else
var/damage=src.str-defender.def*rand(1,2)
defender.hp-=damage
oview(2)<<"[defender] was hit by [src] for [damage] Damage!"
if(defender.hp<=0)
defender.deathcheck()
atking = 1
sleep (20)
atking = 0
Problem description:
The monster won't attack back
I don't know what you want the AIdef() proc to be, so it just shouldn't exist really.
Second, you need to change oview(2) in your attack() proc to be oview(2,src). Though, probably it should be view().
Third, you are never actually calling your AI() proc. The line that you do have:
doesn't call the proc, it overrides it and replaces it with one that does nothing. To call it, you should put it in New(), like so:
spawn() is used because we don't want to wait for AI() to finish (as it never will) before continuing with the New() proc.