• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Get your art tools and paintbrushes ready and enter Hive's 34th Texturing Contest: Void! 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