YesNoOk
avatar

Does anyone know how to turn a variable off? (Read 328 times)

Started by Fluttershy555, January 20, 2020, 05:53:15 PM
Share this topic:
Does anyone know how to turn a variable off?
#1  January 20, 2020, 05:53:15 PM
  • avatar
  • *
    • USA
I would think setting this would turn it off after turning it on.

[State 0, VarSet]
type = VarSet
trigger1 = 0
v = 15
value = 0

But the variable wont turn off. Like say the variable turns on when going into a state i made called 50112 and then i want it to turn off when going into 50113 or something as an example. It wont turn off. How do i turn a variable off? I have this set in 50112

[State 0, VarSet]
type = VarSet
trigger1 = 1
v = 15
value = 1

So now that the player went into 50112 var 15 turned on but i wanna turn it off when the player goes into 50113 and i set this in 50113

[State 0, VarSet]
type = VarSet
trigger1 = 0
v = 15
value = 0

But the variable did not turn off.
Last Edit: January 20, 2020, 06:25:21 PM by Fluttershy555
Re: Does anyone know how to turn a variable off?
#2  January 20, 2020, 05:56:56 PM
  • ****
If the character always go to state 50113 after finishing 50112, use trigger1 = 1 instead of trigger1 = 0.
Re: Does anyone know how to turn a variable off?
#3  January 20, 2020, 06:25:15 PM
  • avatar
  • *
    • USA
Lol wow that was easy thanks. Everything is working great now because the variable turned off!
Re: Does anyone know how to turn a variable off?
#4  January 20, 2020, 06:32:25 PM
  • ****
No problem. Keep in mind that the variable won't turn off if, for example, the character is hit before going to state 50113. It's safer to put it in state -2, something on these lines:

[State -2, VarSet]
type = VarSet
trigger1 = var(15) && StateNo != 50112
v = 15
value = 0

But if it's working for now, no worries. ;D