Hi! How can i detect Increases decreases value. I need to create 2 custom events (1 - value is Increases and 2 - value is decreases) Help me pls
are you talking about conditionals: https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/FlowControl/
there are other nodes as well to test conditions, such as < <= > >= , as well as And & And/or there is even a compare node
there is even math nodes: https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/ExpressionReference/Math/index.html
& even more here: https://docs.unrealengine.com/latest/INT/BlueprintAPI/Math/index.html
(& you can even make your own)
** if I understand your problem you probably want to either use branch (if) conditionals nested together or maybe even you Compare Integer (or Compare Float) **
If i understad it correctly. You can use a variable to store your value. Then compare it with the new value, and then store the new value as the old. The you should have a branch for > and <, and it will ignore it if the value is the same.
I, too, have thought about this numerous times and was always using the “workaround” that ziarra proposed.
So, there is no more elegant way to fire code whenever a particular variable was changed? I mean, the workaround is not too complicated, but it requires adding new variables and continuously setting them, which makes larger blueprints slightly more complicated and less clearly to grasp…
If code/script needs fire every time a variable gets a new value that variable should be private, and you should write functions in the blueprint to “get” and “set” the value of the variable.
In the “set” function, you write the logic to compare the new value with the old value and determine if the variable increased or decreased (<, >, etc.).
If you need multiple different blueprints to run code when the variable is changed you can use an event dispatcher.