• 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.

Apply Upgrades in a Pick Players Group?

Level 21
Joined
Mar 16, 2008
Messages
970
Is there anything blatantly wrong about this trigger? It seems to be working inconsistently and I'm not sure why. Players 1, 2, 3, 4 seem to consistently get the upgrade. Players 13, 14, 15, 16 do not. Sometimes players 13 and 16 get it, next time players 13 and 14. Is this a situation that needs a Wait?

  • Insane Cheats
    • Events
      • Player - Player 23 (Emerald) types a chat message containing run as An exact match
      • Time - Elapsed game time is 305.00 seconds
    • Conditions
      • insane_king Equal to True
    • Actions
      • Game - Display to (All players) for 5.00 seconds the text: Insane King has act...
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • insane_cheats[1] Equal to True
        • Then - Actions
          • Player Group - Pick every player in Groups[1] and do (Actions)
            • Loop - Actions
              • Player - Set the current research level of Royal Weapons to 20 for (Picked player)
              • Player - Set the current research level of Royal Armor to 20 for (Picked player)
              • Player - Set the current research level of Sorcery Upgrade to 3 for (Picked player)
              • Player - Set the current research level of Upgrade Forces: Royal Exemplar XL (dota) to 1 for (Picked player)
              • Player - Set the current research level of Activate Royal Mage Tower to 1 for (Picked player)
          • Set VariableSet Research_Red_Extra[1] = True
          • -------- Royal Court Mage RED --------
          • Special Effect - Destroy royal_ct_sfx_red
          • Unit - Make Royal Mage Tower 1570 <gen> Vulnerable
          • Unit - Change ownership of Royal Mage Tower 1570 <gen> to Player 13 (Maroon) and Change color
          • Unit - Order Royal Mage Tower 1570 <gen> to train/upgrade to a Royal Court Mage
          • Unit - Order Royal Mage Tower 1570 <gen> to train/upgrade to a Royal Court Mage
          • Unit - Order Royal Mage Tower 1570 <gen> to train/upgrade to a Royal Court Mage
          • Unit - Order Royal Mage Tower 1570 <gen> to train/upgrade to a Royal Court Mage
          • Trigger - Turn on royal ct mage dies red <gen>
          • Trigger - Turn on royal court trained red <gen>
          • Trigger - Turn on royal ct destroyed red <gen>
          • Trigger - Turn off court_mage_triggers[1]
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • insane_cheats[2] Equal to True
        • Then - Actions
          • Player Group - Pick every player in Groups[2] and do (Actions)
            • Loop - Actions
              • Player - Set the current research level of Royal Weapons to 20 for (Picked player)
              • Player - Set the current research level of Royal Armor to 20 for (Picked player)
              • Player - Set the current research level of Sorcery Upgrade to 3 for (Picked player)
              • Player - Set the current research level of Upgrade Forces: Royal Exemplar XL (dota) to 1 for (Picked player)
              • Player - Set the current research level of Activate Royal Mage Tower to 1 for (Picked player)
          • Set VariableSet Research_Blue_Extra[1] = True
          • -------- Royal Court Mage BLUE --------
          • Special Effect - Destroy royal_ct_sfx_blue
          • Unit - Make Royal Mage Tower 1567 <gen> Vulnerable
          • Unit - Change ownership of Royal Mage Tower 1567 <gen> to Player 14 (Navy) and Change color
          • Unit - Order Royal Mage Tower 1567 <gen> to train/upgrade to a Royal Court Mage
          • Unit - Order Royal Mage Tower 1567 <gen> to train/upgrade to a Royal Court Mage
          • Unit - Order Royal Mage Tower 1567 <gen> to train/upgrade to a Royal Court Mage
          • Unit - Order Royal Mage Tower 1567 <gen> to train/upgrade to a Royal Court Mage
          • Trigger - Turn on royal ct mage dies blue <gen>
          • Trigger - Turn on royal court trained blue <gen>
          • Trigger - Turn on royal ct destroyed blue <gen>
          • Trigger - Turn off court_mage_triggers[2]
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • insane_cheats[3] Equal to True
        • Then - Actions
          • Player Group - Pick every player in Groups[3] and do (Actions)
            • Loop - Actions
              • Player - Set the current research level of Royal Weapons to 20 for (Picked player)
              • Player - Set the current research level of Royal Armor to 20 for (Picked player)
              • Player - Set the current research level of Sorcery Upgrade to 3 for (Picked player)
              • Player - Set the current research level of Upgrade Forces: Royal Exemplar XL (dota) to 1 for (Picked player)
              • Player - Set the current research level of Activate Royal Mage Tower to 1 for (Picked player)
          • Set VariableSet Research_Teal_Extra[1] = True
          • -------- Royal Court Mage TEAL --------
          • Special Effect - Destroy royal_ct_sfx_teal
          • Unit - Make Royal Mage Tower 1565 <gen> Vulnerable
          • Unit - Change ownership of Royal Mage Tower 1565 <gen> to Player 15 (Turquoise) and Change color
          • Unit - Order Royal Mage Tower 1565 <gen> to train/upgrade to a Royal Court Mage
          • Unit - Order Royal Mage Tower 1565 <gen> to train/upgrade to a Royal Court Mage
          • Unit - Order Royal Mage Tower 1565 <gen> to train/upgrade to a Royal Court Mage
          • Unit - Order Royal Mage Tower 1565 <gen> to train/upgrade to a Royal Court Mage
          • Trigger - Turn on royal ct mage dies teal <gen>
          • Trigger - Turn on royal court trained teal <gen>
          • Trigger - Turn on royal ct destroyed teal <gen>
          • Trigger - Turn off court_mage_triggers[3]
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • insane_cheats[4] Equal to True
        • Then - Actions
          • Player Group - Pick every player in Groups[4] and do (Actions)
            • Loop - Actions
              • Player - Set the current research level of Royal Weapons to 20 for (Picked player)
              • Player - Set the current research level of Royal Armor to 20 for (Picked player)
              • Player - Set the current research level of Sorcery Upgrade to 3 for (Picked player)
              • Player - Set the current research level of Upgrade Forces: Royal Exemplar XL (dota) to 1 for (Picked player)
              • Player - Set the current research level of Activate Royal Mage Tower to 1 for (Picked player)
          • Set VariableSet Research_Purp_Extra[1] = True
          • -------- Royal Court Mage PURPLE --------
          • Special Effect - Destroy royal_ct_sfx_purp
          • Unit - Make Royal Mage Tower 1564 <gen> Vulnerable
          • Unit - Change ownership of Royal Mage Tower 1564 <gen> to Player 16 (Violet) and Change color
          • Unit - Order Royal Mage Tower 1564 <gen> to train/upgrade to a Royal Court Mage
          • Unit - Order Royal Mage Tower 1564 <gen> to train/upgrade to a Royal Court Mage
          • Unit - Order Royal Mage Tower 1564 <gen> to train/upgrade to a Royal Court Mage
          • Unit - Order Royal Mage Tower 1564 <gen> to train/upgrade to a Royal Court Mage
          • Trigger - Turn on royal ct mage dies purp <gen>
          • Trigger - Turn on royal court trained purp <gen>
          • Trigger - Turn on royal ct destroyed purp <gen>
          • Trigger - Turn off court_mage_triggers[4]
        • Else - Actions
  • TEST a
    • Events
      • Player - Player 23 (Emerald) types a chat message containing level as An exact match
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (String((Current research level of Royal Weapons for Player 13 (Maroon))))
      • Game - Display to (All players) the text: (String((Current research level of Royal Weapons for Player 14 (Navy))))
      • Game - Display to (All players) the text: (String((Current research level of Royal Weapons for Player 15 (Turquoise))))
      • Game - Display to (All players) the text: (String((Current research level of Royal Weapons for Player 16 (Violet))))
  • TEST b
    • Events
      • Player - Player 23 (Emerald) types a chat message containing group as An exact match
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (String((Number of players in Groups[1])))
      • Game - Display to (All players) the text: (String((Number of players in Groups[2])))
      • Game - Display to (All players) the text: (String((Number of players in Groups[3])))
      • Game - Display to (All players) the text: (String((Number of players in Groups[4])))
