• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Is there any Hero Swap System out there?

Status
Not open for further replies.
It's not anything hard; it will go like this:
  • Trigger1
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • For each (IntegerA) from 1 to 12, do (Actions)
      • Loop - Actions
        • Trigger - Add to Trigger2 <gen> the event (Player - Player(IntegerA) types a message containing "-swap" as A Substring
  • Trigger2
  • Events
  • Conditions
  • Actions
    • Set WhichNumber = (Substring((Entered chat string), 7, (Length of (Entered chat string))) //String variable, Substring function
    • Set PlayerIndex = (Integer(WhichNumber)) //Integer variable, Convert - Convert String to Integer function
    • If (All conditions are true) then do (Actions) else do (Actions)
      • If - Conditions
        • ((Player(PlayerIndex)) belongs to an ally of (Triggering player)) Equal to True
      • Then - Actions
        • Set TempGroup = (Units owned by (Triggering player))
        • Unit Group - Pick every unit in (TempGroup) and do (Actions)
          • Loop - Actions
            • If (All conditions are true) then do (Actions) else do (Actions)
              • If - Conditions
                • (Picked unit) Not Equal to No unit
              • Then - Actions
                • Unit - Change ownership of (Picked unit) to (Player(PlayerIndex)) and Change color
                • Custom script: set bj_wantDestroyGroup = true
                • Unit Group - Pick every unit in (Units owned by (Player(PlayerIndex))) and do (Actions)
                  • Loop - Actions
                    • If (All conditions are true) then do (Actions) else do (Actions)
                      • If - Conditions
                        • (Picked unit) Not Equal to (Ownership-changed unit)
                      • Then - Actions
                        • Unit - Change ownership of (Picked unit) to (Triggering player) and Change color
                      • Else - Actions
              • Else - Actions
                • Game - Display to (Player Group(Triggering player)) the text: "No units to swap."
                • Game - Display to (Player Group(Player(PlayerIndex))) the text: "No units to swap."
        • Custom script: call DestroyGroup (udg_TempGroup)
      • Else - Actions
To get "Player(PlayerIndex)", when it asks you for a player, scroll to "Conversion - Convert Player Index to Player".
 
Status
Not open for further replies.
Top