I started to make a global team level (similar to hotS), so far with the experience I don't have any problems as i did it with 1 dummy unit per team and when they control the level up of the whole team. But I'm also trying to divide the gas earned (gas aka gold in dota/lol) earned by killing enemmies, creep etc. (making all stuff to have multiples of 3 is not an option unfortunetly...) and im quite stuck in dividing the gas earned by 3 as its a 3vs3 game. So does anyone have any idea how to make a system to divide the gas by 3? I can also have a remains system, like 1 players earns 220 gas, 70 or 73 gas will be given to each player and 10 or 1 or gas is stored and used up for the next divide?
Also an important note i can make all the earned gas to be earned by triggers and assigned to variables if it helps.
This should be vary easy to accomplish with triggers. I'll explain how its done with the assumption you know the basics of the trigger editor. If that assumption is false then I could do something more thorough.
I would personally create an event handler for every event that gives gold to a player, and then create one action to give gold to players. There would be a player group for each team, and a constant for every gold amount given out. Also you may be thinking about this part incorrectly, there is no need to ever divide by three. Instead, you just want to apply an action to three separate players.
Event Handler -
The Unit Dies event should cover most if not all the gold triggering events. From there, you can assign the unit that died to a variable as well as the killing unit, and further you could then check the actual unit type of each unit. Unit type of dying unit would determine the gold amount, and unit type of killing unit would ensure its actually a hero that you want to give gold and not another creep (if you have the hero units saved to a variable, checking against that would be more accurate). You'd likely also need to compare the owners of killing and dying units to prevent teams from getting gold off their own minions. At the end it should call the add gold action with the parameters of player (owner of killing unit) and gold amount.
Add Gold Action -
This should have two parameters as just stated, player and gold amount. With the player, you check which player group they are in. Once you know that, you can then loop through each player in that player group and add the respective amount of gold to each.
Edit - There is a function to return players on a team as a player group, so you can use that if don't have your own groups set up.
Here's how I do it in Stukov and Pals.
Event - Unit is killed
Conditions - Use whatever you need for your unique situation. For me it's that the owner of triggering unit is the computer player.
Then I add all the players to a player group and remove the killing player from it. For you, you might just need to add the allies of the killing player to a player group. Note that this is a local variable.
I pick each player in that player group using modify player property.
- The amount I add to those players is the unit property of the triggering unit (Bounty minerals). In your case it'll be bounty vespene.
To divide all income you can use the player property change event. This allows you to get the amount of any income and then divide it appropriately. Obviously you make sure to turn the trigger off when sharing out to prevent an infinite loop. Positive deltas are shared out while negative deltas are ignored.
The problem is this will share all income and even cancelations. As such you might need other events to turn the trigger off when you do not want the income shared.
I've tried doing that but I always seem to have a hard time with infinite loops even when using booleans or turn trigger off/on, so I don't recommend it. So I'd suggest avoiding using player property changes event in conjunction with a modify player property action.
Hello everyone,
I started to make a global team level (similar to hotS), so far with the experience I don't have any problems as i did it with 1 dummy unit per team and when they control the level up of the whole team. But I'm also trying to divide the gas earned (gas aka gold in dota/lol) earned by killing enemmies, creep etc. (making all stuff to have multiples of 3 is not an option unfortunetly...) and im quite stuck in dividing the gas earned by 3 as its a 3vs3 game. So does anyone have any idea how to make a system to divide the gas by 3? I can also have a remains system, like 1 players earns 220 gas, 70 or 73 gas will be given to each player and 10 or 1 or gas is stored and used up for the next divide? Also an important note i can make all the earned gas to be earned by triggers and assigned to variables if it helps.
This should be vary easy to accomplish with triggers. I'll explain how its done with the assumption you know the basics of the trigger editor. If that assumption is false then I could do something more thorough.
I would personally create an event handler for every event that gives gold to a player, and then create one action to give gold to players. There would be a player group for each team, and a constant for every gold amount given out. Also you may be thinking about this part incorrectly, there is no need to ever divide by three. Instead, you just want to apply an action to three separate players.
Event Handler - The Unit Dies event should cover most if not all the gold triggering events. From there, you can assign the unit that died to a variable as well as the killing unit, and further you could then check the actual unit type of each unit. Unit type of dying unit would determine the gold amount, and unit type of killing unit would ensure its actually a hero that you want to give gold and not another creep (if you have the hero units saved to a variable, checking against that would be more accurate). You'd likely also need to compare the owners of killing and dying units to prevent teams from getting gold off their own minions. At the end it should call the add gold action with the parameters of player (owner of killing unit) and gold amount.
Add Gold Action - This should have two parameters as just stated, player and gold amount. With the player, you check which player group they are in. Once you know that, you can then loop through each player in that player group and add the respective amount of gold to each.
Edit - There is a function to return players on a team as a player group, so you can use that if don't have your own groups set up.
Here's how I do it in Stukov and Pals.
Event - Unit is killed
Conditions - Use whatever you need for your unique situation. For me it's that the owner of triggering unit is the computer player.
Then I add all the players to a player group and remove the killing player from it. For you, you might just need to add the allies of the killing player to a player group. Note that this is a local variable.
I pick each player in that player group using modify player property.
- The amount I add to those players is the unit property of the triggering unit (Bounty minerals). In your case it'll be bounty vespene.
To divide all income you can use the player property change event. This allows you to get the amount of any income and then divide it appropriately. Obviously you make sure to turn the trigger off when sharing out to prevent an infinite loop. Positive deltas are shared out while negative deltas are ignored.
The problem is this will share all income and even cancelations. As such you might need other events to turn the trigger off when you do not want the income shared.
@ImperialGood: Go
I've tried doing that but I always seem to have a hard time with infinite loops even when using booleans or turn trigger off/on, so I don't recommend it. So I'd suggest avoiding using player property changes event in conjunction with a modify player property action.
Thank you for the answers, i managed to do it.