Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

Event Script

CynicSyndrome

Towns Guard
Xy$
0.36
Inside an event I want to take the difference between two variables and store it as a third variable. I have found no way to do this and I think that means it will fall under the "script" option. is that right? I know nothing about javascript. can anyone explain to me how I'd accomplish this?
 

LTN Games

Master Mind
Resource Team
Xy$
0.01
You will be looking to use $gameVariables.value(x); My guess is you will want to subtract one variable from another variable and set a new variable to be the difference.
JavaScript:
// The original code looks like this.
$gameVariables.setValue(var, value)
// This is how to set it up so you get the difference between two values.
$gameVariables.setValue(3, $gameVariables.value(1) -  $gameVariables.value(2));
//This declares a new variable #3, to be equal to the first in-game variable minus the second in-game variable.
Just use the second line of code in a script call to set variable #3 to the difference value.
I hope this helps, if you have any further questions let me know.
 

LTN Games

Master Mind
Resource Team
Xy$
0.01
Yes exactly like that.
JavaScript:
$gameVariables.setValue(//The in game var, //the value you want to set it to)
 
Top