ID:173339
 
Hello please can someone help me with this i have

            Bump(mob/M)
if(ismob(M))
ownerk.firing = 0
ownerk.icon_state = ""
ownerk.move = 1
usr.strength -= M.powerlevel
M.Die(src)
for(var/obj/O in src.Beam).
del(O)
del(src)


But when i use the fire verb at somone else there pl does not go down.
No put usr in Bump(). Ungh.

Lummox JR
You're going to need a bit more code than that for anyone to really diagnose your problem. If your issue is with the fire verb, it might be a good idea to paste the fire verb. If its just with this proc, you might want to explain a bit about what you're trying to do.
In response to Lummox JR
DerDragon wrote:
You're going to need a bit more code than that for anyone >to really diagnose your problem. If your issue is with >the fire verb, it might be a good idea to paste the fire >verb. If its just with this proc, you might want to >explain a bit about what you're trying to do.

Lummox JR wrote:
No put usr in Bump(). Ungh.

Lummox JR

Lummox JR if i do the bump thing i can't use M.

DerDragon here is some more of the coding.
            Bump(mob/M)
if(ismob(M))
ownerk.firing = 0 // Allow the ownerk to fire another beam
ownerk.icon_state = "" // Give them their default icon_state
ownerk.move = 1 // Allow them to move
usr.strength -= M.powerlevel
M.Die(src)
for(var/obj/O in src.Beam) // Checks for objects in the Head's Beam list...
del(O) // Deletes any objects found
del(src) // Deletes the head
del(src)
Bump(atom/M)
if(isturf(M)) // If whatever the head bumps is a turf..
ownerk.firing = 0 // Allow the owner to fire another beam
ownerk.icon_state = "" // Give them their default icon_state
ownerk.move = 1 // Allow them to move
for(var/obj/O in src.Beam) // Checks for objects in the Head's Beam list...
del(O) // Deletes any objects found
del(src) // Deletes the head
else if(!isturf(M) && !isobj(M) && !isarea(M)) // If whatever the head bumps is a mob...
ownerk.firing = 0 // Allow the owner to fire another beam
ownerk.icon_state = "" // Give them their default icon_state
ownerk.move = 1 // Allow them to move
for(var/obj/O in src.Beam) // Checks for objects in the Head's Beam list...
del(O) // Deletes any objects found
del(src) // Deletes the head

obj
Kamehameha
verb
Kamehameha()
set name = "Kame Hame Ha"
set category = "Battle"
if(usr.firing)
usr << "This cannot be done."
return
else
view(6) << "<font color = red>[usr]:<font color = white> <tt>Kaaaa....."
sleep(18)
view(6) << "<font color = red>[usr]:<font color = white> <tt>Meeee....."
sleep(18)
view(6) << "<font color = red>[usr]:<font color = white> <tt>Haaaa....."
sleep(18)
view(6) << "<font color = red>[usr]:<font color = white> <tt>Meeee....."
sleep(18)
view(6) << "<font color = red>[usr]:<font color = white> <tt>HAAAA!!!!!"
usr.firing = 1
usr.move = 0
usr.icon_state = "shoot"
usr.Beam()

mob
proc
Beam()
var/obj/Head = new/obj/Beams/Head()
if(usr.dir == NORTH) // If the mob's dir is NORTH...
Head.loc = locate(usr.x,usr.y+1,usr.z)
if(usr.dir == SOUTH) // If SOUTH...
Head.loc = locate(usr.x,usr.y-1,usr.z)
if(usr.dir == WEST) // If WEST...
Head.loc = locate(usr.x-1,usr.y,usr.z)
if(usr.dir == EAST) // If EAST...
Head.loc = locate(usr.x+1,usr.y,usr.z)
Head.total = 6
Head.ownerk = usr
In response to CrazyFighter
CrazyFighter wrote:
Lummox JR if i do the bump thing i can't use M.

No put usr in Bump()! Ungh! No forget about src.

No put usr in proc like Beam(). Ungh.

Lummox JR
In response to Lummox JR
Amazingly, usr IS the cause of the current problem! People really have to stop using usr in their procedures, and stop ignoring Lummox when he says that you shouldn't because it isn't a problem for them at the moment.
In response to Jon88
so can anyone help me.
In response to CrazyFighter
Lummox JR already has. TWICE.
In response to Garthor
I think he was confused by my post. I had a word in there implicitly, after an and, and I guess he didn't pick up on it. It looked like pretty bad grammar too. I've edited it now.
In response to Lummox JR
Lummox JR wrote:
No put usr in Bump(). Ungh.

Lummox JR

so Bump(mob/usr) or Bump(usr)
In response to CrazyFighter
CrazyFighter wrote:
Lummox JR wrote:
No put usr in Bump(). Ungh.

Lummox JR

so Bump(mob/usr) or Bump(usr)

"No put usr in Bump(). Ungh" = "Do NOT put usr in Bump()!"
In response to CrazyFighter
CrazyFighter wrote:
so Bump(mob/usr) or Bump(usr)

Good gads, man, I know the caveman thing is kind of facetious but it did tell you what not to do. What not to do is put usr in Bump(), or in your Beam() proc either. How do you make the leap from not only failing to get that, but actually renaming your argument to usr?

Renaming an argument to usr or src is ludicrous. In the case of usr, you forget that usr is already a local var passed to the proc and is already defined; you'd have two different vars named usr. In the case of src, that's already defined as well. Don't give a proc argument the same name as a built-in var. That ought to be obvious.

In the case of Bump(), you have two things to work with: src (the bumper), and your argument M (the bumpee). You had usr in a place where it should have been src. Now src is not always the correct var to replace usr with, but in this case it was.

For Beam(), I don't know if src is the right replacement, but usr is absolutely wrong. If your proc doesn't have enough information already to know who fired, then pass that along as another argument.

Lummox JR
In response to Lummox JR
Lummox JR wrote:
Don't give a proc argument the same name as a built-in var. That ought to be obvious.

Agreed. But I reckon the compiler should give a warning when someone defines usr or src, or even defines a local var that has the same name as one of src's vars. I've been seeing people put usr and src in as arguments more and more recently, and a compiler warning to head them off might help a bit.