ID:150247
 
Okay. I'm working on a simple 'powerup' verb, but I'm having trouble with the overlay. The person stops moving, like they should.. the overlay can turn on/off, like it should..

But if they log out then back in again while powered up, the overlay 'sticks' to them. I can't remove it.

Here be my verb code, if you can poke something wrong with it (scuse the indentation, if it turns out funny):

Powerup()
if(usr.powerup)
usr<<"You slowly supress the power raging from your body."
usr.overlays-=/obj/power/tiny_powerup
usr.powerup=0
return
usr<<"You release the raging power within you."
var/radius=0
radius=round(usr.str/25)
if(radius>4)
radius=4
if(radius>0)
for(radius, radius>0, radius--)
for(var/moo=1, moo<2*radius, moo++)
var/turf/X = locate(usr.x-radius+moo,usr.y+radius,loc:z)
AddExUnderlay(usr.loc, X, /obj/power/particle,radius,1) // That's the proc that slams an underlay on the ground there.. It works fine.
X = locate(usr.x-radius+moo,usr.y-radius,loc:z)
AddExUnderlay(usr.loc, X, /obj/power/particle,radius,1)
X = locate(usr.x+radius,usr.y-radius+moo,loc:z)
AddExUnderlay(usr.loc, X, /obj/power/particle,radius,1)
X = locate(usr.x-radius,usr.y-radius+moo,loc:z)
AddExUnderlay(usr.loc, X, /obj/power/particle,radius,1)
sleep(1)
radius=round(usr.str/25)
if(radius>4)
radius=4
Explosion(usr.loc,radius) // That does an explosion of radius radius at usr.loc.. it works fine.
DyUnderExplosion(usr.loc,radius-1) // This does a crater of radius radius-1 at usr.loc.
usr.powerup=1
usr.overlays+=/obj/power/tiny_powerup

Oh, and yes, my game is pretty DBZ-ish. Please don't hate me.. (Don't worry, though, I won't release it onto the hub until all those crappy clone ones go away..)</2>
Apon logout you should set the overlays/underlays to null example:

mob/Logout()
src.overlays=null
src.underlays=null
del(src)


Good luck!
In response to Nadrew
Nadrew wrote:
Apon logout you should set the overlays/underlays to null example:

> mob/Logout()
> src.overlays=null
> src.underlays=null
> del(src)
>

Good luck!

Hmm.. That's was I figured I was going to have to do, remove all powerup/attack charging/etc effects on logout..

I was hoping that there was some way that I could allow them to persist over logout.. bleh.

Thanks anyway.. and for replying so fast. :)

[Edit:] Putting that in my mob/logout wasn't working for some weird reason, I moved it to login.. weird. It works, though.
-- Tarmas