• 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!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Gold not being correctly split on player leave

Status
Not open for further replies.
Level 7
Joined
Aug 5, 2010
Messages
147
I have made a trigger that divides the gold of the leaving player by the amount of players that are left in the game, however when their are more than 3 players the gold doesn't get split correctly. See attached images.

When i run the map with 3 players everyone gets the right amount of gold, anything above that and players for some reason get more gold than they should.

When a player leaves i made it so a message appears on screen, this message shows the right amount of gold a player should get, but only when the 1st player leaves, all other messages are broke because of players getting extra gold.

Here is the trigger
  • Player Leave Gold Split
    • Events
      • Player - Player 1 (Red) leaves the game
      • Player - Player 2 (Blue) leaves the game
      • Player - Player 3 (Teal) leaves the game
      • Player - Player 4 (Purple) leaves the game
      • Player - Player 5 (Yellow) leaves the game
      • Player - Player 6 (Orange) leaves the game
      • Player - Player 7 (Green) leaves the game
      • Player - Player 8 (Pink) leaves the game
      • Player - Player 9 (Gray) leaves the game
    • Conditions
    • Actions
      • Set Players = (Players - 1)
      • Set PlayerLeaveGold = ((Triggering player) Current gold)
      • Game - Display to (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing))) the text: (((Name of (Triggering player)) + , Has left the game.) + (You have been given + ((|cffFDD017 + (String((PlayerLeaveGold / Players)))) + Gold.|r)))
      • Player Group - Pick every player in (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing))) and do (Actions)
        • Loop - Actions
          • Player - Add (((Triggering player) Current gold) / Players) to (Picked player) Current gold
      • Player - Set (Triggering player) Current gold to 0
      • Multiboard - Set the text for (Last created multiboard) item in column 3, row Multiboard_Spots[(Player number of (Triggering player))] to (|cffFF0000 + 0)
      • Multiboard - Set the text for (Last created multiboard) item in column 1, row MultiBoard_List to (MultiBoard_Colours[(Player number of (Picked player))] + (Player Has Left + |r))
 

Attachments

  • playergold1.png
    playergold1.png
    139.6 KB · Views: 71
  • playergold2.png
    playergold2.png
    283.5 KB · Views: 71
Status
Not open for further replies.
Top