Global Variable adds instead of subtract

Randomly, Global Variables just started to add instead of subtract, for example
If I want to remove 5 from 100 it’ll give me 105 instead of 95 and setting the global variable to add subtracts?
adding 5 to 100 gives me 95.
I’ve made sure that anything that could add to the global variable in the external events was disabled and I still got the same results

That would suggest that the global variable is negative.

However, it could be occurring elsewhere - your video is a confusing. You show where you are adding/subtracting the global variable. but there’s no console log action. Yet the console has a whole raft of outputs. That means you’re outputting values somewhere else, and it’s a guess what they are.

But more importantly, put the console log where you think the error is occurring - immediately before the update to Player.HP, and again straight after it. And output both Player.HP and Player.DEF. I suspect you’ll find the error is something else, not a dodgy maths function.

Not sure why, but the issue just fixed itself
Also there is a console log action its
image

1 Like