ID:140038
 
Code: Hey guys its me again. Today's problem is that for some reason Bump() isn't working with one of my homing projectiles. I have never done homing projectiles before so I'm likely to be doing something wrong. The first proc is tabbed under obj/proc and the Bump is just tabbed under obj since its built-in. The actual object is tabbed under obj/projectile. This may help with you helping determine the mistake I made.
    Homing()
while(src)
var/mob/p = usr
var/mob/b = p.target
while(p.target)
walk_to(src,p.target,0,2)
sleep(70)
del src
Bump(atom/a)
if(istype(a, /mob))
world << "I hit him."
..()

homingshock
icon_state ="homingshock"
layer =MOB_LAYER +1
density =1
New(mob/M)
loc=M.loc
Homing()


Problem description:

In the words of Lummox JR: No put usr in proc. Dream Tutor: Usr Unfriendly
You shouldn't be using usr in procs. You should pass the mob that is shooting the projectile to the projectile. Which you are already doing with New(), but not doing for Homing(). As for not bumping, the issue is that walk_to() will never bump into anything, as it avoids obstacles.
In response to Garthor
I have to use usr because someone pointed out to me that if I was to give the projectile its own target variable so that I don't have to set it like that, I won't be able to check back to see who's projectile it was for things like death checks or a kill count.

But thanks, I got it to actually bump now using walk_towards. I didn't pay attention to when it said walk_to takes obstacles into account.
In response to EmpirezTeam
EmpirezTeam wrote:
I have to use usr because someone pointed out to me that if I was to give the projectile its own target variable so that I don't have to set it like that, I won't be able to check back to see who's projectile it was for things like death checks or a kill count.

You never, ever, ever, ever, ever, ever, EVER have to use usr in procs, and you never, ever, ever, ever, ever, ever, ever should.

In this case, the solution is to give the projectile a variable for who its OWNER is. Or, just pass the owner as an argument to the Homing() proc.
In response to Garthor
Garthor wrote:
EmpirezTeam wrote:
I have to use usr because someone pointed out to me that if I was to give the projectile its own target variable so that I don't have to set it like that, I won't be able to check back to see who's projectile it was for things like death checks or a kill count.

You never, ever, ever, ever, ever, ever, EVER have to use usr in procs, and you never, ever, ever, ever, ever, ever, ever should.

(Some exclusions may apply)
In response to AJX
Oh right, the exception would be a FEW procs such as Click() which are just masks for verbs.