ID:175475
 
hiya

I'm using the combat proc from RPGTutorial (by Kunark). But I have an error when I use it. This error happens when I use continiusly the attack verb. This is the error:

runtime error: Cannot read null.HP
proc name: Attack (/mob/PC/verb/Attack)
usr: Elear (/mob/PC/male)
src: Elear (/mob/PC/male)
call stack:
Elear (/mob/PC/male): Attack(null)


and this is the attack code:

mob/PC
verb
Attack(mob/M in oview(1))
var/damage = rand(1,3)
M.HP -= damage
M.Death()

and this is the death proc:

mob
proc
Death(mob/M)
if(src.type == /mob/PC)
PCDeath()
else
if(src.HP <= 0)
usr.exp += src.exp_give
for(var/O in src.Drops)
new O(src.loc)
range() << "[src] was slain by [usr]."
del(src)
PCDeath(mob/M)
if(src.HP <= 0)
view(src) << "[src] died."
src.loc = locate(15,10,1)
src.HP = maxHP
del(src)
Elear wrote:
hiya

I'm using the combat proc from RPGTutorial (by Kunark). But I have an error when I use it. This error happens when I use continiusly the attack verb. This is the error:

runtime error: Cannot read null.HP
proc name: Attack (/mob/PC/verb/Attack)
usr: Elear (/mob/PC/male)
src: Elear (/mob/PC/male)
call stack:
Elear (/mob/PC/male): Attack(null)

It would have probley been better if u would have included the code line of were the bug accurred in the debug :).

Attack(mob/M in oview(1))

M.HP -= damage

Now those two lines are I think what makes the mob go boom. First off change oview to view. Now to see what is going wrong is the computer dosnt think M is what u think M is. The computer thinks M = null so somthing is going on with the Attack(mob/M in view(1)) which would be the declaring of it. Now lets look at a few things like is the error occuring when no one is around u? as for the actual question I dont know but this doesnt seem like a hard bug u just aren't trying to figure it out hard enough.
In response to Green Lime
Oview(1) is perfectly fine for that, since it excldes the user, it would be best to use here. The problem is (as I had the problem myself) is that when you kill the mob, a few extra attacks get thrown, (making M a mob that was deleted)
mob/PC
verb
Attack(mob/M in oview(1))
if(M)//if M exists
var/damage = rand(1,3)
M.HP -= damage
M.Death()