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

[Mapping] How to control enemy player's units (for play testing)

Level 21
Joined
Jan 3, 2022
Messages
366
Generally if you want to test a map as 2 players, you would launch WC3 twice and play with yourself in LAN.
  • Reforged: just launch the game again, "Warcraft III.exe -launch". You can run up to 6 instances on one computer then it runs out of local ports
  • Classic: use a loader like kLoader
If for whatever reason you cannot run two windows of the game (for example, increased game speed WGC config only works in single player) then this may be for you.



Based on the BJ function: Doc - ShareEverythingWithTeam

  1. Player Red (0) and Player Blue (1) stay enemies, as they are by default.
  2. Give Red control over blue's units
  3. Give Red vision over blue's units
Note there's no way to do this without custom scripts, you must touch Jass code :)
  • Custom script: call SetPlayerAlliance(Player(1), Player(0), ALLIANCE_SHARED_VISION, true)
  • Custom script: call SetPlayerAlliance(Player(1), Player(0), ALLIANCE_SHARED_CONTROL, true)
  • -------- IDK what this does --------
  • Custom script: call SetPlayerAlliance(Player(1), Player(0), ALLIANCE_SHARED_ADVANCED_CONTROL, true)
There's also "ALLIANCE_SHARED_VISION_FORCED" but I don't know what it does.

Soon the documentation will be here:


See also​


These work differently, by temporarily changing the player owner of the unit. alliancetype gives you control over other player's every unit, they do not change their owner.
 

Attachments

  • ForceShareControl-v1.1-TFTv1.07.w3x
    18.3 KB · Views: 12
I didn't expect to see my spells referenced here, truly appreciate it!

"ALLIANCE_SHARED_VISION_FORCED" might be the one utilized in melee where the shared vision is locked, though I might be wrong.
Anyway, I noticed the option existed for GUI, though it might be a bit obscure at a glance (I developed with 1.31 though I remember this option existed on older versions, at least 1.26 should have it). It gives the share control and vision yet retained the status of being enemies.
 

Attachments

  • ControlEnemy.w3x
    20.4 KB · Views: 14
Why go through all that trouble? Why not have a 3 player configuration, where Player 2 (Blue) and Player 3 (Teal) are total enemies, but each of them shares full vision and control and allied status with Player 1 (Red) that is you as a human.

That way, you can tell them to fight each other but you have full control, and you don't have to bother with special scripting since that's probably available from GUI.
 
Level 13
Joined
May 19, 2022
Messages
250
i have something like this in my test map however i didnt use any sort of custom scripts just shared vision and units to player 1 and works just fine :grin:
1700844428233.png
 
Level 21
Joined
Jan 3, 2022
Messages
366
I didn't expect to see my spells referenced here, truly appreciate it!
That's my usual reconnaisance phase of work. :cool:2

@Retera I don't know, someone asked, someone else said not possible and I said "yes possible" after testing. I don't know when it could become useful but it's a different way to accomplish this without a third player.

Panda, I don't work in GUI and assumed this was not there after finding this other function. I have not mapped trigger GUI names to jassdoc yet.
 
Top