• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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