ID:140178
 
Code:
mob
proc
gravitylvl1()
spawn(rand(100,200))
gravitylvl1()
if(src.grav>0)
var/powergain=rand(1,6)
if(powergain==1||powergain==3)
src.powerlevel-=src.grav *(rand(1,10))
if(src.powerlevel>=1)
src<<"You feel the gravity force pulling you down."
src.maxpowerlevel += src.grav /(rand(1,20))
src.maxpowerlevel=round(src.maxpowerlevel)
src.maxki+= src.grav/(rand(60,90))
src.maxki=round(src.maxki)
src.stamina-=rand(1,5)
src.fatigue+=rand(1,5)
src.strgain+=rand(1,6)
src.strength+=strgain
src.defgain+=rand(1,7)
src.defense+=defgain
else
src.deathcheck()
if(powergain==2||powergain==4)
src.powerlevel -= src.grav * (rand(3,10))
if(src.powerlevel>=1)
src<<"You feel the gravity force lighten.."
src.maxpowerlevel += src.grav /(rand(5,25))
src.maxpowerlevel=round(src.maxpowerlevel)
src.maxki+= src.grav/(rand(50,80))
src.maxki=round(src.maxki)
src.stamina-=rand(1,3)
src.fatigue+=rand(1,3)
src.strgain+=rand(1,4)
src.strength+=strgain
src.defgain+=rand(1,4)
src.defense+=defgain
else
src.deathcheck()
if(powergain==5||powergain==6)
src.powerlevel -= src.grav * (rand(5,15))
if(src.powerlevel>=1)
src<<"You feel tremendous amount of gravity..pulling you down."
src.maxpowerlevel += src.grav /(rand(1,10))
src.maxpowerlevel=round(src.maxpowerlevel)
src.maxki+= src.grav/(rand(50,60))
src.maxki=round(src.maxki)
src.stamina-=rand(1,7)
src.fatigue+=rand(1,6)
src.strgain+=rand(1,10)
src.strength+=strgain
src.defgain+=rand(5,10)
src.defense+=defgain
else
src.deathcheck()
else
return


Problem description:
This is my gravity system, but as it is at the moment the client gains power without even moving.I want the client to be gaining power as they move around the gravity chamber and not by just standing around
Change Move() to do that, then.
In response to Garthor
Yes, but how exactly would i go about doing that?
In response to GrimmJore
By putting, in Move(), whatever it is you want to have happen whenever something moves.
In response to Garthor
Garthor wrote:
By putting, in Move(), whatever it is you want to have happen whenever something moves.

mob
proc
gravitylvl1()
if(src.grav>=1)
if(src.powerlevel<=0)
spawn(10)src.deathcheck()
world<<"Imfo:[src] has killed himself"
else
if(src.grav>0)
sleep(10)
var/powergain=rand(1,6)
if(powergain==1||powergain==3)
src.powerlevel-=src.grav *(rand(1,10))
src<<"You feel the gravity force pulling you down."
while(src.move)
spawn(40)
src.maxpowerlevel += src.grav /(rand(1,20))
src.maxpowerlevel=round(src.maxpowerlevel)
src.maxki+= src.grav/(rand(60,90))
src.maxki=round(src.maxki)
src.stamina-=rand(1,5)
src.fatigue+=rand(1,5)
src.strgain+=rand(1,6)
src.strength+=strgain
src.defgain+=rand(1,7)
src.defense+=defgain
if(powergain==2||powergain==4)
src.powerlevel -= src.grav * (rand(3,10))
src<<"You feel the gravity force lighten.."
while(src.move)
spawn(40)
src.maxpowerlevel += src.grav /(rand(5,25))
src.maxpowerlevel=round(src.maxpowerlevel)
src.maxki+= src.grav/(rand(50,80))
src.maxki=round(src.maxki)
src.stamina-=rand(1,3)
src.fatigue+=rand(1,3)
src.strgain+=rand(1,4)
src.strength+=strgain
src.defgain+=rand(1,4)
src.defense+=defgain
if(powergain==5||powergain==6)
src.powerlevel -= src.grav * (rand(5,15))
src<<"You feel tremendous amount of gravity..pulling you down."
while(src.move)
src.maxpowerlevel += src.grav /(rand(1,10))
src.maxpowerlevel=round(src.maxpowerlevel)
src.maxki+= src.grav/(rand(50,60))
src.maxki=round(src.maxki)
src.stamina-=rand(1,7)
src.fatigue+=rand(1,6)
src.strgain+=rand(1,10)
src.strength+=strgain
src.defgain+=rand(5,10)
src.defense+=defgain

