Hi I used this Video for my Unit Selection
Need help in making it choose one Hero per team, So if from bunch of hero's a person picks one, that hero cannot be picked by people on that Team. How do you do that with this Setup?
The trigger for picking Units basically is What ever Unit the Camera is looking at by pressing Pick, Will appear on map.
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.
When a player makes a unit selection, you need to make it check to make sure the Unit they're trying FYI
select hasn't been picked by any other player. If a unit has been selected, you need a way of making sure no one else can pick it. In order to check if a unit has been picked, you'll have to make either X boolean variables, or one array boolean variable with a size of X. These boolean will hold either true or false depending on whether the Unit has been selected.
So, let's say you have five units, just for example's sake, and when a player presses ENTER you check to see if the player can select it.
On the left windows pane, create a global boolean array with a size of five. Name this variable Unit Selected
Now, when a player pushes ENTER,
check to see if the boolean is set to true, meaning the Unit is already selected (the Unit Selected boolean that is)
if it isn't true, set it to true. If it is true, display a message that says "unit is selected already"
Now, only so the following if the variable was false when you did the check (that is, if the Unit wasn't selected yet)
after setting the boolean to true, wait 1 second
now check all players selected units. If no player's selected unit type equeals the Unit that the player pushed enter on,
... Then set the player that pushed ENTER's selected unit type to the pickled unit.
That is the basic gist of how it works. I'm assuming you are using variables to hold what unit belongs to what player. You can use these unit variables to check unit types. You can so this by using the "unit type of unit" function.
Sorry about the formatting (and the misuse of the acronym FYI). I've made this reply from my phone.
Hope that helps you out. Post again of you need more help.
Hi I used this Video for my Unit Selection Need help in making it choose one Hero per team, So if from bunch of hero's a person picks one, that hero cannot be picked by people on that Team. How do you do that with this Setup?
The trigger for picking Units basically is What ever Unit the Camera is looking at by pressing Pick, Will appear on map.
Please Help, Thank you!!!
@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.
@BasharTeg: Go
Thank you, I am going to try it out
@BasharTeg: Go
Is there a Tutorial on Doing this I couldn't find out how to do it, or can you give me step by step direction in doing this?, thanks
When a player makes a unit selection, you need to make it check to make sure the Unit they're trying FYI select hasn't been picked by any other player. If a unit has been selected, you need a way of making sure no one else can pick it. In order to check if a unit has been picked, you'll have to make either X boolean variables, or one array boolean variable with a size of X. These boolean will hold either true or false depending on whether the Unit has been selected.
So, let's say you have five units, just for example's sake, and when a player presses ENTER you check to see if the player can select it.
On the left windows pane, create a global boolean array with a size of five. Name this variable Unit Selected Now, when a player pushes ENTER,
Now, only so the following if the variable was false when you did the check (that is, if the Unit wasn't selected yet)
... Then set the player that pushed ENTER's selected unit type to the pickled unit.
That is the basic gist of how it works. I'm assuming you are using variables to hold what unit belongs to what player. You can use these unit variables to check unit types. You can so this by using the "unit type of unit" function.
Sorry about the formatting (and the misuse of the acronym FYI). I've made this reply from my phone.
Hope that helps you out. Post again of you need more help.
@gerudobombshell: Go
Thanks alot you are the best