In my map there are teams of multiple players, and I'm trying to have team1 resources shown to all players on team1
So far my proof-of-concept looks like this, and works perfectly as long as the players stay in the game.
Events:
Player - Player (Player 1 from (Players on team 1)) Minerals changes
Local Variables:
p = (Player 1 from (Players on team 1)) <Integer>
Actions:
update_team_ui(1, (Player p Minerals))
When player 1 leaves though, they keep getting their income, and their minerals keep changing.
The system bugs out though, and the resource count of Player 1, which is displayed to the other players, keeps going back to 0 after it's increased.
So if a player makes 100 minerals for income, other players will see that his resource count is now 100, but then it just goes back to 0.
However, I know he has the resources still, because I can still spend them after he's gone.
Does anyone know how I can fix this?
Does (Player 1 from (Players on team 1)) return the player who has left, or the first active player on the team??
How do I accurately find the resources of a player who has left?
i've created a workaround. I'm using an integer array in the background to keep track of the real minerals everyone has. then i'm synchronizing the visible minerals once a second with the hidden integer variable for all 'playing' players. it my cause problems if you are really using the minerals with a worker or so. in income wras the minerals are only cosmetic, all buy triggers are calculating with my own variable.
bone,
Yes, the minerals are actually used by the drones.
Thanks for the reply. Unfortunately this didn't fix my problem. However, if I misunderstood you, let me know.
What I tried was this:
On map init, save the team1player1 player as a global variable
Events:
Game - Map initialization
Actions:
Data Table - Save (Player 1 from (Players on team 1)) as "player_1_team_1" in the Global data table
when his minerals change, update everyone on that teams UI dialogs
Then, in another trigger:
Events:
Player - Player ("player_1_team_1" from the Global data table) Minerals changes
Local Variables:
p1 = ("player_1_team_1" from the Global data table) <Integer>
Actions:
update_team_ui(1, (Player p1 Minerals))
The update_team_ui function looks like this: This updates the dialog item 'player_1_team_1_minerals', which is linked to everyones UI, and everyone sees it updated instantly
Parameters:
minerals = 0 <Integer>
team = 0 <Integer>
Actions:
Dialog - Set ("player_1_team_1_minerals") from the Global data table) text to (Text(minerals)) for (Players on team team)
If anyone could please help me with this issue, I would really appreciate it.
Again, the problem i'm having is that the I can't seem to access the number of minerals a player has, once they have left the game.
In my map there are teams of multiple players, and I'm trying to have team1 resources shown to all players on team1
So far my proof-of-concept looks like this, and works perfectly as long as the players stay in the game.
Events:
Player - Player (Player 1 from (Players on team 1)) Minerals changes
Local Variables:
p = (Player 1 from (Players on team 1)) <Integer>
Actions:
update_team_ui(1, (Player p Minerals))
When player 1 leaves though, they keep getting their income, and their minerals keep changing.
The system bugs out though, and the resource count of Player 1, which is displayed to the other players, keeps going back to 0 after it's increased.
So if a player makes 100 minerals for income, other players will see that his resource count is now 100, but then it just goes back to 0.
However, I know he has the resources still, because I can still spend them after he's gone.
Does anyone know how I can fix this?
Does (Player 1 from (Players on team 1)) return the player who has left, or the first active player on the team??
How do I accurately find the resources of a player who has left?
Any assistance would be appreciated, thanks.
-Max
i've created a workaround. I'm using an integer array in the background to keep track of the real minerals everyone has. then i'm synchronizing the visible minerals once a second with the hidden integer variable for all 'playing' players. it my cause problems if you are really using the minerals with a worker or so. in income wras the minerals are only cosmetic, all buy triggers are calculating with my own variable.
bone,
Yes, the minerals are actually used by the drones.
Thanks for the reply. Unfortunately this didn't fix my problem. However, if I misunderstood you, let me know.
What I tried was this:
On map init, save the team1player1 player as a global variable
Events:
Game - Map initialization
Actions:
Data Table - Save (Player 1 from (Players on team 1)) as "player_1_team_1" in the Global data table
when his minerals change, update everyone on that teams UI dialogs
Then, in another trigger:
Events:
Player - Player ("player_1_team_1" from the Global data table) Minerals changes
Local Variables:
p1 = ("player_1_team_1" from the Global data table) <Integer>
Actions:
update_team_ui(1, (Player p1 Minerals))
The update_team_ui function looks like this:
This updates the dialog item 'player_1_team_1_minerals', which is linked to everyones UI, and everyone sees it updated instantly
Parameters:
minerals = 0 <Integer>
team = 0 <Integer>
Actions:
Dialog - Set ("player_1_team_1_minerals") from the Global data table) text to (Text(minerals)) for (Players on team team)
If anyone could please help me with this issue, I would really appreciate it.
Again, the problem i'm having is that the I can't seem to access the number of minerals a player has, once they have left the game.
Thanks,
-Max
I've fixed this issue.
The problem was the auto-redistribution of resources after someone leaves.
The solution was to take this into consideration.
I'm now simply displaying the sum of the resources for that entire team.
-Max