Why are cpus treated as the last player to the first? For example, I join and am player 1, I add a cpu and its player 6. How can I fix this? It screws up my custom team setup for my map.
You can't. I'd recommend avoiding triggers that refer to player numbers because it's entirely messed up.
For example;
Player 1 joins. Player 1 moves to team 2. He's still player 1, even if he has changed teams, and any trigger that assumes he's part of team 1 will fail. This is completely different to WarCraft 3, where your lobby position was strictly tied to your player number.
Use player group commands, like "Players On Team 1" etc. It's the only real way.
I do not use sc2's team functions. I made my own system. I suppose there is sort of a hackish thing I can do to fix it, although it is very annoying.
Edit - Actually this will screw up my whole system. Its no that player 1 becomes player 3 is the issue. Its that the players arent sequential as there can be a player 6 when there is no player 1-5...
I think that's an issue almost everyone goes through at some point. The unfortunate hotfix I've had to adopt is in-game team-picking and saving players as integer variables, and ignoring the lobby as much as possible.
For picking through players, I usually do a For Loop with the condition "Status of player <integer> is playing = true" and that kind of thing.
And the whole issue of computer players joining backwards compared to normal players is an incredibly weird and frustrating "feature." I have no idea why it works that way, but it's caused me weeks of headaches.
Basically, at the start of the game I had to run a For Loop looking for valid players and then assigning them player variables.
For this game, which supported 12 players, I created an array of Integer variables that I called "Player Index." I also made an Integer variable called "Count2". Then I used a for loop with Integer "Count":
For each integer Count from 1 to 12,
If Status of Player Count = Playing,
{set Player Index [Count2] = Count
Set Count2 = Count2 + 1}
Else
{}
The end result gives all the players a "place" in the array of Player Index. From there, in triggers I would reference Player Index instead of the given Player number for things like Leaderboards and the like.
Hopefully that helps and doesn't make things even more confusing.
The problem is I am setting teams up a certain way based on battlenet player ids. This sets my array [5] to player 6, instead of [2]. This game wasnt built for ais, and will probably never add them... I just disallowed ais.
Is there anyway to prevent players from resizing bnet teams? I already checked locked teams.
Is there anyway to prevent players from resizing bnet teams? I already checked locked teams.
You can either;
a) Allow players to swap teams BUT this allows resizing teams
-or-
b) Prevent players from swapping teams BUT this also blocks team resizing
It's unfortunate, but still. I usually go with option a) but add a trigger in the map that detects teams that are over the limit, and throws some players onto the smaller team.
I actually don't know much about what you can do for the lobby in Game Variants. I think you'll probably just have to fiddle around and do some testing. I generally try to limit the size of the lobby and then do everything else in-game to minimize lobby issues, but of course there are some downsides to doing so (boring team-picking at the start of the game, can't guarantee premade teams/clans will be on the same team, etc.).
rut
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Why are cpus treated as the last player to the first? For example, I join and am player 1, I add a cpu and its player 6. How can I fix this? It screws up my custom team setup for my map.
You can't. I'd recommend avoiding triggers that refer to player numbers because it's entirely messed up.
For example;
Player 1 joins. Player 1 moves to team 2. He's still player 1, even if he has changed teams, and any trigger that assumes he's part of team 1 will fail. This is completely different to WarCraft 3, where your lobby position was strictly tied to your player number.
Use player group commands, like "Players On Team 1" etc. It's the only real way.
@TyaArcade: Go
I do not use sc2's team functions. I made my own system. I suppose there is sort of a hackish thing I can do to fix it, although it is very annoying. Edit - Actually this will screw up my whole system. Its no that player 1 becomes player 3 is the issue. Its that the players arent sequential as there can be a player 6 when there is no player 1-5...
I think that's an issue almost everyone goes through at some point. The unfortunate hotfix I've had to adopt is in-game team-picking and saving players as integer variables, and ignoring the lobby as much as possible.
For picking through players, I usually do a For Loop with the condition "Status of player <integer> is playing = true" and that kind of thing.
And the whole issue of computer players joining backwards compared to normal players is an incredibly weird and frustrating "feature." I have no idea why it works that way, but it's caused me weeks of headaches.
Best of luck,
rut
I have already adopted that first thing you mentioned. How did you get around the computer players issue though?
@penguinwars: Go
Basically, at the start of the game I had to run a For Loop looking for valid players and then assigning them player variables.
For this game, which supported 12 players, I created an array of Integer variables that I called "Player Index." I also made an Integer variable called "Count2". Then I used a for loop with Integer "Count":
For each integer Count from 1 to 12,
If Status of Player Count = Playing,
{set Player Index [Count2] = Count
Set Count2 = Count2 + 1}
Else
{}
The end result gives all the players a "place" in the array of Player Index. From there, in triggers I would reference Player Index instead of the given Player number for things like Leaderboards and the like.
Hopefully that helps and doesn't make things even more confusing.
rut
@rutegar: Go
The problem is I am setting teams up a certain way based on battlenet player ids. This sets my array [5] to player 6, instead of [2]. This game wasnt built for ais, and will probably never add them... I just disallowed ais.
Is there anyway to prevent players from resizing bnet teams? I already checked locked teams.
If you go to Game Variants, under Player Attributes you can select each player and under "Controller" you can disallow Computers.
Good luck!
rut
Yea I figured that part out thanks. I edited my post, right before you posted I think.
Is there anyway to prevent players from resizing bnet teams? I already checked locked teams.
What is player logo index? I just noticed it under game variants.
You can either;
a) Allow players to swap teams BUT this allows resizing teams
-or-
b) Prevent players from swapping teams BUT this also blocks team resizing
It's unfortunate, but still. I usually go with option a) but add a trigger in the map that detects teams that are over the limit, and throws some players onto the smaller team.
I actually don't know much about what you can do for the lobby in Game Variants. I think you'll probably just have to fiddle around and do some testing. I generally try to limit the size of the lobby and then do everything else in-game to minimize lobby issues, but of course there are some downsides to doing so (boring team-picking at the start of the game, can't guarantee premade teams/clans will be on the same team, etc.).
rut