So with the help of a tutorial I've created 2-player a map that lets you choose a hero and spawn it (on point 1). The idea though, is to make player 1 spawn on point 1 and player 2 on point 2 (or random if possible).
These are the triggers I'm currently using (to spawn both players on the same position).
Now, my two remaining questions are;
- How do I spawn two players (randomly, if possible) on two different positions (like ladder maps)?
- How do I make the game wait for both players to select their heroes before it spawns them?
Im not very good at explanations, but I have made a few maps like the one you are currently trying to create.
To answer question 1
1. If you want to make it random, make a random variable in your second trigger that gets a random integer between 1 and 2
2. Make another variable that is a boolean (True/False), if above integer is 1, set it to false, if it is 2, set it to true. This will have to be done via an if statement
3. Then, at the end of your trigger, make an if statement that says:
If (Boolean) is true create player 1 unit at spawn point 1 and create player 2 unit at spawn point 2
else create player 1 unit at spawn point 2 and create player 2 unit at spawn point 1
Thinking about this however, it will only work if you make the players wait until all players have chosen...
so on to answer 2
1. Create a variable with an array of however many people will be able to play your game at any one time. Make this variable a unit type.
2. make another trigger than does what i previously mentioned in answer 1, but create the player's variable unit instead.
3. You will have to change the second trigger you have to set the variable of the player to the unit type they have chosen, you may have aleady done this, i cant really see if very well...
4. Make the second trigger check to make sure all of the active player's unit type variable is not "No unit type" when you press the select button. If all the active players have chosen a unit, then run the 3rd trigger I told you to create in step 2.
I'm sorry if this is hard to follow or understand... as I said, I'm not very good at explanations.
Although your information is very detailed, I'm afraid my knowledge about the variables and triggers is too low to do anything with it. I've tried some stuff with the random integer action, but as I already expected, nothing worked. I'd really like this to work though.
Thank you very much, that worked. Now the only thing remaining is the 'wait for all players to choose their hero' part. I was thinking fading out to black and disabling all player input so they can't see or move their hero untill everyone has pressed the choose button. Is this possible?
Made a trigger like this not too long ago. It creates a 'ready' button, when it's pressed it modifies a variable, displays the current value of that variable (as text, informing the players how many people have, in your case, chosen a hero. Each time, it checks if the integer has reached 8, and when it has, it starts the map. In your case you need to wait for two people to press the 'choose button', and then start the map. So what you need to do is the following:
To fade out, just create an action in your map init trigger that fades out for all players. Problem is that AFAIK, you can't fade out for a single player.
Create an integer called 'total chosen' or whatever.
You will also need to create two actions that fires on map init. There you must add player 1 to playergroup[1] and player 2 to playergroup[2] with the 'add player to playergroup' action. We need to do this to hide the 'chooser dialog' from the triggering player.
Also, when the player has chosen, you can, instead of hiding the dialog itself, destroy all of the buttons and set the dialog text to 'waiting for second player'' or whatever.
When I did this, only the second accepting player would have his camera panned and the unit spawned because after the 'then' it didn't consider player 1 as a triggering player. I fixed this by letting the first player spawn + camera panned at the right location and immediatly pausing the last created unit. Then I made it that if 'chosen players' was 2, it would spawn player 2, and unpause all units. It seems to be working pretty good.
Thanks for your help and answers (you too, Oparcus).
So with the help of a tutorial I've created 2-player a map that lets you choose a hero and spawn it (on point 1). The idea though, is to make player 1 spawn on point 1 and player 2 on point 2 (or random if possible).
These are the triggers I'm currently using (to spawn both players on the same position).
Now, my two remaining questions are;
- How do I spawn two players (randomly, if possible) on two different positions (like ladder maps)?
- How do I make the game wait for both players to select their heroes before it spawns them?
Does anyone have some advice for me?
Im not very good at explanations, but I have made a few maps like the one you are currently trying to create.
To answer question 1
1. If you want to make it random, make a random variable in your second trigger that gets a random integer between 1 and 2
2. Make another variable that is a boolean (True/False), if above integer is 1, set it to false, if it is 2, set it to true. This will have to be done via an if statement
3. Then, at the end of your trigger, make an if statement that says: If (Boolean) is true create player 1 unit at spawn point 1 and create player 2 unit at spawn point 2 else create player 1 unit at spawn point 2 and create player 2 unit at spawn point 1
Thinking about this however, it will only work if you make the players wait until all players have chosen...
so on to answer 2
1. Create a variable with an array of however many people will be able to play your game at any one time. Make this variable a unit type.
2. make another trigger than does what i previously mentioned in answer 1, but create the player's variable unit instead.
3. You will have to change the second trigger you have to set the variable of the player to the unit type they have chosen, you may have aleady done this, i cant really see if very well...
4. Make the second trigger check to make sure all of the active player's unit type variable is not "No unit type" when you press the select button. If all the active players have chosen a unit, then run the 3rd trigger I told you to create in step 2.
I'm sorry if this is hard to follow or understand... as I said, I'm not very good at explanations.
Although your information is very detailed, I'm afraid my knowledge about the variables and triggers is too low to do anything with it. I've tried some stuff with the random integer action, but as I already expected, nothing worked. I'd really like this to work though.
You obv. know how to use arrays and stuff.
Create 2 points (at the place you want your heroes to spawn)
Create a variable called 'spawn point of player', set it to 'point' and set it to an array of 2.
Make a 'set variable' action that sets point 1 = spawn point of player[1]
Make a 'set variable' action that sets point 2 = spawn point of player[2]
Now you have two points in one variable and we can use the 'triggering player' as a reference
Under the choose button action simple substitute the 'point 001' with the variable 'spawn point of player[triggering player]'
If triggering player = 1, it will spawn at your first point, and if triggering player = 2 it will spawn at your second point.
Hope it's simple, was too lazy to do it in the editor
@Neonsz: Go
Thank you very much, that worked. Now the only thing remaining is the 'wait for all players to choose their hero' part. I was thinking fading out to black and disabling all player input so they can't see or move their hero untill everyone has pressed the choose button. Is this possible?
@DaanSterk: Go
Made a trigger like this not too long ago. It creates a 'ready' button, when it's pressed it modifies a variable, displays the current value of that variable (as text, informing the players how many people have, in your case, chosen a hero. Each time, it checks if the integer has reached 8, and when it has, it starts the map. In your case you need to wait for two people to press the 'choose button', and then start the map. So what you need to do is the following:
To fade out, just create an action in your map init trigger that fades out for all players. Problem is that AFAIK, you can't fade out for a single player.
Create an integer called 'total chosen' or whatever.
You will also need to create two actions that fires on map init. There you must add player 1 to playergroup[1] and player 2 to playergroup[2] with the 'add player to playergroup' action. We need to do this to hide the 'chooser dialog' from the triggering player.
Then add these extra actions to your trigger
Also, when the player has chosen, you can, instead of hiding the dialog itself, destroy all of the buttons and set the dialog text to 'waiting for second player'' or whatever.
@Neonsz: Go
When I did this, only the second accepting player would have his camera panned and the unit spawned because after the 'then' it didn't consider player 1 as a triggering player. I fixed this by letting the first player spawn + camera panned at the right location and immediatly pausing the last created unit. Then I made it that if 'chosen players' was 2, it would spawn player 2, and unpause all units. It seems to be working pretty good.
Thanks for your help and answers (you too, Oparcus).
@DaanSterk: Go
No prob :)