The player has 200/200 Health at the start of the scene. So the maximum is 200. He will take some damage during the game, but if he drinks a health potion, he will reach the maximum health value of 200. So far everything is working.
In the later stage of the game, there will be a situation where the maximum health value will expand from 200 to 230. Every time the player picks up the Heart object, the maximum health value will increase by 30. But somehow it doesn’t work. When I pick up the heart, the maximum health value does not increase to 230 and the hero gets minus 30 to the current health. Thanks for any advice. :-).
Condition is checking if variable is heath is higher than max helth
If you invert it then it is checking if its lower
So you could just not invert it and check if its less than
2nd of all consider do you want to use object variables instead of global variables
IF you delete your player like he dies and he have many lives
You will lose all variables value
Not to mention global vars work between scenes
Next
1 - you did understand you should just add value to variable
2 - so you should follow same logic here where you simply add 30 to max health instead of adding max health to max health + 30
Lastly why not go with variable names
HP and HPMax
Look how long your var names are already
You will need to save it later
And it will become way too long since you will save structures
Anyway my only suspect here is that you set max health to max health + 30
But that should work
If not then i have no idea
This is most important part the 1st part you just wrote
Look you had before HP MAX at 200
You add 30 to your HP MAX when you get health potion
And you get -30 HP or HP MAX whatever
What is important here
You changed HP MAX from 200 to 240
And instead of adding 30 you are adding 50
So now it should give you either -50 or -10 but not again -30
Which means what you just changed have ABSOLUTELLY NO effect for what is causing it
I would suspect you have somewhere event that is setting HP to -30
Cause there is no other way to explain it
Because there is NO WAY for it to still be -30 AFTER you changed max hp value and for how much max hp you get after you pick up health item
About what you don’t understand
This is less important but it can actually fix stuff
Or more like let you bypass your bug while not fixing it
You have action here
Change variable HP MAX add 30
Delete Health
I ask you to add there one more variable change but for HP var
Change variable HP MAX add 30
Change variable HP add 30
Delete Health
Random thing, but you shouldn’t have Trigger once in these events. You are already making sure the condition will not be true again by deleting the object or changing the variable.
Also, this will not work properly if you collide with more than one potion or health upgrade at the same time. In order to take into account all colliding objects you would need a “repeat for each” sub event.