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

[General] switch players

Status
Not open for further replies.
Level 37
Joined
Mar 6, 2006
Messages
9,243
You could swap the units like this
  • Untitled Trigger 002
    • Events
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked unit)) Equal to Player 1 (Red)
            • Then - Actions
              • Unit - Change ownership of (Picked unit) to Player 2 (Blue) and Change color
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Owner of (Picked unit)) Equal to Player 2 (Blue)
                • Then - Actions
                  • Unit - Change ownership of (Picked unit) to Player 1 (Red) and Change color
                • Else - Actions
 
Level 6
Joined
Nov 5, 2013
Messages
132
Use players group, when you want remove the player 1 from Group1 and add to Group2 and vice-versa with player 2.
You can use triggers to change the color of the players.

Look the picture to see the single sample.
 

Attachments

  • Single sample.jpg
    Single sample.jpg
    172.7 KB · Views: 96
Last edited:
*Finally, stan asks a good question*
^That is actually harder, since I think, from the action that it only changes existing unit's team color. Player color would still remain in the post-game/score screen.

Fixing that would require an additional trigger when a unit enters playable map area, changing its color.

Also note that you would have to switch other player exclusive data when doing the first solution too.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Yes and no. No there is no way to swap players completely during a session. Yes you can simulate a almost complete player swap.

Instead of using constant references to players in triggers, use a variable which you can change as required. Units can be transferred using appropriate native. Colours can be swapped if required. Even works with AI as long as you have appropriate AI script to load and manage the new player.
 
Status
Not open for further replies.
Top