/obj/Attack
icon='hud.dmi'
icon_state="attack_up"
layer=MOB_LAYER + 20
New(client/C)
screen_loc="1,1"
C.screen+=src
Click()
usr:Attack()
MouseDown()
icon_state="attack_down"
MouseUp()
icon_state="attack_up"
/mob/verb/Attack(mob/M as mob in oview(1))
var/damage=usr.str - M.def
if(M.hp >0)
if(damage<=0)
usr<<"[usr] missed the attack by a mile!"
else
M.hp-=damage
usr<<"[usr] attacked [M] for [damage] damage!"
M:deathcheck()
Problem description: I have a verb called Attack() and i want it to be called when i click a button on my HUD. When compiling i dont get any errors, but when i run the game and click the HUD button i get "runtime error: Cannot read null.def
verb name: Attack (/mob/verb/Attack)
usr: Baltraven (/mob)
src: Baltraven (/mob)
call stack:
Baltraven (/mob): Attack(null)
Attack (/obj/Attack): Click(null, "mapwindow.map", "icon-x=21;icon-y=7;left=1;scre...")
"
when i use the verb from the commands box, it works fine.