You'll need a boolean variable for each available hero. If you have a lot of heroes to choose from, a boolean array would be the easiest to use. At hero selection (when the player clicks the "pick" button,) include a condition which checks to see if the corresponding boolean variable is True or False. If False, proceed with selection and set the boolean to True. If True, display an error message. You could also disable the "pick" button if an already selected hero is being viewed.
Also, be sure to take network lag into account. If two people hit the "pick" button at the same time you might end up with duplicate heroes. Disabling the button right away, then adding a short wait command, followed by the boolean variable check should be enough to deal with that issue.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
@DJYVG: Go
You'll need a boolean variable for each available hero. If you have a lot of heroes to choose from, a boolean array would be the easiest to use. At hero selection (when the player clicks the "pick" button,) include a condition which checks to see if the corresponding boolean variable is True or False. If False, proceed with selection and set the boolean to True. If True, display an error message. You could also disable the "pick" button if an already selected hero is being viewed.
Also, be sure to take network lag into account. If two people hit the "pick" button at the same time you might end up with duplicate heroes. Disabling the button right away, then adding a short wait command, followed by the boolean variable check should be enough to deal with that issue.