I got a good Idea for a new event

A new event where you can do actions when the value of a variable changes.

So like when the value of a variable changes, you can play a sound effect or any action.

You might need to provide more context, as that’s already how events work today, and kind of the entire point of conditions.

You can use the condition “The value of scene/global/object variable blah = 1” and the event actions will occur when it is = 1.

Or, if you’re trying to say “do an action if the variable is different than last frame”, all you would do is have 2 variables.

e.g. MainVariable (The one you’re using in the rest of your primary event logic) and TestVariable (used specifically for this trigger)

Global Variable TestVariable != MainVariable | Do your actions desired actions here
                                             | Change the value of Global Variable TestVariable = GlobalVariable(MainVariable)

This basically allows you to do all of your normal events in regards to MainVariable, and whenever it’s value changes, TestVariable being different triggers whatever actions you want, then updates itself to match MainVariable.

Its like
Every time variable whatever has a new value from the previous

Yeah, that exists today using the conditions and actions I mentioned above.

1 Like

In some programming languages like Swift there is something called “property observers” which allow you to define instruction that you would like to execute when the value of a variable is either changed or about to change. Looks something like this:

var health = 100{

         //execute instruction whenever the value has changed

       //execute instruction when the value is about to change 
       //_value return the new value before we set this value 
       //so you can perform checks and do operations on it before you set it


It is useful to keep your logic organised and willSet() is especially useful when you want to do some validation before you set a value

So maybe the OP was asking for something like this. I could imagine being implemented in the variable editor where you can add property observer/variable event to a variable.