I need help on makeing a trigger, when the game starts on my map then I want it to automaticly select random players to be on each team, there are 2 teams and its going to be a 2vs6 game but yeah.. I just want it to randomly slect 2 players put them on the 2 player team and put everone else on the other team...
Edit: Ignore anything below this edit...
also if anyone knows how to make a requirement for upgrades that make so when you upgrade one upgrade then it disables the others, like I have 3 upgrades and what I want it to do is when I upgrade one of those then it disables the other two... knowing these would help me out ALOT! plz help...
for the 2nd part for your upgrades check the terran infantry weapons lvl 1 and 2 and 3 for its requirements. and play with it cos i think it needs to be = instead of >= unless it was other way around.
i suppose you can store all the players into a player group then do a random integer thingy from 0-8 2 times and 2nd time make sure it doesnt select same integer. then move those 2 players into a 2nd player group and remove them from the previous all playergroup and then assign teams to the allplayergroup(that is minus the 2 that you removed) and assign the 2nd team to the 2ndplayer group,,, but thats my logic i haven;t worked with teams.
At the start of the game do the following: "Pick each integer (Player Integer) from 1 to 8 and do actions", "Add player (Player Integer) to Team 1"
Player Integer is an integer variable you have created to be used in this loop.
Now make another trigger called "Pick Team 2" that does the following: "Add player (Random integer between 1 and (Number of players in Team 1)) from Team 1 to Team 2" and repeat that action to add another player to Team 2. The inner part of that action will be called "Player from player group" and then set it to the random integer portion you see above. Then remove both players added to Team 2 from Team 1.
I'm sorry for the lack of response in my other thread, I actually have the triggers at home, but haven't been able to post them due to being away. If you still want them, send me a PM.
no problem... I just wanted to get my map finished cause this was the last thing to do, that I know of... but, my map is ready for beta testing so if anyone would like to to help me test send me a PM and I'll get back to you.
ok i made these triggers, but... When there are computers or other players in the game it will give ONLY player 1 a cat and a mouse and everyone else nothing... wtf is up with that?...
Triggers
Mouse Team, Events - Game - Map initialization, Local Variables, Conditions, Actions - General - For each integer Player from 1 to 8 with increment 1, do (Actions) - Actions - Player Group - Add player Player to (Players on team 1) - Variable - Set Mouse Team = (Players on team 1) - Trigger - Run Cat Team (Check Conditions, Don't Wait until it finishes)
Cat Team,
Events,
Local Variables,
Conditions,
Actions -
Player Group - Add player (Random integer between 1 and 8 ) to (Players on team 2)
Player Group - Add player (Random integer between 1 and 8 ) to (Players on team 2)
Variable - Set Cat Team = (Players on team 2)
Player - Make all players in Cat Team treat each other as Ally With Shared Vision
Player - Make all players in Mouse Team treat each other as Ally With Shared Vision
Trigger - Run Mice Spawn (Check Conditions, Don't Wait until it finishes)
Trigger - Run Cat Spawn (Check Conditions, Don't Wait until it finishes)
Well first of all when you use Random integer between X and X you have the chance to select the same Player, you need to set it up so that the Same Player cant be repeated
let AllPlayers = the current amount of players ingame (get this by doing a "For" loop with the condition "Player is ingame" and adding +1 to a variable to keep track)
Follow what EVILEMU posted first, what he has will make 1 team to make the second its the same process but you just need to set the All Player variable to All Players again then remove team 1
honeslty I have no idea where to begin with this one, unless its just because im tired, but ive already spent 5 hours every day for the past 2 weeks to get my map working and this is the LAST thing I need to do...
your code won't work but it is mostly correct, you can't increment a for loop with a variable that you are evaluating as the end condition or it will set itself to 1 and only run once. also, here is the problem i encountered. if i were to select a random integer from 1, size of player group. then remove that entry, let's say the size of the group is 8 and i select number 3. i will remove one player from the active players group and the new size will show 7, so next the random number cannot select 8, but player 8 was never put on a team. that is why i wanted a "Random player from player group" function. i cannot find it though. i used the WC3 editor and i'm still transitioning, the SC2 editor will only accept an integer and i can't find "random player from player group" the problem with integers is that it is a lot of work to create an array of selected numbers checked true or false as already on a team. also, this would conflict with the length that the loop needs to run and allow for errors if we just assume running the loop 100 times would give up the teams we need, because sometimes it will not assign all the players. i feel like this whole post makes no sense...
TLDR: the trigger posted won't work because it is selecting a random number instead of a random player. This could be solved with a variable array but i'm too lazy and want a "Select random player from player group" like in WC3
what you said about the random integer is true, but you can probably use it to pick a random index # of a player in a player group
However you can use the same variable as an increment here look i just put a debug message in to prove it, i tested it with both loops. The only downside is that you cant use the variable within the context of the loop, or it will be on whatever increment it is like 1, 2, 3... etc.
I need help on makeing a trigger, when the game starts on my map then I want it to automaticly select random players to be on each team, there are 2 teams and its going to be a 2vs6 game but yeah.. I just want it to randomly slect 2 players put them on the 2 player team and put everone else on the other team...
Edit: Ignore anything below this edit...
also if anyone knows how to make a requirement for upgrades that make so when you upgrade one upgrade then it disables the others, like I have 3 upgrades and what I want it to do is when I upgrade one of those then it disables the other two... knowing these would help me out ALOT! plz help...
for the 2nd part for your upgrades check the terran infantry weapons lvl 1 and 2 and 3 for its requirements. and play with it cos i think it needs to be = instead of >= unless it was other way around.
@zeropoints: Go
Awesome! I figured the upgrade part out...
ye sorry about teams im unable to help you as i haven't worked with creating 2 opposing teams yet.
i suppose you can store all the players into a player group then do a random integer thingy from 0-8 2 times and 2nd time make sure it doesnt select same integer. then move those 2 players into a 2nd player group and remove them from the previous all playergroup and then assign teams to the allplayergroup(that is minus the 2 that you removed) and assign the 2nd team to the 2ndplayer group,,, but thats my logic i haven;t worked with teams.
Make two player groups: "Team 1" and "Team 2"
At the start of the game do the following: "Pick each integer (Player Integer) from 1 to 8 and do actions", "Add player (Player Integer) to Team 1"
Player Integer is an integer variable you have created to be used in this loop.
Now make another trigger called "Pick Team 2" that does the following: "Add player (Random integer between 1 and (Number of players in Team 1)) from Team 1 to Team 2" and repeat that action to add another player to Team 2. The inner part of that action will be called "Player from player group" and then set it to the random integer portion you see above. Then remove both players added to Team 2 from Team 1.
@PhantomInfernal: Go
Awesome! thanks for the help guys... although I have yet to test my map to see if teams are set up right... any volinteers?
@Titanisdrb: Go
I'm sorry for the lack of response in my other thread, I actually have the triggers at home, but haven't been able to post them due to being away. If you still want them, send me a PM.
@deathtorn: Go
no problem... I just wanted to get my map finished cause this was the last thing to do, that I know of... but, my map is ready for beta testing so if anyone would like to to help me test send me a PM and I'll get back to you.
ok i made these triggers, but... When there are computers or other players in the game it will give ONLY player 1 a cat and a mouse and everyone else nothing... wtf is up with that?...
Triggers
Mouse Team, Events - Game - Map initialization, Local Variables, Conditions, Actions - General - For each integer Player from 1 to 8 with increment 1, do (Actions) - Actions - Player Group - Add player Player to (Players on team 1) - Variable - Set Mouse Team = (Players on team 1) - Trigger - Run Cat Team (Check Conditions, Don't Wait until it finishes)
Cat Team, Events, Local Variables, Conditions, Actions - Player Group - Add player (Random integer between 1 and 8 ) to (Players on team 2) Player Group - Add player (Random integer between 1 and 8 ) to (Players on team 2) Variable - Set Cat Team = (Players on team 2) Player - Make all players in Cat Team treat each other as Ally With Shared Vision Player - Make all players in Mouse Team treat each other as Ally With Shared Vision Trigger - Run Mice Spawn (Check Conditions, Don't Wait until it finishes) Trigger - Run Cat Spawn (Check Conditions, Don't Wait until it finishes)
Well first of all when you use Random integer between X and X you have the chance to select the same Player, you need to set it up so that the Same Player cant be repeated
@Usernameisntworkingright: Go
here's my logic
let AllPlayers = the current amount of players ingame (get this by doing a "For" loop with the condition "Player is ingame" and adding +1 to a variable to keep track)
attached is my logic
@EVILEMU: Go
that would work but for team 2 you need to reset the variable to All Players In-game and remove Player Group Team 1
@Usernameisntworkingright: Go
What you mean like this?
Player Group - Add player (Random integer between 1 and 8 ) to (Players on team 2)
Player Group - Remove player Player from Team 1
Player Group - Add player (Random integer between 1 and 7 ) to (Players on team 2)
Player Group - Remove player Player from Team 1
Variable - Set Team 2 = (Players on Team 2)
The "player" that is capitalized is the integer...
@Titanisdrb: Go
Follow what EVILEMU posted first, what he has will make 1 team to make the second its the same process but you just need to set the All Player variable to All Players again then remove team 1
@Usernameisntworkingright: Go
honeslty I have no idea where to begin with this one, unless its just because im tired, but ive already spent 5 hours every day for the past 2 weeks to get my map working and this is the LAST thing I need to do...
may i suggest you just post your map to one of these dedicated trigger editors that aren't theifs and have some help from him/her (your choice)
@zeropoints: Go
try this i havent tested it yet. you should give EVILEMU credit for coming up with it
@Usernameisntworkingright: Go
your code won't work but it is mostly correct, you can't increment a for loop with a variable that you are evaluating as the end condition or it will set itself to 1 and only run once. also, here is the problem i encountered. if i were to select a random integer from 1, size of player group. then remove that entry, let's say the size of the group is 8 and i select number 3. i will remove one player from the active players group and the new size will show 7, so next the random number cannot select 8, but player 8 was never put on a team. that is why i wanted a "Random player from player group" function. i cannot find it though. i used the WC3 editor and i'm still transitioning, the SC2 editor will only accept an integer and i can't find "random player from player group" the problem with integers is that it is a lot of work to create an array of selected numbers checked true or false as already on a team. also, this would conflict with the length that the loop needs to run and allow for errors if we just assume running the loop 100 times would give up the teams we need, because sometimes it will not assign all the players. i feel like this whole post makes no sense...
TLDR: the trigger posted won't work because it is selecting a random number instead of a random player. This could be solved with a variable array but i'm too lazy and want a "Select random player from player group" like in WC3
@EVILEMU: Go
what you said about the random integer is true, but you can probably use it to pick a random index # of a player in a player group
However you can use the same variable as an increment here look i just put a debug message in to prove it, i tested it with both loops. The only downside is that you cant use the variable within the context of the loop, or it will be on whatever increment it is like 1, 2, 3... etc.
EDIT: see if this map works