RPG Starter

by Falacy
An Open Source Demo/Game with everything you'll need to get started on your very own BYOND Game!
ID:738682
 
How do you do the powerup code?
Like the one u had on Heroes United.
I tried my ways but it keeps crashing.
So help?
This might help
//vars
mob/var
TPL = 10 //Maximum power level
TKI = 5 //Maximum Ki
PL = 7 //Current power level
Ki = 3 //Current Ki
//verb
mob/verb/Power_Up()
if(TPL > PL)//If TPL and PL are not equal
while(TPL > PL)//Till TPL and PL are not equal
src.PL += 1//Add 1
if(TKI > Ki)
while(TKI > Ki)
src.Ki += 1

I am sorry if there is a mistake in my code, I was away from BYOND for a long time.
mob/var
curPL
maxPL
curKi
maxKi

mob/var/tmp/powerupID=0
mob/verb/StartPowerup()
src.powerupID+=1
var/thisID=src.powerupID
while(src.powerupID==thisID)
src.curPL=min(src.maxPL,src.curPL+1)
src.curKi=min(src.maxKi,src.curKi+1)
if(src.curPL>=src.maxPL && src.curKi>=src.maxKi) break
sleep(1)

mob/verb/EndPowerup()
src.powerupID+=1
Fal's could work too. :P
In response to Taha123
Taha123 wrote:
Fal's could work too. :P

Your example would "instantly" set their stats to max. If it didn't crash in the process of trying to execute the pointless while loops first.
Thanks for the correction!
Sorry if I misguided anyone!
There is also no way to cancel yours early, and, assuming sleeps were added so powering up would take time, players could spam the verb to stack powering up.