I have a bug constraint in the value variable addition and subtraction conditions

so the problem is when I enter phase 3 of the card purchase process. the value of the variable goes well. but when I enter phase 4 where purchasing the card requires an activation fee of deducting money and deducting the card. where in phase 3 the condition has increased by 1 then in phase 4 it is reduced by 1 because the costs have not changed. but when I restarted with phase 3 the value of the card I bought more than 1. when I entered phase 4 the results were fine. I started it sequentially from phase 1 to phase 4

I need help in this condition. how to handle it. Thank you

Part of 1
phase 1 - 3 are going well



Phase 4 where there is a problem

part of 2 ( when I restarted it and it ran smoothly while in phase 3 I bought more than 1 card for activation )
Phases 1 and 2 I make different values


phase 3

phase 4 runs smoothly when in phase 3 buys more than 1 cards

and this is an event from phase 3 and phase 4 where that problem occurs



whether from the event there was an error when I made it. Please help

There’s a lot to take in and I admit that I don’t understand the sequence.
Unless you want events to repeat while the mouse is down then each group of conditions should end with [Trigger once]

Question: Are you comparing global variables to themselves?
image
To me this looks like the same variable. If I’m wrong then I apologize and there’s something I’m not seeing. If it is the same variable, it will never be true.

To streamline and make things easier to read, you can put similar conditions together and create sub-events.

I don’t know what your variables represent but I’m assuming Uangc needs to be greater than 0 or actually greater than or equal to the value being subtracted. Unless the number can go below zero. You can rearrange, change variable names or operators as you need. This was just an example.

The sub-events only run if the mouse down section is true, so the sub-events in this example don’t need [trigger once] because the previous section has one.

See also:
Events [GDevelop wiki]

You could also add additional subevents to the subevent to handle when there’s not enough. Unless you process that somewhere else.

Edit: Sorry. I realized after I posted that if you check the value is less than after the subtraction is done then it would trigger the is less than event. So, in my example you would reverse the last sub events.

It would probably be better to just not allow an action to happen but I just wanted to modify your current code.

thank you very much. i will try it now