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

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

Level 19
Joined
Jan 3, 2022
Messages
320
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: 1
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: 2
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 11
Joined
May 19, 2022
Messages
192
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 19
Joined
Jan 3, 2022
Messages
320
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