• 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] "All Players" variable

Status
Not open for further replies.
Level 2
Joined
Oct 10, 2007
Messages
12
I'm trying to figure out how to perform an action on all players. Specifically, I want to assign the same resources for all players in just a couple Action lines. This will also help for more advanced things I may want to apply to all players, such as some cinematic features (if it is even possible).

allplayer.gif


Is there any way to set it to work with all players instead of just one player at a time? I read something about arrays, but I'm not sure how that works.

One of the other things I tried was this...

badtriggers.gif


... except I don't know if that will work how I want it to, because if it is random, couldn't the same player be selected more than once, and some players not at all?

Please help me out with this. Thanks!
 
Level 9
Joined
Jul 24, 2007
Messages
308
make it lilke this :
  • trigger
    • Events
      • your event
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Player - Set (Player((Integer A))) Current gold to 0
          • Player - Set (Player((Integer A))) Current lumber to 750
(Player((Integer A))) is :Conversation - Convert Player Index to Player then choose For Loop Integer A
 
Level 6
Joined
Nov 4, 2004
Messages
125
Criminal's suggestion works too, but i'd prefer to use a player group:
  • Player Resources
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Player - Add 1000 to (Picked player) Current gold
          • Player - Add 500 to (Picked player) Current lumber
Keep in mind that player groups leak. So if you don't use "GetPlayersAll()" (like in this case, which just returns a bj variable), you might want to unleak when using this more often. Hope that helped!

And btw, that 0.00 seconds wait seems utterly unnecessary to me. It will only cause a 0.27 seconds wait which I'm pretty sure you don't need.
 
Level 2
Joined
Oct 10, 2007
Messages
12
Criminal's suggestion works too, but i'd prefer to use a player group:
  • Player Resources
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Player - Add 1000 to (Picked player) Current gold
          • Player - Add 500 to (Picked player) Current lumber
Keep in mind that player groups leak. So if you don't use "GetPlayersAll()" (like in this case, which just returns a bj variable), you might want to unleak when using this more often. Hope that helped!

And btw, that 0.00 seconds wait seems utterly unnecessary to me. It will only cause a 0.27 seconds wait which I'm pretty sure you don't need.

Thanks, I tried this and it seems to work fine. I wish I knew how to use Player Groups yesterday, LOL. Ah well, "live and learn" eh?


Also, that was a good tip on the Integers, Criminal. Now I know for when I try to use integers for something similar. :grin:
 
Status
Not open for further replies.
Top