Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
So the key is to split an equal amount of gold among players.
Example: Team 1: 5 players. Each player gets 1000 gold. Team 2: 2 players. Each player gets 2500 gold. Oh and it needs to skip players 1 and 7 since they are computers.
1. count how many players are in the team.
2. calculate the gold per player (total/number in team).
3. itterate through the players in the team giving them the gold per player amount of gold.
Repeat for both teams.
What I would do is make a function that takes a force and the gold to share and then does the above 3 steps.
I would then generate 2 forces (1 for each team) in my initialization function.
Your slot layout makes it prety easy. Players 1-5 are in the first force while players 7-11 are in the second force (remember that players are in the range of 0 to 15 (inclusive) with 0 to 11 being the 12 human players).
These 2 forces I would then process to check if the players they contain are actually present in the game. Another custom function that takes a force and returns a new force could be made which itterates through all players in the force and transfers only those that are present to the new force before destroying the old force and returning the new.
Finally 2 calls with those forces to the share function I described would suffice.
Final program flow...
1. Divide players into two teams.
2. Filter inactive players from both teams.
3. Share gold between members of a team for both teams.
1 and 2 could be combined so that it filters before adding to the initial teams but you risk incresed procedural coupling.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.