• 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] A Resourse dispensation trigger

Status
Not open for further replies.
Level 5
Joined
Dec 4, 2007
Messages
111
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:
Level 12
Joined
Apr 15, 2008
Messages
1,063
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
 
Level 11
Joined
Nov 15, 2007
Messages
800
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.
 
Status
Not open for further replies.
Top