ID:140922
 
Code:
mob
verb
Kamehameha() // Verb used for firing the beam
if(usr.firing==0) // If the mob's firing var is one...
usr.icon_state = "kameh"
usr.firing = 1 // Sets the firing var to 1, so he cant fire another beam
usr.move = 0 // Disables the mob's movement
usr.icon_state = "kameshoot" // Sets the mob's icon_state
usr.Beam() // Calls the Beam() proc
return
else // If the firing var isn't 1...
usr.icon_state = "kameh"
spawn(2)
usr.icon_state = ""
usr.firing = 0
usr.move = 1
for(var/obj/Beams/Head) //For all objects in the Head's Beam list...
del(Head)
for(var/obj/Beams/list/Beam) //For all objects in the Head's Beam list...
del(Beam) //Delete any objects found


Problem description:
Ok, I can compile and run this with no errors, but see my problem arises when say two people use this verb and create the said kamehamehas.. If the person clicks the verb again it stops the kamehameha for that said person, but deletes the head and body of all kamehamehas in the world entirely, from what I have tested. I need to find a way to make it to where when the player clicks the verb a second time it only get's rid of that usr's kamehameha wave and not every kamehameha..
1. Instead of 'if(usr.firing==0)' use 'if(!usr.firing)'. Read http://www.byond.com/members/ DreamMakers?command=view_post&post=37940 on why you should do this.

2. Whenever the head and beam are created, add it to it's owners list (which you should put in). Then, delete everything in that list. Check out Kaioken's beam demo, it'll provide the example to what I'm talking about.
In response to Demon_F0rce
Well when I put it into that list, say in src.bBeam and it uses that list, it comes back with an error, saying that src.Beam is an undefined Variable.. But I a still going to further look into and try what you said..
In response to Zekk98
When I say put it into a list, I mean like:

obj/var/list/bBeam = list()


Not one created at runtime, such as:

mob/verb/shoot()
//blah blah blah
var/list/bBeam = list()<dm>
In response to Demon_F0rce
Yea, I had that already set in my code, but with that in play how exactly would I del everything in the list? I know this sees rather stupid of a question, but I've fixed everything up until this point and I am rather tired and working with no sleep... Meh.. so, if you could assist and aid e just a bit more that would be helpful.
In response to Zekk98
obj/tmp/Owner


Then in the Beam() proc, make sure you define Head and Beam's owner variable as the person firing them.

        for(var/obj/Beams/Head) //For all objects in the Head's Beam list...
if(Head.Owner==usr) // Make sure Head belongs to usr.
del(Head)
for(var/obj/Beams/list/Beam) //For all objects in the Head's Beam list...
if(Beam.Owner==usr) // Make sure Beam belongs to usr.
del(Beam) //Delete any objects found


Edit: Just realized that Beam is a list. Wasn't really paying attention, but I don't care enough to fix it... figure it out yourself. >.>