It hide button for every player if someone pick it to prevent double choosing.
But we with my friend clicked together on 1 button and trigger executed for us, and starting units are were owned by last clicked player. How solve this one? Is "disable" option for button enough fast to prevent double choosing?
Essentially it checks to see if the global boolean you made for it is true, if so then it skips the actions contained within it, if not then it performs them.
1. You don't need to iterate over the player numbers. You have triggering player and that's all information you need.
2. AND in conditions contains a list of conditions that it connects. OR does the same.
The contained elements within that list all need to return true for the AND to return true.
Every list with conditions automatically acts like an AND. So, you don't need to add an AND into the IF.
3. The "Zerg_Choose_Race_Button" 's visibility to the using player determines if the button was clicked or not.
4. The whole dialog's visibility to the player determines that the player didn't select a unit, yet.
5. Critical section doesn't do anything right now as SC2's triggers are executed after another. So there are no race conditions with variable states meaning deadlock's can't occur.
I need this later, to detect which button was used and add some privillegies to player depends which button used, its only part of trigger. There are spawn points, and obviously 2 players cant spawn at 1 point).Hm, ok,u suggest hide dialog window only if button is visible. I must check this solution, but then how I can press on hidden button if it hidden when first player click on it, or there some pause between clicking on button and reaction from side of game ?)
just set all buttons on creating to active. when a button is used disable it. as condition check if it is active (this condition is undefinded if you do not set the button to active/disabled on creation.
that does the job at least in my map
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Trigger
It hide button for every player if someone pick it to prevent double choosing. But we with my friend clicked together on 1 button and trigger executed for us, and starting units are were owned by last clicked player. How solve this one? Is "disable" option for button enough fast to prevent double choosing?
you should disable the button first with disable (used dialog item) for all players, If that doesn't work, try using the critical section action.
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)
Say more about critical section, never used it before, what it does and how work?
Essentially it checks to see if the global boolean you made for it is true, if so then it skips the actions contained within it, if not then it performs them.
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)
As willuwontu explained, you need to add a condition for that. That condition needs to fail, when it was used before, so it only works once.
As you are hiding buttons after usage for all players, you can just use that as your condition, if the button's actions are executed or not.
Here is your trigger with a few changes:
1. You don't need to iterate over the player numbers. You have triggering player and that's all information you need.
2. AND in conditions contains a list of conditions that it connects. OR does the same.
The contained elements within that list all need to return true for the AND to return true.
Every list with conditions automatically acts like an AND. So, you don't need to add an AND into the IF.
3. The "Zerg_Choose_Race_Button" 's visibility to the using player determines if the button was clicked or not.
4. The whole dialog's visibility to the player determines that the player didn't select a unit, yet.
5. Critical section doesn't do anything right now as SC2's triggers are executed after another. So there are no race conditions with variable states meaning deadlock's can't occur.
I need this later, to detect which button was used and add some privillegies to player depends which button used, its only part of trigger. There are spawn points, and obviously 2 players cant spawn at 1 point).Hm, ok,u suggest hide dialog window only if button is visible. I must check this solution, but then how I can press on hidden button if it hidden when first player click on it, or there some pause between clicking on button and reaction from side of game ?)
@Form01: Go
just set all buttons on creating to active. when a button is used disable it. as condition check if it is active (this condition is undefinded if you do not set the button to active/disabled on creation. that does the job at least in my map