I'm having trouble with my attack. it goes:
icon = 'spells.dmi'
icon_state = "gemsword"
for(var/mob/M in src.loc)
var/damage = src.owner.damage
M.HP -= damage
M << "[src.owner] attacks you for [damage] damage"
src << "You do [damage] damage to [M]"
var/obj/sword/S = new/obj/sword(get_step(usr,usr.dir))
S.owner = usr
S.dir = usr.dir
The runtime error I get only happens when I attack another mob, when I just attack at nothing, it works. The runtime is:
runtime error: Cannot read null.damage
proc name: New (/obj/sword/New)
source file: fight.dm,10
usr: Aleis (/mob)
src: the sword (/obj/sword)
the sword (/obj/sword): New(the path (22,20,1) (/turf/floor/path))
Aleis (/mob): sword()
Aleis (/client): Northeast()