Yup, I have already tried that with the while proc but the world crashes at run time.Is there a better alternative?
In response to GrimmJore
This would be because you are using spawn() where you mean to be using sleep(). Look them up in the Reference.

And you aren't using Move() at all here so I have to wonder how you could possibly think that you've already tried that.
In response to Garthor
hmm.. i thought i was using it in my previous post but this is the best i've came up with,but i still have not got the results that i wanted.
mob
proc
gravitylvl1()
if(src.grav>=1)
if(src.powerlevel<=0)
spawn(10)src.deathcheck()
world<<"Imfo:[src] has killed himself"
else
if(src.grav>0)
sleep(10)
var/powergain=rand(1,6)
if(powergain==1||powergain==3)
src.powerlevel-=src.grav *(rand(1,10))
src<<"You feel the gravity force pulling you down."
src.maxpowerlevel += src.grav /(rand(1,20))
src.maxpowerlevel=round(src.maxpowerlevel)
src.maxki+= src.grav/(rand(60,90))
src.maxki=round(src.maxki)
src.stamina-=rand(1,5)
src.fatigue+=rand(1,5)
src.strgain+=rand(1,6)
src.strength+=strgain
src.defgain+=rand(1,7)
src.defense+=defgain
if(powergain==2||powergain==4)
src.powerlevel -= src.grav * (rand(3,10))
src<<"You feel the gravity force lighten.."
src.maxpowerlevel += src.grav /(rand(5,25))
src.maxpowerlevel=round(src.maxpowerlevel)
src.maxki+= src.grav/(rand(50,80))
src.maxki=round(src.maxki)
src.stamina-=rand(1,3)
src.fatigue+=rand(1,3)
src.strgain+=rand(1,4)
src.strength+=strgain
src.defgain+=rand(1,4)
src.defense+=defgain
if(powergain==5||powergain==6)
src.powerlevel -= src.grav * (rand(5,15))
src<<"You feel tremendous amount of gravity..pulling you down."
src.maxpowerlevel += src.grav /(rand(1,10))
src.maxpowerlevel=round(src.maxpowerlevel)
src.maxki+= src.grav/(rand(50,60))
src.maxki=round(src.maxki)
src.stamina-=rand(1,7)
src.fatigue+=rand(1,6)
src.strgain+=rand(1,10)
src.strength+=strgain
src.defgain+=rand(5,10)
src.defense+=defgain
spawn(40)
if(src.move==1)
spawn()src.gravitylvl1()

What i am trying to do is for every step the client takes, the gravitylvl1() runs.The code above runs it regardless if the client is moving or not.I dont know how to actually control the steps the client takes or how to tell if they have moved.
In response to GrimmJore
It takes me about two seconds to see that you have put absolutely nothing in the Move() proc and therefore what you have will not do anything upon a player moving.

If you want something to happen when a mob moves, it goes in Move().
In response to Garthor
Garthor you've said that like six times what hes asking is for you to show him what you mean =/
In response to Yugioh23
mob
Move()
// Perform default action:
.=..()
// STUFF
In response to Garthor
thats not what he is asking for either he whants you to give him a example of how it should be made
In response to Yugioh23
That's exactly what he just did.