src, usr and M. in Developer Help
|
|
Now, to the best of my knowledge, src is the bullet, usr is the person that fired the bullet, and M is the mob the bullet bumped.
Fire() usr.projectile(new/obj/bullet(usr.loc),usr.dir,10)
mob proc projectile(obj/projectile,var/dir,var/delay) sleep(1) walk(projectile,dir) sleep(delay) del(projectile)
obj bullet icon='goldenbullet.dmi' density=1 Bump(mob/M) if(istype(M,/mob/characters)) if(M.armored == 1) var/damage = rand(1,15) damage += usr.strength M.MP -= damage M.Death() del(src) return var/damage = rand(1,15) damage += usr.strength M.HP -= damage M.Death() del(src) if(istype(M,/mob/enemy)) var/damage = rand(1,15) + usr.strength M.HP -= damage M.Death() del(src) else return del(src)
|
I fail to see the problem, but it's obviously because usr is null.
runtime error: Cannot read 0.strength
proc name: Bump (/obj/bullet/Bump)
source file: Objects.dm,1160
usr: 0
src: the bullet (/obj/bullet)
call stack:
the bullet (/obj/bullet): Bump(the guard (/mob/enemy/Guard))
|