mob
verb
Attack(mob/M as mob in oview(1))
var/damage = src.str - M.def
if(damage <= 0)
usr << "Your attack does not hurt [M] at all!"
M << "You are unhurt by [usr]'s attack."
else
M.hp -= damage
M:deathcheck()
M:levelup()
This is the original attack code I had where the user had to click on the actual attack button to attack.
mob
Click(mob/M as mob in oview(1))
var/damage = src.str - M.def
if(damage <= 0)
usr << "Your attack does not hurt [M] at all!"
M << "You are unhurt by [usr]'s attack."
else
M.hp -= damage
M:deathcheck()
M:levelup()
I edited it to make it so instead of creating a verb the user just has to click on the mob to attack. It compiled correctly but when I run it, it says this: runtime error: undefined variable /turf/var/def
proc name: Click (/mob/Click)
usr: Guest-570174474 (/mob)
src: the heartless (/mob/enemy/heartless)
call stack:
the heartless (/mob/enemy/heartless): Click(the turf (4,3,1) (/turf), "mapwindow.map", "icon-x=14;icon-y=18;left=1;scr...")
Any suggestions?