runtime error: Cannot read null.exphit proc name: Attack (/mob/verb/Attack) source file: Attack And Equip System.dm,110 usr: \[Owner... (/mob/players/Knight) src: \[Owner... (/mob/players/Knight) call stack: \[Owner... (/mob/players/Knight): Attack()
This runtime error prevents players to actually hit their target, but the icon still does the attack animation. Here's my Attack verb that covers line 110. (W/O the attack animation code)
mob
verb
Attack()
if(usr.attacking == 0)
var/obj/K = new/obj/Weapons
usr.attacking = 1
K.dir = usr.dir
K.loc = usr.loc
step(K, dir)
var/turf/X = K.loc
spawn(3)
del(K)
for(var/mob/M as mob in X)
if(M == src)
if(M.pvp == 0)
usr << "<font size=1>They are not PK!"
return
else
continue
var/damage = rand(1,usr.attack-10+usr.attackadd-M.defense+10+M.defadd)
if(damage <= 0)
damage = 1
M.killlist += usr.name
if(prob(70))
var/num = damage
s_damage(M, num, "red")
usr.exp += M.exphit
levelup()
M.health -= damage
if(M.health <= 0)
levelup()
Death(M)
if(prob(10))
var/num = damage*2
s_damage(M, num, "red")
usr.exp += M.exphit // <--- Right here is line 110
levelup()
M.health -= damage*2
if(M.health <= 0)
levelup()
Death(M)
else
sleep(7)
usr.attacking = 0
It's kinda hard to reproduce the problem kind of, as the production of the runtime error is pretty random. Anyone have any fixes/suggestions?