ID:154693
 
i always wondered how dbz creators code gravity training.I mean when the character moves around when the gravity is on they gain power level, however in my code the player don't have to even move and gravity will hit them and that not what i want to do.
mob
proc
gravitylvl1()
if(src.grav>=1)
if(src.powerlevel<=0)
world<<"Imfo:[src] has killed himself"
spawn()src.deathcheck()
else
if(src.grav>0)
var/powergain=rand(1,6)
if(powergain==1||powergain==3)
src.powerlevel-=src.grav *(rand(1,15))
src.maxpowerlevel += src.grav /(rand(1,10))
src.maxpowerlevel=round(src.maxpowerlevel)
src.maxki+= src.grav/(rand(10,20))
src.maxki=round(src.maxki)
src.stamina-=rand(1,3)
src.fatigue+=rand(1,5)
src.strgain+=rand(1,6)
src.strength+=strgain
src.defgain+=rand(1,7)
src.defense+=defgain
sleep(rand(100,150))
if(powergain==2||powergain==4)
src.powerlevel -= src.grav * (rand(3,15))
src.maxpowerlevel += src.grav /(rand(5,15))
src.maxpowerlevel=round(src.maxpowerlevel)
src.maxki+= src.grav/(rand(15,20))
src.maxki=round(src.maxki)
src.stamina-=rand(1,2)
src.fatigue+=rand(1,3)
src.strgain+=rand(1,4)
src.strength+=strgain
src.defgain+=rand(1,4)
src.defense+=defgain
sleep(rand(100,150))
if(powergain==5||powergain==6)
src.powerlevel -= src.grav * (rand(5,15))
src.maxpowerlevel += src.grav /(rand(1,10))
src.maxpowerlevel=round(src.maxpowerlevel)
src.maxki+= src.grav/(rand(10,15))
src.maxki=round(src.maxki)
src.stamina-=rand(1,5)
src.fatigue+=rand(1,6)
src.strgain+=rand(1,10)
src.strength+=strgain
src.defgain+=rand(5,10)
src.defense+=defgain
sleep(rand(100,150))



it wont work unless i alter Move() like this and i dont think thats how dbz coders do it.how can i accomplish this?
mob
Move()
.=..()
//if the move was successful:
if(.)
if(src.grav>=1)
src.gravitylvl1()
sleep(rand(50,150))
if(src.icon_state=="buku2")
src.icon_state="buku"
That source is so packed full of bugs, and unnecessary clutter that I don't really think it matters "how dbz coders do it", because most of the time they do it wrong. I see three "src.grav" checks doing just about the same thing. If the check doesn't work after the first time,It's probably an indicator somethings wrong with "src.grav", and not an indicator to add two more identical if statements.
I agree with chowder in saying that you shouldnt use those DBZ sources or try to code based off of them. You'll learn alot more and be a better programmer if you just use the guides and try some things on your own.

If im understanding you correctly you're going to want to call the gravity proc in movement by itself.