• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

How to setup a READY button?

Status
Not open for further replies.
Level 4
Joined
May 16, 2009
Messages
61
I am making a map where the first thing you see is some options then everyone hits ready and the options close. I have the button and the trigger that results in an action that happens when ready is hit, however I cannot find a way to get the actual playing players incase the map of 4v4 is being played 2v2

ATM I have an array of 8 booleans with the initial value true then in an map initilized trigger I get an integer from 1 to 8 and check player integer status being playing and if it is true then I set Boolean array index integer to false then in my trigger checking if my READY button was hit I set the value of Boolean array index triggering player to true then I check if all values of Boolean array is true then if they are all true it closes the dialog holding everything however whenever I test the map it does not work


Also how would you make a READY button work if my is inefficient?
 
Level 25
Joined
May 11, 2007
Messages
4,650
Why not have a int with the number of active players, that is reduced by 1 each time one of the players are ready.

Then you simply have a if that checks when it's 0.
Add in a timer in case someone goes afk.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
1. Build a player group of all players who are humans and are still playing. (be aware that AI players like when you test a map are playing but not human).
2. Display the options dialog to all humans (in your player group).
3. When ever someone finishes you add their player to another player group (ready people).
4. If someone leaves while this system is active, you need to remove them from the ready people group as well as the active players group.
5. When the ready group contains the same people as the active players group, end the startup.
6. Itterate through each player in the active players group and then check what they voted for.

A common mistake with such a system is that people forget that you need to keep track of who has voted and not just the number of votes. If someone drops while the vote is being done it can lead to bugs and exploits.

Do remember that just because a button is not visible does not mean it can not be pressed. When voting make sure that double clicking the buttons fast will not cause any unexpected side effects.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Use a filter like this
Code:
(PlayerType (p)==c_playerTypeUser && PlayerStatus (p)==c_playerStatusActive)
Where p is an integer representing the player slot you are testing.

This firstly checks if the slot is a user allocated slot. This alone produces the set of all slots that may contain humans.
Next it checks for activity. This alone produces the set of all slots that have active players (both AI and humans).
Finding the intersection of these 2 sets is done via a logical and of the conditions thus producing the set of all players who are a human and who are active.

Logically you can also do this using GUI by aranging elements in the same structure. Unlike WC3 the GUI in SC2 does allow you to do prety much everything.
 
Level 4
Joined
May 16, 2009
Messages
61
I made that filter however the READY button still doesn't work when I test it

OMFG It works now i made the simplest math mistake ever thank you everyone who helped
 
Last edited by a moderator:
Status
Not open for further replies.
Top