# Envshake's increasing problem (Read 1177 times)

Started by *Ken_Masters*, March 09, 2009, 11:03:39 AM

#### *Ken_Masters*

##### Envshake's increasing problem
#1  March 09, 2009, 11:03:39 AM
Ok i am making a charge code and i want to make it so the env shake gets bigger the longer i stay in the charge state

Thats all working.

But when i stop charging and restarts, the envshake starts small agian

So is it possible for the envshake to remain large when i return the charge like the aura i added

This is the envshake code

Quote
[State 1500, EnvShake]
type = EnvShake
trigger1 = !(time%4)
time = 4
freq = 2+ceil(Time*.05)
ampl = 2+ceil(Time*.05)

#### Kung_Fu_Man

##### Re: Envshake's increasing problem
#2  March 09, 2009, 11:07:22 AM
• Master of the palm and foot.
Use a variable or possible a power check. Time resets to 0 at the start of each state, meaning that when you leave the charge but then return into it, it'll start back over at 0 and cause the envshake effect to start off small again.

By the way, you should probably add some sort of ifelse cap in there so it doesn't get too big.

#### Rajaa Retired

##### Re: Envshake's increasing problem
#3  March 09, 2009, 11:13:31 AM
You could base it off of your current power:

change the (time*.5) into this: (power*.01)

that way if your power limit is 3000, you can get up to a 30 point boost in your evnshake.

or use a variable as time

trigger1=time
var(0)=1

that will increase it as the time increases, then instead of time you can use ceil(var(0)*.5), the variable won't reset at the begginign of the state so, reset the variable accordingly.

I recommend playing around with the power thing, it's simple and requires no wasting of variables.

#### *Ken_Masters*

##### Re: Envshake's increasing problem
#4  March 09, 2009, 11:15:25 AM

I used your first method and it worked thanks Rajaa agian

And thanks Kung_Fu_Man aswell

Oh and BTW Kung_Fu_Man  where would you suggest putting that ifelse cap becuase it does get very big
Last Edit: March 09, 2009, 11:23:34 AM by Ifelse

#### Rajaa Retired

##### Re: Envshake's increasing problem
#5  March 09, 2009, 12:57:47 PM
You probably won't need ifelse because the limit is the amount of power you can have in total multiplied by the amount you specified.

Oh it does get big. hold on.

you put it in the equation,

ceil(ifelse(power >= 2000, 20 , power*.01))

In english:

if your power is greater than or equal to 2000, add 20 to the envshake, if power is not greater than 2000, then add "power*.01."

that's an example, if your power is equal to 2000 and is multiplied by .01 you will get a plus 20 to the envshake, so you can make it so when it reaches that point, it stays there. That's what the ifelse statement above does. You can just do the math to figure out how much it increases, then limit it.

Last Edit: March 09, 2009, 01:04:11 PM by Rajaa

#### *Ken_Masters*

##### Re: Envshake's increasing problem
#6  March 09, 2009, 01:06:59 PM
You probably won't need ifelse because the limit is the amount of power you can have in total multiplied by the amount you specified.

Oh it does get big. hold on.

you put it in the equation,

ceil(ifelse(power >= 2000, 20 , power*.01))

In english:

if your power is greater than or equal to 2000, add 20 to the envshake, if power is not greater than 2000, then add "power*.01."

that's an example, if your power is equal to 2000 and is multiplied by .01 you will get a plus 20 to the envshake, so you can make it so when it reaches that point, it stays there. That's what the ifelse statement above does. You can just do the math to figure out how much it increases, then limit it.

Ah its a good strength now, i was trying all kinds of crazy codes before hand thanks for all your help

#### Rajaa Retired

##### Re: Envshake's increasing problem
#7  March 09, 2009, 01:11:12 PM
Next time, it won't be copy & paste

Spoiler, click to toggle visibilty