• 🏆 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!

Observer replacing leaver system

Status
Not open for further replies.
Level 9
Joined
Apr 14, 2020
Messages
63
If i want to replace a player with an observer after the player leaves, is there a way to convert the observer (player 21) to be the leaver? (player 1 in this instance). I want, after this occurs, all triggers to consider that person player 1 as well. Is this something i can do with GUI?

I also want this to be possible for player 22 and it to work with any leaver, players 1-12. If I can figure out the above, I can do it but I don't know how to consolidate it into a few triggers, I would have to have individual for each player leaver/each observer..is there a way to consolidate them as well?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
GUI is rather limiting when it comes to this type of thing but you can probably manage it if you designed the map to work from the ground up with these concepts in mind.

The first idea that comes to mind would be to have a Player Array variable -> Players[]

You would reference this Variable in all of your triggers whenever possible. The Index would be the player's Id which is a value that will never change. Player 1's id (aka Player Number) will always be 1 even if they replace Player 21.

So by default:
Players[1] = Player Red
Players[21] = Player Snow (I forget which color p21 actually is)

Then when Players[1] leaves the game and Players[21] replaces them:
Players[1] = Player Snow
Players[21] = Neutral Passive (Neutral passive can be used to represent an Unused player slot)

With this design you'll be able to reference Players[] in most if not all of your triggers and things will continue to work regardless of player swapping.

For example:
  • Unit - Create 1 Footman for Players[1] at somePoint facing someDegrees
This trigger will automatically update to create the Footman for the proper Player 1.

That being said, there's already a way to Share Full Unit Control so maybe this specific example isn't necessary. But there would definitely be cases where this would be necessary.
 
Last edited:
Status
Not open for further replies.
Top