If you just want to change the display, while leaving player 2's real resources untouched, you will need to create an own UI for that, which pretty much "fakes" the original resource display. You might start by hiding the original resource display via "Show/Hide UI Frame".
If both players are supposed to have the same resources for real (not just displayed) you could just change player 2s resources to match player 1s via triggers. (Using "Player property changes" event).
Thanks. I used your second suggestion and it seems to work well. However I still have a bit of a problem. With shared resources and spending for players 1 and 2, whenever both players have 20+ minerals, I am able to build units that cost 40 minerals, and it'll just take 20 from each player. That's basically what I'm trying to avoid. Is there any way to achieve that?
Im not quite sure what exactly you want to do.
Is it right that all players always have the same amount of resources? So lets say player 1 gains 10 minerals and we have 5 players, then the 10 minerals would be split among all players? (2 minerals each).
If so, you could just trigger resource sharing completly, that would avoid that the players could build stuff that has higher cost than their actual minerals/gas.
This triggered resource sharing could work smth like this:
event:
player X gets Y minerals
actions:
remove Y minerals from player Xs minerals
divide Y by the amount of sharing players
add Y minerals to all sharing players
What I am trying to achieve is the situation you would have in the original StarCraft when you played Team Melee. Two human beings who for the purposes of the game are one and the same player.
Shared vision, control and spending goes a long way towards this, but sadly each player still has their own pool of resources. I'm trying to merge the two pools, which was why my initial idea was to simply let player 2 earn nothing, and just display player 1's resources for him.
In your example above with 5 players sharing 10 minerals, I would not care who had the 10 minerals - they could all have 2, or one could have 10 - doesn't matter to me. What matters are the two following things:
1. They can only afford 1 of a unit that costs 10 minerals.
2. All of their mineral displays say "10", to show that they have 10 minerals on their "team".
Right now it seems like I can get either of those to be true, but only one at a time. I can either have minerals displayed correctly, as if all players share one big resource pool, but then spending will be weird and they can sometimes build more things than they should be able to afford. Or I can have spending work correctly, but when the 5-man team has 10 minerals total, each individual player will only see "2" in his mineral display.
This would be my first attempt to solve the problem:
share minerals
Events
Player - Player 1 Minerals changes
Player - Player 2 Minerals changes
Player - Player 3 Minerals changes
------- ...
Local Variables
Conditions
Actions
Trigger - Turn (Current trigger) Off
Player Group - Pick each player in (Active Players) and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Picked player) != (Triggering player)
Then
Player - Modify player (Picked player) Minerals: Add (Triggering player property change)
Else
General - Wait 0.065 Real Time seconds
Trigger - Turn (Current trigger) On
Theoretically this should work, since each time a player gains minerals all player will gain the gained amount aswell, same goes for losing minerals. This should result in a global "mineral pool" for the team.
The problem is the endless loop right here. You have to turn the trigger off for a short moment (it gets an endless loop without a wait), what means that it can bug if there are very quick property changes.
Since events get checked all 0.0625 seconds 0.065 second wait should be the sweet spot right here, but cant tell 100%.
I might think of a better solution tomorrow when i have more time.
adjust minerals
Events
Player - Player 1 Minerals changes
Player - Player 2 Minerals changes
Player - Player 3 Minerals changes
------- ...
Local Variables
Conditions
Actions
Player Group - Pick each player in (Active Players) and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Picked player) != (Triggering player)
Then
Player - Modify player (Picked player) Minerals: Set To (Player (Triggering player) Minerals)
Else
This should work now, if im not mistaken that should avoid the endless loop.
I tried implementing the trigger. It works pretty much the same as the one I was already using, by ensuring that everyone always has the same amount of minerals.
I can still buy a Zealot for 10 minerals, when each player has 5 minerals though.
That won't work. The whole point of this setup is that there's only one building in the whole map, and it's owned by Player 1, but everyone needs to be able to use it to train units and buy upgrades. And that's only doable with shared spending.
Im not really deep into this topic (Player alliance), but what you are saying is that player 2 cant use player 1s building even with shared control?
If you need to enable shared spending for this to work it could get a little bit complicated, since as far as i know this is hardcoded within starcraft.
But like ive said, there might be someone who can give you more details on this. If you cant change the shared spending behavior i dont see a way to make it impossible to buy units that exceed your resources since this is just part of this option. =/
Is there any way to make Player 2 have Player 1's resources displayed in their resource box, instead of their own?
Example:
Player 2 has 0 minerals
Player 1 has 50 minerals
Both players' displayed mineral number is 50.
This is basically to make shared vision, control and spending behave in a way that makes more sense.
If you just want to change the display, while leaving player 2's real resources untouched, you will need to create an own UI for that, which pretty much "fakes" the original resource display. You might start by hiding the original resource display via "Show/Hide UI Frame".
If both players are supposed to have the same resources for real (not just displayed) you could just change player 2s resources to match player 1s via triggers. (Using "Player property changes" event).
@Mille25: Go
Thanks. I used your second suggestion and it seems to work well. However I still have a bit of a problem. With shared resources and spending for players 1 and 2, whenever both players have 20+ minerals, I am able to build units that cost 40 minerals, and it'll just take 20 from each player. That's basically what I'm trying to avoid. Is there any way to achieve that?
@Cirnu:
Im not quite sure what exactly you want to do.
Is it right that all players always have the same amount of resources? So lets say player 1 gains 10 minerals and we have 5 players, then the 10 minerals would be split among all players? (2 minerals each).
If so, you could just trigger resource sharing completly, that would avoid that the players could build stuff that has higher cost than their actual minerals/gas.
This triggered resource sharing could work smth like this:
event:
player X gets Y minerals
actions:
remove Y minerals from player Xs minerals
divide Y by the amount of sharing players
add Y minerals to all sharing players
@Mille25: Go
What I am trying to achieve is the situation you would have in the original StarCraft when you played Team Melee. Two human beings who for the purposes of the game are one and the same player.
Shared vision, control and spending goes a long way towards this, but sadly each player still has their own pool of resources. I'm trying to merge the two pools, which was why my initial idea was to simply let player 2 earn nothing, and just display player 1's resources for him.
In your example above with 5 players sharing 10 minerals, I would not care who had the 10 minerals - they could all have 2, or one could have 10 - doesn't matter to me. What matters are the two following things:
1. They can only afford 1 of a unit that costs 10 minerals.
2. All of their mineral displays say "10", to show that they have 10 minerals on their "team".
Right now it seems like I can get either of those to be true, but only one at a time. I can either have minerals displayed correctly, as if all players share one big resource pool, but then spending will be weird and they can sometimes build more things than they should be able to afford. Or I can have spending work correctly, but when the 5-man team has 10 minerals total, each individual player will only see "2" in his mineral display.
Ok so basically everything a player earns gets into one big pool, which can be accessed by all players in that team?
@Mille25: Go
Exactly. And all players should be able to see how much is in the pool.
Bump. Still haven't found a solution to this =/
This would be my first attempt to solve the problem:
share minerals
Events
Player - Player 1 Minerals changes
Player - Player 2 Minerals changes
Player - Player 3 Minerals changes
------- ...
Local Variables
Conditions
Actions
Trigger - Turn (Current trigger) Off
Player Group - Pick each player in (Active Players) and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Picked player) != (Triggering player)
Then
Player - Modify player (Picked player) Minerals: Add (Triggering player property change)
Else
General - Wait 0.065 Real Time seconds
Trigger - Turn (Current trigger) On
Theoretically this should work, since each time a player gains minerals all player will gain the gained amount aswell, same goes for losing minerals. This should result in a global "mineral pool" for the team.
The problem is the endless loop right here. You have to turn the trigger off for a short moment (it gets an endless loop without a wait), what means that it can bug if there are very quick property changes.
Since events get checked all 0.0625 seconds 0.065 second wait should be the sweet spot right here, but cant tell 100%.
I might think of a better solution tomorrow when i have more time.
Ok, small adjustment of the trigger:
adjust minerals
Events
Player - Player 1 Minerals changes
Player - Player 2 Minerals changes
Player - Player 3 Minerals changes
------- ...
Local Variables
Conditions
Actions
Player Group - Pick each player in (Active Players) and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Picked player) != (Triggering player)
Then
Player - Modify player (Picked player) Minerals: Set To (Player (Triggering player) Minerals)
Else
This should work now, if im not mistaken that should avoid the endless loop.
@Mille25: Go
I tried implementing the trigger. It works pretty much the same as the one I was already using, by ensuring that everyone always has the same amount of minerals.
I can still buy a Zealot for 10 minerals, when each player has 5 minerals though.
@Cirnu: Go
You need to disable resource sharing, obviously.
@Mille25: Go
That won't work. The whole point of this setup is that there's only one building in the whole map, and it's owned by Player 1, but everyone needs to be able to use it to train units and buy upgrades. And that's only doable with shared spending.
@Cirnu: Go
Im not really deep into this topic (Player alliance), but what you are saying is that player 2 cant use player 1s building even with shared control?
If you need to enable shared spending for this to work it could get a little bit complicated, since as far as i know this is hardcoded within starcraft.
But like ive said, there might be someone who can give you more details on this. If you cant change the shared spending behavior i dont see a way to make it impossible to buy units that exceed your resources since this is just part of this option. =/
Use a blank dialog overlay, disable UI for resources, make a fake looking resource box, update it.