• Check out the results of the Techtree Contest #19!
  • 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 void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

this old trigger

Level 11
Joined
Mar 1, 2009
Messages
360
Every thing up about is an old custom code trigger that allowed player to ally and unally in game and trade resources as well i recently discover that it might be the reason people are getting kicked at the beginning of the game(maybe)

Can any tell me if there is anything here that would disagree with the *new version of wc3 that we have now?



JASS:
//function Trig_Test_Func001001001 takes nothing returns boolean
//    return ( GetPlayerSlotState(GetFilterPlayer()) == PLAYER_SLOT_STATE_PLAYING )
//endfunction

//function Trig_Test_Func001002001 takes nothing returns boolean
//    return ( GetPlayerSlotState(GetFilterPlayer()) == PLAYER_SLOT_STATE_PLAYING )
//endfunction

function Trig_Map_Initialization_Actions takes nothing returns nothing
    call SetMapFlag( MAP_FOG_MAP_EXPLORED, true )
    call SetMapFlag( MAP_RESOURCE_TRADING_ALLIES_ONLY, false )
    call SetMapFlag( MAP_LOCK_ALLIANCE_CHANGES, false )
    call SetMapFlag( MAP_LOCK_RESOURCE_TRADING, false )
    call SetGameSpeed( MAP_SPEED_FASTEST )
    call SetMapFlag( MAP_OBSERVERS_ON_DEATH, true )
    call SetMapFlag( MAP_SHARED_ADVANCED_CONTROL, true )
    call MeleeStartingVisibility(  )
    call MeleeStartingHeroLimit(  )
    call MeleeGrantHeroItems(  )
    call MeleeStartingResources(  )
    call MeleeClearExcessUnits(  )
    call MeleeStartingAI(  )
    call SetMapFlag( MAP_ALLIANCE_CHANGES_HIDDEN, true )
    call TriggerExecute( gg_trg_Turn_Off_Other_Triggers )
    //call SetForceAllianceStateBJ( GetPlayersMatching(Condition(function Trig_Test_Func001001001)), GetPlayersMatching(Condition(function Trig_Test_Func001002001)), bj_ALLIANCE_ALLIED_VISION )
    call TriggerExecute( gg_trg_Turn_On_Other_Triggers )
    call SetMapFlag( MAP_ALLIANCE_CHANGES_HIDDEN, false )
endfunction
//===========================================================================
function InitTrig_Map_Initialization takes nothing returns nothing
set gg_trg_Map_Initialization = CreateTrigger( )
call TriggerAddAction( gg_trg_Map_Initialization, function Trig_Map_Initialization_Actions )
endfunction


secondary triggers goes up to player 8 (even though the map has 12 players we just never played with that many)
  • Player 1 Declaring
    • Events
      • Player - Player 1 (Red) changes Alliance (non-aggression) settings
    • Conditions
    • Actions
      • Trigger - Run Turn Off Other Triggers <gen> (ignoring conditions)
      • Set VariableSet Instigator = Value
      • Set VariableSet InstigatorName = (Name of Player 1 (Red))
      • Player Group - Pick every player in (All players matching ((Instigator is giving (Matching player).Alliance (non-aggression)) Equal to False).) and do (If (((Picked player) is giving Instigator.Alliance (non-aggression)) Equal to True) then do (Game - Display to (Player group((Picked player))) for 10.00 seconds the text: (InstigatorName + has declared war on you!)) else do (Do nothing))
      • Player Group - Pick every player in (All players matching ((Instigator is giving (Matching player).Alliance (non-aggression)) Equal to False).) and do (If (((Picked player) is giving Instigator.Alliance (non-aggression)) Equal to True) then do (Player - Make (Picked player) treat Instigator as an Enemy) else do (Do nothing))
      • Trigger - Run Turn On Other Triggers <gen> (ignoring conditions)
  • Turn On Other Triggers
    • Events
    • Conditions
    • Actions
      • Trigger - Turn on Player 1 Declaring <gen>
      • Trigger - Turn on Player 2 Declaring <gen>
      • Trigger - Turn on Player 3 Declaring <gen>
      • Trigger - Turn on Player 4 Declaring <gen>
      • Trigger - Turn on Player 5 Declaring <gen>
      • Trigger - Turn on Player 6 Declaring <gen>
      • Trigger - Turn on Player 7 Declaring <gen>
      • Trigger - Turn on Player 8 Declaring <gen>
  • Turn Off Other Triggers
    • Events
    • Conditions
    • Actions
      • Trigger - Turn off Player 1 Declaring <gen>
      • Trigger - Turn off Player 2 Declaring <gen>
      • Trigger - Turn off Player 3 Declaring <gen>
      • Trigger - Turn off Player 4 Declaring <gen>
      • Trigger - Turn off Player 5 Declaring <gen>
      • Trigger - Turn off Player 6 Declaring <gen>
      • Trigger - Turn off Player 7 Declaring <gen>
      • Trigger - Turn off Player 8 Declaring <gen>
 
