ID:147815
 
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))
Usr is null because you're not supposed to use usr in procs. You'll need to give the bullet itself some variable that keeps track of who fired it.
Expect a visit from our local caveman. :)

Bump() is one of the many procs that don't support usr. You should send the usr into the proc from the verb.
In response to Jon88
Bah, I'm driving myself nuts.
I'm drawing a blank, where would I define the user of the verb for later use?
In response to Enigmaster2002
On your bullt obj just make a mob type variable(var/mob/owner) and set it to the usr when fired. Then just check the shooter stats from that variable. :)
The correct way to set the owner of a projectile is to use a var belonging to it. It's best to do so when you create the projectile, by sending usr (if a verb fires it) as a second argument.
obj/projectile
var/mob/owner
density = 1

New(newloc, mob/firedby)
owner = firedby
loc = firedby.loc
walk(src, firedby.dir, 0)

Lummox JR
In response to Lummox JR
It's still bellyaching about a null usr...
                Fire()
usr.projectile(new/obj/bullet(usr.loc),usr.dir,10,usr)

mob
proc
projectile(obj/projectile,var/dir,var/delay,mob/firedby)
shooter = firedby
sleep(1)
walk(projectile,dir)
sleep(delay)
del(projectile)

obj
bullet
icon='goldenbullet.dmi'
density=1
var/mob/shooter
Bump(mob/M)
if(istype(M,/mob/characters))
if(M.armored == 1)
var/damage = rand(1,15)
damage += shooter.strength
M.MP -= damage
M.Death()
del(src)
return
var/damage = rand(1,15)
damage += shooter.strength
M.HP -= damage
M.Death()
del(src)
if(istype(M,/mob/enemy))
var/damage = rand(1,15) + shooter.strength
M.HP -= damage
M.Death()
del(src)
else
del(src)
del(src)
In response to Enigmaster2002
If Fire() a proc? Next time please let us know which line the runtime error occurs on.
In response to Jnco904
Ack, forgot to post it.
obj
bullet
icon='bullets.dmi'
icon_state = "bullet"
density=1
var/mob/shooter
Bump(mob/M)
if(istype(M,/mob/characters))
if(M.armored == 1)
var/damage = rand(1,15)<b>
damage += shooter.strength</b> //This line...
M.MP -= damage
M.Death()
del(src)
return
var/damage = rand(1,15)<b>
damage += shooter.strength</b> //This line...
M.HP -= damage
M.Death()
del(src)
if(istype(M,/mob/enemy))<b>
var/damage = rand(1,15) + shooter.strength</b> //And this line.
M.HP -= damage
M.Death()
del(src)
else
del(src)
del(src)

runtime error: Cannot read null.strength
proc name: Bump (/obj/bullet/Bump)
source file: Objects.dm,1165
usr: 0
src: the bullet (/obj/bullet)
call stack:
the bullet (/obj/bullet): Bump(the guard (/mob/enemy/Guard))
In response to Enigmaster2002
I see a problem here:
mob
proc
projectile(obj/projectile,var/dir,var/delay,mob/firedby)
shooter = firedby
sleep(1)
walk(projectile,dir)
sleep(delay)
del(projectile)

"shooter = firedby" would be the equivelent of "src.shooter = firedby" and since the person firing is src in this instance it would set the shooters shooter var to the shooter(=D). I don't know how you didn't get a compile error, unless you made a shooter var for mobs also. Anyway, you need to set the projectiles shooter var "projectile.shooter = firedby", but since the base /obj type doesn't have a shooter var(which it shouldn't) you'll have to specify that it is a bullet in the arguements "projectile(obj/bullet/projectile,var/dir,var/delay,mob/firedby)".
In response to Jnco904
Whew, thanks for the help, it finally works. I'm dumb this way.