First of all my coding for the damage is:
Bump(mob/M)
if(usr.atkpower > M.dfnpower)
attack = usr.atkpower - M.dfnpower
view() << "[M] is hit by a bullet for [attack]!"
I get the runtime error:
runtime error: Cannot read 0.atkpower
proc name: Bump (/obj/bullet/Bump)
usr: 0
src: the bullet (/obj/bullet)
call stack:
the bullet (/obj/bullet): Bump(Asteroid (/mob/test/Asteroid))
It says "Cannot read 0.atkpower" but I have that var defined right here:
mob
var
atkpower = 50
dfnpower = 50
I also have the Asteroids dfnpower defined here:
mob/test
Asteroid
dfnpower = 25
Is there somethings i did wrong in this coding? Please helpe fix it, thanks in advance!
ID:175526
Apr 10 2003, 10:55 am
|
|
In response to Nick231
|
|
usr to M....then that doesnt do what i want it to do and src makes it say
Attack.dm:12:error:src.atkpower:undefined var Attack.dm:13:error:src.atkpower:undefined var |
In response to Koolguy900095
|
|
BTW heres all the coding around the bump proc:
obj/bullet var attack = 0 icon = 'Crosshair.dmi' density = 1 Bump(mob/M) if(usr.atkpower > M.dfnpower) attack = usr.atkpower - M.dfnpower view() << "[M] is hit by a bullet for [attack]!" M.HP -= attack |
In response to Koolguy900095
|
|
its fixed now...
|
In response to Koolguy900095
|
|
No put usr in procs. Ungh.
Lummox JR |
In the above case, simply changing usr to M in the proc should fix the problem...