• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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: 69
  • playergold2.png
    playergold2.png
    283.5 KB · Views: 69
Status
Not open for further replies.
Top