Variable Math Action. How Do I Make One Variable Equal Another?

guy anermanator 10 months ago in Game Creator updated by mcyp 3 months ago 2

Hello Sorry to bother you. I am just trying to use the variable math action to make one variable have the same value but the equal sign does not work. I am wondering what the syntax or format needs to be in order to do this.

Simply I have a current score variable and a high score variable. I used a trigger to check once the score variable is changed than a condition to check if the current score is greater than or equal to the high score. the next part of this would be setting the value of those two values to be equal to one another. The rest I can figure out. This part is the only part stumping me. Thank you very much for your time. 

Unity version:
Game Creator version:
Satisfaction mark by guy anermanator 10 months ago

Yeah this might be a bit confusing. Here's a screenshot showcasing how to do this. The Math Action accepts a formula and stores the result into the variable chosen at the "Result" property.

So in this example below we're storing the value at {1} (which is the local variable "a") at {0} (local variable "b"). Hope this makes sense!

If you would like to store "b = a + 1" you would simply change the formula to "{1} + 1" and the result will be stored in "b" (aka {0}).

I know that this has already been answered but I'd like to add another question since it's related to the Variable Math Action.

In our formula for calculating damage, we are using root square of another stat but it seems the formula cannot recognize the sqrt function. I though I could bypass this process by synchronizing the stat with a local variable and then, through the Math Action, calculate the sqrt of the value within the variable but even there, the sqrt isn't being recognized. 

Am i missing something or is the sqrt function not implemented anywhere in the game creator?