• 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] Removing almost every unit

Status
Not open for further replies.
Level 6
Joined
Feb 6, 2008
Messages
166
I'm trying to get a -repick command that removes all of a player's units except his or her Circle of Power. PlayerIndex[(Integer A)] is a player array for, well, Player A. CircleOfPower[(Integer A)] is a unit array used to reference the Circle of Power for Player A. Can someone explain to me why the following doesn't work?

  • Actions
    • For each (Integer A) from 1 to 12, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Triggering player) Equal to PlayerIndex[(Integer A)]
            • ableRepick[(Integer A)] Equal to True
          • Then - Actions
            • Unit Group - Pick every unit in (Units owned by PlayerIndex[(Integer A)] matching ((Picked unit) Not equal to CircleOfPower[(Integer A)])) and do (Unit - Remove (Matching unit) from the game)
          • Else - Actions
 
Level 6
Joined
Feb 6, 2008
Messages
166
This trigger sets the PlayerIndex array:
  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set PlayerIndex[1] = Player 1 (Red)
      • Set PlayerIndex[2] = Player 2 (Blue)
      • Set PlayerIndex[3] = Player 3 (Teal)
      • Set PlayerIndex[4] = Player 4 (Purple)
      • Set PlayerIndex[5] = Player 5 (Yellow)
      • Set PlayerIndex[6] = Player 6 (Orange)
      • Set PlayerIndex[7] = Player 7 (Green)
      • Set PlayerIndex[8] = Player 8 (Pink)
      • Set PlayerIndex[9] = Player 9 (Gray)
      • Set PlayerIndex[10] = Player 9 (Gray)
      • Set PlayerIndex[11] = Player 11 (Dark Green)
      • Set PlayerIndex[12] = Player 12 (Brown)
And ableRepick is initially true in all indexes.

I added "Player - Set PlayerIndex[(Integer A)] Current gold to 750" at the bottom of the "Then - Actions" list, and it does indeed run.
 
Level 6
Joined
Feb 6, 2008
Messages
166
Ugh, sorry for not being online the past week. Exams coming up, and a lot of catch-up studying to do.

For some reason, it still isn't working. I've got all the surrounding actions working - just not the remove unit.

Here's the new trigger in full. PlayerIndex and ableRepick are still the same.
  • Repick
    • Events
      • Player - Player 1 (Red) types a chat message containing -repick as An exact match
      • Player - Player 2 (Blue) types a chat message containing -repick as An exact match
      • Player - Player 3 (Teal) types a chat message containing -repick as An exact match
      • Player - Player 4 (Purple) types a chat message containing -repick as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -repick as An exact match
      • Player - Player 6 (Orange) types a chat message containing -repick as An exact match
      • Player - Player 7 (Green) types a chat message containing -repick as An exact match
      • Player - Player 8 (Pink) types a chat message containing -repick as An exact match
      • Player - Player 9 (Gray) types a chat message containing -repick as An exact match
      • Player - Player 10 (Light Blue) types a chat message containing -repick as An exact match
      • Player - Player 11 (Dark Green) types a chat message containing -repick as An exact match
      • Player - Player 12 (Brown) types a chat message containing -repick as An exact match
    • Conditions
      • HeroArray[(Player number of (Triggering player))] Not equal to No unit
    • Actions
      • Set PlayerIntegerTemp = (Player number of (Triggering player))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ableRepick[PlayerIntegerTemp] Equal to True
        • Then - Actions
          • Unit Group - Pick every unit in (Units owned by PlayerIndex[PlayerIntegerTemp] matching ((Matching unit) Not equal to CircleOfPower[PlayerIntegerTemp])) and do (Unit - Remove (Matching unit) from the game)
          • Set Location = (Center of TavernCircleOfPower <gen>)
          • Unit - Move CircleOfPower[PlayerIntegerTemp] instantly to Location
          • Camera - Pan camera for PlayerIndex[PlayerIntegerTemp] to Location over 0.00 seconds
          • Custom script: call RemoveLocation(udg_Location)
          • For each (Integer A) from 1 to 12, do (Actions)
            • Loop - Actions
              • Player - Make (Unit-type of HeroArray[PlayerIntegerTemp]) Available for training/construction by PlayerIndex[(Integer A)]
          • Set HeroArray[PlayerIntegerTemp] = No unit
          • Multiboard - Set the icon for Multiboard item in column 1, row (PlayerIntegerTemp + 1) to ReplaceableTextures\CommandButtons\BTNSelectHeroOn.blp
          • Multiboard - Set the display style for Multiboard item in column 1, row (PlayerIntegerTemp + 1) to Show text and Hide icons
          • Player - Set PlayerIndex[PlayerIntegerTemp] Current gold to 750
          • Set ableRepick[PlayerIntegerTemp] = False
        • Else - Actions
 
Level 7
Joined
May 18, 2010
Messages
264
mby bind items and remove them ass well if he repick gold is set to 750
he may bought items alredy and droped ...
just sugesting
 
Level 6
Joined
Feb 6, 2008
Messages
166
mby bind items and remove them ass well if he repick gold is set to 750
he may bought items alredy and droped ...
just sugesting
Nothing to worry about.
- The item shop isn't in reach.
- All heroes are paused until game starts at 45 second mark, and at that point the repick command is disabled.

(Unit - Remove (Matching unit) from the game)

Needs to be "remove (Picked Unit) from the game".
Alright, I'll try this change tonight.
 
Status
Not open for further replies.
Top