attack()
while(target)
var/mob/M = target
if(target == summoner)
target = null
return
if(get_dist(src,target) == 1 && !src.petrified)
var/k = rand(ATKMIN, ATKMAX)
M << "[src] attacks you for [k] damage."
M.HP -= k
M.Bars()
M.Death_Check(src)
else
if(prob(5))
var/obj/Spells/Incendio/I=new/obj/Spells/Incendio(usr.loc)
step_towards(src, target)
I.loc = usr.loc
walk(I,usr.dir)
I.damage = rand(100,200)
sleep(20)
del I
M << "[src] Incendio hits you for [I.damage]"
M.Bars()
M.Death_Check(src)
if(get_dist(src,target) >= 8)
target = 0
return
sleep(WAIT*2)
Problem description:
i am trying to make a monster fire projectiles but what keeps happening is it fires the projectiles and then take the damage from player but the projectile doesn't even hit the player i have tried many things but keep getting same result
Because you are assuming the projectile hits no matter what in the above code. You should look into Bump() and Crossed() and decide which one better fits your needs. (Bump() suffices for a simple dense object.)