1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Trigger] A Resourse dispensation trigger

Discussion in 'Triggers & Scripts' started by Giantr, Feb 10, 2009.

  1. Giantr

    Giantr

    Joined:
    Dec 4, 2007
    Messages:
    108
    Resources:
    0
    Resources:
    0
    What I want to do is when a player leaves all the resourses he has , and he has spent to be gives to his allies. The problem is .. how is it possible to make a trigger that checks how much resourses has the player spent and then to give it to his allies.

    EDIT: I think I did it, but I'm not sure ... Here Is the trigger

    • Player Leave trigger
      • Events
        • Player - Player 1 (Red) leaves the game
        • Player - Player 2 (Blue) leaves the game
        • Player - Player 3 (Teal) 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
        • Player - Player 10 (Light Blue) leaves the game
        • Player - Player 11 (Dark Green) leaves the game
        • Player - Player 12 (Brown) leaves the game
      • Conditions
      • Actions
        • Set Team[1] = (All allies of Player 1 (Red))
        • Set Team[2] = (All allies of Player 4 (Purple))
        • Set Team[3] = (All allies of Player 7 (Green))
        • Set Team[4] = (All allies of Player 10 (Light Blue))
        • Set PlayerVar = (Triggering player)
        • Unit Group - Pick every unit in (Units owned by PlayerVar) and do (Actions)
          • Loop - Actions
            • Unit - Explode (Picked unit)
        • Player Group - Pick every player in (All allies of PlayerVar) and do (Actions)
          • Loop - Actions
            • Player - Add ((PlayerVar Total gold gathered) / (Number of players in Team[(Team number of (Triggering player))])) to (Picked player) Current gold


    So any sugestions?
     
    Last edited: Feb 10, 2009
  2. M0RT

    M0RT

    Joined:
    Apr 15, 2008
    Messages:
    1,067
    Resources:
    6
    Maps:
    3
    StarCraft II Resources:
    1
    Tutorials:
    2
    Resources:
    6
    I am afraid "total gold gathered" covers only gold mined by workers.

    Also, "Allies of Player()" will return computer players and (if you don't have AI, this could be problem for you) and player which already left the game.

    I suggest this:
    • Map Init Trigger
    • Actions
      • Set Team[1] = (All allies of Player 1 (Red) matching ( MP is player-controlled and MP is playing ) )
      • Set Team 2 ........

    • Player Left
    • Events
      • Player - Player 1 (Red) leaves the game
      • Player - Player 2 and so on......
    • Actions
      • For Integer A from 1 to 4
        • If( (Triggering player) is in Team[A] )
          • Player Group - Remove (Triggering Player) from Team[A]
          • Player Group - Pick All Players in Team[A]
            • Gold - Add ( ((Triggering Player) Total gold gathered/number of players in Team[A]) to Picked Player
          • Skip Remaning Actions
     
  3. Meticulous

    Meticulous

    Joined:
    Nov 15, 2007
    Messages:
    779
    Resources:
    0
    Resources:
    0
    Create a variable for each player that increases every time they gain resources if you want a total from bounties/triggered income etc., what the other guy said should work fine for distribution.