level
1746693396562.png


group
1746693437799.png

Very confused why the upgrades aren't being applied. If I spam the trigger by debug command "run" it seems everyone gets it:
1746693511979.png

So the group variable is working and set. But something seems to be wrong with the applying upgrades this way. Any ideas?

If you spam the trigger with debug command then it gets applied to everyone.

I also tried separating into multiple pick player loops.
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • insane_cheats[1] Equal to True
    • Then - Actions
      • Player Group - Pick every player in Groups[1] and do (Actions)
        • Loop - Actions
          • Player - Set the current research level of Royal Weapons to 20 for (Picked player)
      • Player Group - Pick every player in Groups[1] and do (Actions)
        • Loop - Actions
          • Player - Set the current research level of Royal Armor to 20 for (Picked player)
      • Player Group - Pick every player in Groups[1] and do (Actions)
        • Loop - Actions
          • Player - Set the current research level of Sorcery Upgrade to 3 for (Picked player)
      • Player Group - Pick every player in Groups[1] and do (Actions)
        • Loop - Actions
          • Player - Set the current research level of Upgrade Forces: Royal Exemplar XL (dota) to 1 for (Picked player)
      • Player Group - Pick every player in Groups[1] and do (Actions)
        • Loop - Actions
          • Player - Set the current research level of Activate Royal Mage Tower to 1 for (Picked player)
  • ...

