- Joined
- May 6, 2007
- Messages
- 87
Heyas, folks.
I'm a little bit stumped on how to do this correctly:
Let's say that a player has just left in a TD. I want to split his assets up (gold, towers, etc.) up between the remaining players.
This is what I've got so far:
Any thoughts?
Thanks for your time.
I'm a little bit stumped on how to do this correctly:
Let's say that a player has just left in a TD. I want to split his assets up (gold, towers, etc.) up between the remaining players.
This is what I've got so far:
-
Cleanup
-
Events
- Player - Player 10 (Light Blue)'s Food used becomes Equal to 0.00
- Conditions
-
Actions
- -------- When Light Blue's food reaches zero (all of the attacking monsters are dead), the level is increased. --------
- Set currentLevel = (currentLevel + 1)
- -------- Rewards the players for surviving. --------
- Player Group - Pick every player in (All players) and do (Player - Add (5 + (currentLevel x 2)) to (Picked player) Current gold)
-
Player Group - Pick every player in Allies_Red_Group and do (Actions)
-
Loop - Actions
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Picked player) slot status) Equal to (==) Has left the game
-
Then - Actions
- Set Units_Leaver_Group = (Units owned by (Picked player))
- Set playerGold[(Player number of (Picked player))] = ((Player((Player number of (Picked player)))) Current gold)
- Set totalPlayers = (Number of players in (All players matching ((((Matching player) controller) Equal to (==) User) and (((Matching player) slot status) Equal to (==) Is playing))))
- -------- Resets the leaving player's multiboard information. --------
- Multiboard - Set the text for (Last created multiboard) item in column 1, row boardRow[(Player number of (Picked player))] to |cff808080Disconnec...
- Multiboard - Set the text for (Last created multiboard) item in column 2, row boardRow[(Player number of (Picked player))] to 0
- Multiboard - Set the text for (Last created multiboard) item in column 3, row boardRow[(Player number of (Picked player))] to 0
- Unit Group - Pick every unit in Units_Leaver_Group and do (Unit - Change ownership of (Picked unit) to (Random player from Allies_Red_Group) and Change color)
-
-------- If a player has left, his assets are split up between the remaining players. --------
-
Do Multiple ActionsFor each (Integer A) from 1 to totalPlayers, do (Actions)
-
Loop - Actions
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Player((Integer A))) slot status) Equal to (==) Is playing
-
Then - Actions
- -------- The leaving player's gold is split evenly between the remaining players. --------
-
Player - Add (playerGold[(Player number of (Picked player))] / totalPlayers) to (Player((Integer A))) Current gold
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Count structures controlled by (Picked player) (Include incomplete structures)) Greater than (>) 0
-
Then - Actions
- -------- If the leaving player still has towers, they are split up as evenly as possible between the remaining players. --------
- Unit - Change ownership of (Random unit from (Units owned by (Picked player))) to (Player((Integer A))) and Change color
-
Else - Actions
- Do nothing
-
If - Conditions
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Else - Actions
- Do nothing
-
If - Conditions
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
Do Multiple ActionsFor each (Integer A) from 1 to totalPlayers, do (Actions)
- Custom script: call DestroyGroup(udg_Units_Leaver_Group)
-
Else - Actions
- Do nothing
-
If - Conditions
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
Events
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Count structures controlled by (Picked player) (Include incomplete structures)) Greater than (>) 0
-
Then - Actions
- -------- If the leaving player still has towers, they are split up as evenly as possible between the remaining players. --------
- Unit - Change ownership of (Random unit from (Units owned by (Picked player))) to (Player((Integer A))) and Change color
-
Else - Actions
- Do nothing
-
If - Conditions
Any thoughts?
Thanks for your time.