Hi, new day, new question!
How do I… Alternate correctly between two events
"I am trying to alternate between two events (team1action and team2action) to prevent them from occurring simultaneously. I have set up a randomness variable that randomly alternates between two outcomes (1 and 2), assigning each to one of the two teams.
My goal is to decrement the actions available to a team one at a time until they reach 0.
What I’ve noticed is that in some cases (rare but consistent, in every simulation) there are times when the action count decreases for both teams simultaneously, but I don’t understand the reason.
What am I doing wrong in my logic? I have attached the game test for convenience! Thanks to anyone who will answer me!"
If team1action is 1 when the button is clicked it gets reduced to 0 which makes the next event true because team1action is now 0
You can reverse the order of the events so it checks if the value is 0 first before it checks if it’s >1 that way if it changes it to 0 it can’t trigger the team1action=0 event until the next click.
Okay, first of all thank you for your time! I think I understood the logic when one of the attributes is 0.
My main problem still remains: sometimes (random times) when I have two values different from 0 (say 12 and 10) and I click on the button, BOTH values decrease of 1 and I don’t understand why.
The previous line is also picking a new random number which can trigger the events for team2
This is one way to do it.
Wow, now I see how many (and useless) repetition I was making…
Now everything is smooth.
I think I have to study more the structure of the events, I’m 10 days since I start Gdevelop and I don’t quite grasp certain aspects.
Thank you very much for your time, Keith!
You’re welcome. It takes time.