• 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] How to make this trigger more simple?

Status
Not open for further replies.
Level 14
Joined
Mar 4, 2009
Messages
1,156
  • GOLD MINES 60 SEC
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • Player - Add ((Number of units in (Units owned by Player 1 (Red) of type Gold Mine)) x (Level of Vampire 0174 <gen>)) to Player 1 (Red) Current gold
      • Player - Add ((Number of units in (Units owned by Player 2 (Blue) of type Gold Mine)) x (Level of Vampire 0174 <gen>)) to Player 2 (Blue) Current gold
      • Player - Add ((Number of units in (Units owned by Player 3 (Teal) of type Gold Mine)) x (Level of Vampire 0174 <gen>)) to Player 3 (Teal) Current gold
      • Player - Add ((Number of units in (Units owned by Player 4 (Purple) of type Gold Mine)) x (Level of Vampire 0174 <gen>)) to Player 4 (Purple) Current gold
i need 4 trigger similar to this one and i need it for 10 players not 4,i am sure it can be done with one action.
 
Level 18
Joined
Mar 7, 2005
Messages
824
Don't know if this works, but you can try it =)
Else I'm not sure if you can make it smaller, but I don't see any problems in copying it 10 times :p

  • Set Players1to10 = (All players controlled by a Benutzer player)
  • Spielergruppe - Pick every player in Players1to10 and do (Actions)
    • Schleifen - Aktionen
      • Spieler - Add ((Number of units in (Units owned by (Picked player) of type Goldmine)) x (Level of Vampire0174)) to (Picked player) Aktuelles Gold
 
Level 14
Joined
Nov 4, 2006
Messages
1,241
  • For each integer A from 1 to 10 do Actions
    • Player - Add ((Number of units in (Units owned by Player [Integer A] of type Gold Mine)) x (Level of Vampire 0174 <gen>)) to Player [Integer A] Current gold
i didn't copy this out of WE, but it should be something like that, just use "for each integer A do actions" and then insert your action
 
Level 13
Joined
Sep 14, 2008
Messages
1,408
  • Set int_max = Number of Players matching (Matching Player) slot status Equal To plays
Paste that one to your map init and to your trigger which handles a leaving player

  • For each integer A from 1 to int_max do Actions

Mh please correct me if i am wrong BUT

if there are player in slot 1,2,3,4,5 AND 10 (maybe one don't like his color -.-)
what would happen?
 
Level 14
Joined
Mar 4, 2009
Messages
1,156
Don't know if this works, but you can try it =)
Else I'm not sure if you can make it smaller, but I don't see any problems in copying it 10 times :p

  • Set Players1to10 = (All players controlled by a Benutzer player)
  • Spielergruppe - Pick every player in Players1to10 and do (Actions)
    • Schleifen - Aktionen
      • Spieler - Add ((Number of units in (Units owned by (Picked player) of type Goldmine)) x (Level of Vampire0174)) to (Picked player) Aktuelles Gold

  • SUPER GOLD MINES 15 Copy
    • Events
      • Time - Every 15.00 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Player - Add ((Number of units in (Units owned by (Picked player) of type Super Gold Mine)) x (Level of Nosferatu (Evil) (PRAVI) 0016 <gen>)) to (Picked player) Current gold

Thx for trigger and i forgot to say that i can put it on all players becouse player 11 and player 12 cannot have gold mines at all (and 0 x level of unit is 0 so its not meather xD)
 
Level 14
Joined
Mar 4, 2009
Messages
1,156
  • For each integer A from 1 to 10 do Actions
    • Player - Add ((Number of units in (Units owned by Player [Integer A] of type Gold Mine)) x (Level of Vampire 0174 <gen>)) to Player [Integer A] Current gold
What happens if you try to add gold to a player who isn't playing?
I have no idea XD

But I would use the way Tr!KzZ used

he has gold but he cannot use it accep if you have control os his units
 
Level 11
Joined
Jul 25, 2005
Messages
573
  • Gold Copy
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • ((Player((Integer A))) controller) Equal to User
                  • ((Player((Integer A))) slot status) Equal to Is playing
            • Then - Actions
              • Player - Add ((Number_of_Gold_Mines x (Number of units in (Units owned by (Player((Integer A)))))) x Level_of_Vampire) to (Player((Integer A))) Current gold
            • Else - Actions
Substitute the variables for the right numbers, I just used variables to substitute that.

This goes through all 10 player slots for the map but will not give gold to the player unless it is a human player, cut out the User part and it will work for computers to.



Edit: Oops misread the the trigger at the top, I thought it was the # of Mines x the # of all the units controlled. Just change that around.
 
Level 14
Joined
Mar 4, 2009
Messages
1,156
Mh please correct me if i am wrong BUT

if there are player in slot 1,2,3,4,5 AND 10 (maybe one don't like his color -.-)
what would happen?

why dont u you just do it like this
EVENTS
-player 1 leaves the game
-player 2 leaves the game
-player 3 leaves the game ...........
-ACTION
-game text (name of triggering player + has left the game)

i think you would also need to remove all his units...
 
Level 11
Joined
Jul 25, 2005
Messages
573
why dont u you just do it like this
EVENTS
-player 1 leaves the game
-player 2 leaves the game
-player 3 leaves the game ...........
-ACTION
-game text (name of triggering player + has left the game)

i think you would also need to remove all his units...

What Dark Angel was referring to is that if you set a Variable to the Number of Players, then used the For 1 - (Variable) function, that it wouldn't work properly if say you had 6 players but the 6th person was in slot 10, because then it would go through player slots 1-6, it wouldn't effect any slot after 10.

And your response would just say if the player left, it wouldn't effect the trigger in any way whatsoever.
 
Status
Not open for further replies.
Top