Still doesn't apply the upgrades unless the trigger is manually spammed by typing "run".
 
Last edited:
Level 12
Joined
Nov 13, 2010
Messages
278
try add Wait 0.10 seconds before upgrades to see if that works

or you can try somthing els if dont work. (Edit) the arrays you make need to be 4 or depahps on how many players there can play ofc
  • Insane Cheats
    • Events
      • Player - Player 23 (Emerald) types a chat message containing run as An exact match
      • Time - Elapsed game time is 305.00 seconds
    • Conditions
      • insane_king Equal to True
    • Actions
      • For each (Integer A from 1 to 4), do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • insane_cheats[Integer A] Equal to True
            • Then (Actions)
              • Player Group - Pick every player in Groups[Integer A] and do (Actions)
                • Loop - Actions
                  • Player - Set the current research level of Royal Weapons to 20
                  • Player - Set the current research level of Royal Armor to 20
                  • Player - Set the current research level of Sorcery Upgrade to 3
                  • Player - Set the current research level of Upgrade Forces: Royal Exemplar XL (dota) to 1
                  • Player - Set the current research level of Activate Royal Mage Tower to 1
        • Set VariableSet Research_+[Integer A] = True ( this is a Boolean flags )
        • Special Effect - Destroy (make your sfx array)[Integer A]
        • Unit - Make Royal Mage Tower (make a array tower id here) [Integer A] Vulnerable
        • Unit - Change ownership of Royal Mage Tower (that tower id gos here)[Integer A] to Player (make a player color array here)[Integer A]
        • Unit - Order Royal Mage Tower (that tower id gos here)[Integer A] to train/upgrade to a Royal Court Mage (x4)
        • Trigger - Turn on royal ct mage dies purp[Integer A]
        • Trigger - Turn on royal court trained purp[Integer A]
        • Trigger - Turn on royal ct destroyed purp[Integer A]
        • Trigger - Turn off court_mage_triggers[Integer A]
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,883
What exactly is wrong with the text messages in that picture?

Anyway, if weird things are happening it's often the result of an Action causing another trigger to run. (Picked player) is a global variable, so if it gets set elsewhere it will change for any trigger currently referencing it. This usually isn't an issue, but could be in special cases. The same is true for looping over a group, for example if your Loop - Actions caused another trigger to run that then looped over the same exact group, you could run into issues.

Try replacing (Picked player) with a unique variable and see if that fixes it.

Another potential issue is that you're manipulating Groups[]. Perhaps you're constantly Adding/Removing players without realizing it.
 
Last edited:
Level 21
Joined
Mar 16, 2008
Messages
970
...
Try replacing (Picked player) with a unique variable and see if that fixes it.
...
Would I do this with integer loop? Because for group [3] it would typically be player 3, 15, and whatever other players from 5-12, 17-20 that join player 3.

Like you suggest, I'm also suspecting some other trigger must be using picked player but i can't find that trigger.

Something like this? It's a bit inefficient but I guess that's not a huge deal.
  • ...
  • For each (Integer insane_A_integer) from 1 to 20, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player_array_var[insane_A_integer] is in Groups[1].) Equal to True
        • Then - Actions
          • Player - Set the current research level of Royal Weapons to 20 for Player_array_var[insane_A_integer]
          • Player - Set the current research level of Royal Armor to 20 for Player_array_var[insane_A_integer]
          • Player - Set the current research level of Sorcery Upgrade to 3 for Player_array_var[insane_A_integer]
          • Player - Set the current research level of Upgrade Forces: Royal Exemplar XL (dota) to 1 for Player_array_var[insane_A_integer]
          • Player - Set the current research level of Activate Royal Mage Tower to 1 for Player_array_var[insane_A_integer]
        • Else - Actions
  • ...
 
Last edited:
Level 21
Joined
Mar 16, 2008
Messages
970
What do you mean by unique variable? Well I meant that I'm not really sure by what you meant by unique variable. The only way to use "pick every player..." is to use it with "picked player" in GUI, I thought.

Just using integer loop seems to solve the problem, similar to above. I think some other trigger was using picked player at the same time? IDK.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,883
What do you mean by unique variable? Well I meant that I'm not really sure by what you meant by unique variable. The only way to use "pick every player..." is to use it with "picked player" in GUI, I thought.

Just using integer loop seems to solve the problem, similar to above. I think some other trigger was using picked player at the same time? IDK.
Set Variable MyPlayerVar = (Picked player)
// do stuff using MyPlayerVar
 
Top