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

how to completely disable unit sharing?

Status
Not open for further replies.
Level 13
Joined
May 10, 2009
Messages
868
Indeed, the function "Game - Set Map Flag" (Lock alliance settings) doesn't seem to work, or at least it doesn't lock ''Share Units'' option for the players. However, there's the event that detects when a player shares units, and you can undo that.

  • Avoid sharing units
    • Events
      • Player - Player 1 (Red) changes Shared units settings
      • Player - Player 2 (Blue) changes Shared units settings
      • Player - Player 3 (Teal) changes Shared units settings
      • Player - Player 4 (Purple) changes Shared units settings
      • Player - Player 5 (Yellow) changes Shared units settings
      • Player - Player 6 (Orange) changes Shared units settings
      • Player - Player 7 (Green) changes Shared units settings
      • Player - Player 8 (Pink) changes Shared units settings
      • Player - Player 9 (Gray) changes Shared units settings
      • Player - Player 10 (Light Blue) changes Shared units settings
      • Player - Player 11 (Dark Green) changes Shared units settings
      • Player - Player 12 (Brown) changes Shared units settings
    • Conditions
    • Actions
      • Trigger - Turn off (This trigger)
      • For each (Integer tmp_loopA) from 1 to 12, do (Actions)
        • Loop - Actions
          • For each (Integer tmp_loopB) from 1 to 12, do (Actions)
            • Loop - Actions
              • Player - For (Player(tmp_loopA)), turn Shared units Off toward (Player(tmp_loopB))
      • Trigger - Turn on (This trigger)
NOTE: Looks like the GetTriggerPlayer() function doesn't work with that event.
NOTE2: It really doesn't matter when loopA and loopB have the same value, since the BJ function "Player - Set Aspect of Alliance" doesn't do anything when a player is trying to change any of their own aspects ("self ally", for example).

JASS:
function SetPlayerAllianceBJ takes player sourcePlayer, alliancetype whichAllianceSetting, boolean value, player otherPlayer returns nothing
    // Prevent players from attempting to ally with themselves.
    if (sourcePlayer == otherPlayer) then
        return
    endif

    call SetPlayerAlliance(sourcePlayer, otherPlayer, whichAllianceSetting, value)
endfunction
 
Status
Not open for further replies.
Top