Hello, I am going crazy
I have an int and I am using the Decrement to substract 1 from it every time an event occurs.
The decrement works only one time then the value is not substracted no matter how many times the pin is executed.
I have tried Decrement, I have tried setting the float subtracting -1 and setting it again, I have tried with functions and also macros with the same result.
In this image attached:
The first Print String is executed,
The int is decremented by 1
Second Print String results correct as -1
Second time, the print string is executed but this time the decrement does not work and the result is every time the same.
The odd thing is that if I’m triggering the this from a keyboard event the decrement works as expected.
But in theory if the print string is triggered it should execute the code right?
I even added a timeline with an event track that should trigger the Execution of the substraction. That still didn’t work
try printing the int before the decrement.
and when you print it again afterwards. get the value from the variable, instead of the decrement node just in-case.
Just to make this clear, If you execute the print string it does not execute the decrement just because it’s integer pin is hooked to the print string. the decrement node only executes when it’s IN execute pin is called.
The variable starts from the initial value every time so the decrement works but the value returns to initial.
The workaround is by saving the variable in the GameInstance outside this actor.
Thank you guys for taking time to respond.
Happy coding!
Cheers!