Last edited:
2.a-b
I dont have source but recollect reading GetPlayerSlotState can desync when ran at map init. So just sayin, you could try not and see if it fixes the problem or not. The alternative would be to run it at elapsed game time.

EDIT: Theres at least one claim here [Trigger] - Desync on start
 
Last edited:
Use [CODE=jass][/CODE] for pasting jass/vjass code and [CODE=lua][/CODE] for pasting lua code. It keeps indentation and provides syntax highlighting.
JASS:
//function Trig_Test_Func001001001 takes nothing returns boolean
//  return ( GetPlayerSlotState(GetFilterPlayer()) == PLAYER_SLOT_STATE_PLAYING )
//endfunction
//function Trig_Test_Func001002001 takes nothing returns boolean
//  return ( GetPlayerSlotState(GetFilterPlayer()) == PLAYER_SLOT_STATE_PLAYING )
//endfunction
function Trig_Map_Initialization_Actions takes nothing returns nothing
    call SetMapFlag( MAP_FOG_MAP_EXPLORED, true )
    call SetMapFlag( MAP_RESOURCE_TRADING_ALLIES_ONLY, false )
    call SetMapFlag( MAP_LOCK_ALLIANCE_CHANGES, false )
    call SetMapFlag( MAP_LOCK_RESOURCE_TRADING, false )
    call SetGameSpeed( MAP_SPEED_FASTEST )
    call SetMapFlag( MAP_OBSERVERS_ON_DEATH, true )
    call SetMapFlag( MAP_SHARED_ADVANCED_CONTROL, true )
    call MeleeStartingVisibility( )
    call MeleeStartingHeroLimit( )
    call MeleeGrantHeroItems( )
    call MeleeStartingResources( )
    call MeleeClearExcessUnits( )
    call MeleeStartingAI( )
    call SetMapFlag( MAP_ALLIANCE_CHANGES_HIDDEN, true )
    call TriggerExecute( gg_trg_Turn_Off_Other_Triggers )
    //call SetForceAllianceStateBJ( GetPlayersMatching(Condition(function Trig_Test_Func001001001)), GetPlayersMatching(Condition(function Trig_Test_Func001002001)), bj_ALLIANCE_ALLIED_VISION )
    call TriggerExecute( gg_trg_Turn_On_Other_Triggers )
    call SetMapFlag( MAP_ALLIANCE_CHANGES_HIDDEN, false )
endfunction
//===========================================================================
function InitTrig_Map_Initialization takes nothing returns nothing
    set gg_trg_Map_Initialization = CreateTrigger( )
    call TriggerAddAction( gg_trg_Map_Initialization, function Trig_Map_Initialization_Actions )
endfunction

I tried to recreate the script in GUI, I missed just one call, but found the rest:
  • Map Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Game - Set Visibility - Map Explored to On
      • Game - Set Restrict resource trading to allies to Off
      • Game - Set Lock alliance settings to Off
      • Game - Set Lock resource trading to Off
      • Game - Set game speed to Fastest
      • Game - Set Observers on defeat to On
      • Custom script: call SetMapFlag( MAP_SHARED_ADVANCED_CONTROL, true ) // this flag does not seem to be present in GUI
      • Melee Game - Use melee time of day (for all players)
      • Melee Game - Limit Heroes to 1 per Hero-type (for all players)
      • Melee Game - Give trained Heroes a Scroll of Town Portal (for all players)
      • Melee Game - Set starting resources (for all players)
      • Melee Game - Remove creeps and critters from used start locations (for all players)
      • Melee Game - Run melee AI scripts (for computer players)
      • Game - Set Hide alliance changes to On
      • Trigger - Run Turn Off Other Triggers <gen> (ignoring conditions)
      • Trigger - Run Turn On Other Triggers <gen> (ignoring conditions)
      • Game - Set Hide alliance changes to Off
From this, I don't see anything specifically that should cause a desync.

What I do find strange is this part of your trigger:
  • Player 1 Declaring
    • Events
      • Player - Player 1 (Red) changes Alliance (non-aggression) settings
    • Conditions
    • Actions
      • Trigger - Run Turn Off Other Triggers <gen> (ignoring conditions)
      • Set VariableSet Instigator = Value
      • ...
Where does "Value" come from? As Instigator is a "Player" variable, "Value" should be as well, but I wonder if desync could potentially happen if some wrong value is set in "Value" before that value is assigned to Insitgator.
 
Back
Top