1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Camera Pan, Unit Spawn Leaks, and a Desync

Discussion in 'Triggers & Scripts' started by Bennoloth, May 5, 2019.

  1. Bennoloth

    Bennoloth

    Joined:
    Apr 29, 2019
    Messages:
    17
    Resources:
    0
    Resources:
    0
    Balin's Tomb Reforged

    This is my map. I have 3 problems:

    1. I want to use camera pan, but I understand it causes desync 100% of the time. I read the guide about it on Hive and still don't get it. I put camera pan triggers in the map, so you can see where I want them, but they're deactivated so the map is playable.

    2. I would like to fix the memory leak caused by using "create unit at center of region", but I really don't understand this scripting stuff at all.

    3. About half the time, one or two people desync when the Balrog is first attacked. There are no triggers related to him being attacked.

    Could any kind soul please help me with these? I tried to be brief so as to make it easier to read, but can provide plenty of further details and happy to discuss on Discord as well.
     
  2. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    2,901
    Resources:
    1
    Spells:
    1
    Resources:
    1
    1. You can camera pan all you want. You can't use "pan camera as necessary", as that can cause desyncs.

    2. Things That Leak, your one-stop leak-fixing informative tutorial.

    3. Post every trigger related to the Balrog here (How To Post Your Trigger) and it might be easy to spot. In general these sorts of desyncs happen from using GetLocalPlayer(), so you can extract your war3map.j (from the saved map, using an MPQ or CASC editor) and search for any usage of it in the map script.
     
  3. Bennoloth

    Bennoloth

    Joined:
    Apr 29, 2019
    Messages:
    17
    Resources:
    0
    Resources:
    0
    First of all hopefully you see this Pyrogasm but my computer died and now I am coming back editing this map, and I greatly appreciate your help.

    1. Fixed, thank you

    2. What I am doing is not working, I will try again and make a new topic with screenshots of my attempt at a later time

    3. There is no GetLocalPlayer in my war3map.j - do you have any other ideas?

    Triggers related to Balrog:

    Note that the desync happens from any autoattack, from any hero. Not just when Gandalf triggers this one.
    • Gandalf Threatens Balrog
      • Events
        • Unit - Gandalf the Grey 0004 <gen> Begins casting an ability
      • Conditions
        • (Target unit of ability being cast) Equal to Balrog Flame of Udun 0178 <gen>
      • Actions
        • Wait 1.00 seconds
        • Game - Display to (All players) for 5.00 seconds the text: Gandalf: YOU SHALL ...
        • Trigger - Turn on Gandalf Dies <gen>
        • Trigger - Turn on Mountain Cave <gen>
        • Trigger - Turn off Deep Respawning <gen>
        • Trigger - Turn off Gandalf Threatens Balrog <gen>


    • Gandalf Dies
      • Events
        • Unit - Gandalf the Grey 0004 <gen> Dies
      • Conditions
        • (Killing unit) Equal to Balrog Flame of Udun 0178 <gen>
      • Actions
        • Game - Display to (All players) for 10.00 seconds the text: 'Fly, you fools!' G...
        • Unit - Cause Gandalf the Grey 0004 <gen> to damage Balrog Flame of Udun 0178 <gen>, dealing 800000.00 damage of attack type Hero and damage type Normal
        • Unit - Remove (Random unit from (Units owned by Player 3 (Teal) of type Phoenix)) from the game
        • Unit - Remove (Random unit from (Units owned by Player 3 (Teal) of type Phoenix Egg)) from the game
        • Unit - Remove (Random unit from (Units owned by Player 3 (Teal) of type Gandalf the Grey)) from the game
        • Sound - Play Dark Victory
        • Wait 5.00 seconds
        • Camera - Pan camera for Player 3 (Teal) to (Center of Region 010 <gen>) over 0.50 seconds
        • Unit - Create 1 Gandalf the White for Player 3 (Teal) at (Center of Region 010 <gen>) facing (Center of Region 010 <gen>)
        • Hero - Create Narya and give it to (Last created unit)


    • Mountain Cave
      • Events
        • Unit - A unit enters Region 009 <gen>
      • Conditions
      • Actions
        • Unit - Move (Triggering unit) instantly to (Center of Region 010 <gen>)
        • Camera - Pan camera for (Owner of (Triggering unit)) to (Center of Region 010 <gen>) over 0.50 seconds
        • Game - Set the time of day to 12.00
        • Game - Turn the day/night cycle Off


    • Balrog Dies
      • Events
        • Unit - Balrog Flame of Udun 0178 <gen> Dies
      • Conditions
        • (Gandalf Dies <gen> is on) Equal to False
      • Actions
        • Trigger - Turn on Mountain Cave <gen>
        • Trigger - Turn on Mountain Cave Merry <gen>
        • Trigger - Turn off Deep Respawning <gen>
        • Game - Display to (All players) the text: You have killed the...
        • Sound - Play Dark Victory


    war3map.j:
    Code (Text):

    globals
        // User-defined
    force udg_Heroes= null
    item array udg_CleanedItem
    boolean udg_ItemCleanupFlag= false
    timer udg_ItemCleanupTimer= null
    integer udg_ItemsToClean= 0
    integer udg_Loop= 0
    location udg_Point= null
    rect udg_Region000= null
    rect udg_Region001= null

        // Generated
    rect gg_rct_Region_000= null
    rect gg_rct_Region_001= null
    rect gg_rct_Region_002= null
    rect gg_rct_Region_003= null
    rect gg_rct_Region_004= null
    rect gg_rct_Region_005= null
    rect gg_rct_Region_006= null
    rect gg_rct_Region_007= null
    rect gg_rct_Region_008= null
    rect gg_rct_Region_009= null
    rect gg_rct_Region_010= null
    rect gg_rct_Region_011= null
    rect gg_rct_Region_012= null
    rect gg_rct_Region_013= null
    rect gg_rct_Region_014= null
    rect gg_rct_Region_015= null
    rect gg_rct_Region_015_Copy= null
    rect gg_rct_Region_015_Copy_2= null
    rect gg_rct_Region_015_Copy_3= null
    rect gg_rct_Region_015_Copy_4= null
    rect gg_rct_Region_015_Copy_5= null
    rect gg_rct_Region_015_Copy_6= null
    rect gg_rct_Region_022= null
    rect gg_rct_Region_023= null
    rect gg_rct_Region_024= null
    rect gg_rct_Region_025= null
    rect gg_rct_Region_026= null
    rect gg_rct_Region_027= null
    rect gg_rct_Region_028= null
    rect gg_rct_Region_030= null
    rect gg_rct_Region_031= null
    rect gg_rct_Region_032= null
    rect gg_rct_Region_029= null
    rect gg_rct_Region_029_Copy= null
    rect gg_rct_Region_029_Copy_2= null
    rect gg_rct_Region_029_Copy_3= null
    rect gg_rct_Region_036= null
    rect gg_rct_Region_037= null
    sound gg_snd_O04Mannoroth38= null
    sound gg_snd_N07Archimonde24= null
    sound gg_snd_N07Archimonde26= null
    sound gg_snd_U08Archimonde19= null
    sound gg_snd_U08Archimonde24= null
    sound gg_snd_O02Mannoroth34= null
    sound gg_snd_TheHornOfCenarius= null
    sound gg_snd_LightningBolt1= null
    sound gg_snd_GameFound= null
    sound gg_snd_SacrificeUnit= null
    sound gg_snd_LightningBolt= null
    sound gg_snd_GryphonRiderPissed2= null
    sound gg_snd_PriestPissed1= null
    sound gg_snd_HeroBladeMasterPissed2= null
    sound gg_snd_HeroLichPissed8= null
    sound gg_snd_HumanCallToArmsWhat1= null
    sound gg_snd_RollingThunder1= null
    sound gg_snd_UtherReturns= null
    sound gg_snd_H06MalGanis32= null
    sound gg_snd_MuradinPissed7= null
    sound gg_snd_BattlenetBirth1= null
    sound gg_snd_BattleNetDoorsStereo2= null
    sound gg_snd_WarlockAppears= null
    sound gg_snd_FrostmourneChant1= null
    sound gg_snd_Mortal_Kombat_Theme_Song_Original__Short_u= null
    sound gg_snd_The_Fellowship_of_the_Ring_Soundtrack_02_Concerning_Hobbits__Short_u= null
    sound gg_snd_The_Fellowship_of_the_Ring_Theme_Song__Short_u= null
    trigger gg_trg_Item_Cleanup= null
    trigger gg_trg_Solo= null
    trigger gg_trg_Initialize= null
    trigger gg_trg_Easy_Mode= null
    trigger gg_trg_Orc_Leader_Message= null
    trigger gg_trg_Mouth_of_Sauron_Dies= null
    trigger gg_trg_Orthanc_Dies= null
    trigger gg_trg_Shelob_Dies= null
    trigger gg_trg_Ring_Destroyed= null
    trigger gg_trg_Uruk_Hai_Spawn= null
    trigger gg_trg_Halfway_to_Balrog= null
    trigger gg_trg_Enter_Balrogs_Lair= null
    trigger gg_trg_Balrog_Attacked= null
    trigger gg_trg_Grom_Dies= null
    trigger gg_trg_Balrog_Dies= null
    trigger gg_trg_Mountain_Cave= null
    trigger gg_trg_Mountain_Cave_Merry= null
    trigger gg_trg_Gandalf_Dies= null
    trigger gg_trg_Frodo_dies= null
    trigger gg_trg_Cave_Troll_message= null
    trigger gg_trg_Cave_Troll_attacked= null
    trigger gg_trg_Deep_Respawning_Delay= null
    trigger gg_trg_Deep_Respawning= null
    trigger gg_trg_Uruk_Hai_Respawning= null
    trigger gg_trg_Stop_Uruk_Hai_Respawning= null
    trigger gg_trg_Ent_Eaters= null
    trigger gg_trg_first_wave= null
    trigger gg_trg_second_wave= null
    trigger gg_trg_third_wave= null
    trigger gg_trg_fourth_wave= null
    trigger gg_trg_fifth_wave= null
    trigger gg_trg_part_of_fifth_wave= null
    trigger gg_trg_sixth_wave= null
    trigger gg_trg_part_of_sixth_wave= null
    trigger gg_trg_seventh_wave= null
    trigger gg_trg_eigth_wave= null
    trigger gg_trg_part_of_eight_wave= null
    trigger gg_trg_Final_wave= null
    trigger gg_trg_Isengard_Uruk_Hai_Gold= null
    trigger gg_trg_Uruk_Hai_Captain_Gold= null
    trigger gg_trg_Saurons_Chosen_Gold= null
    trigger gg_trg_Ringwraith_Gold= null
    trigger gg_trg_Mordor_Orc_Gold= null
    trigger gg_trg_Savage_Orc_Gold= null
    trigger gg_trg_Warg_Rider_Gold= null
    trigger gg_trg_Saurons_Speaker_Gold= null
    trigger gg_trg_Uruk_Hai_Gold= null
    trigger gg_trg_Deep_Orc_Gold= null
    trigger gg_trg_Deep_Cave_Troll_Gold= null
    trigger gg_trg_Cave_Troll_Gold= null
    trigger gg_trg_Goblin_Commander_Gold= null
    trigger gg_trg_Goblin_Archer_Gold= null
    trigger gg_trg_Goblin_1_Gold= null
    trigger gg_trg_Goblin_2_Gold= null
    trigger gg_trg_Orc_Gold= null
    trigger gg_trg_Red= null
    trigger gg_trg_Blue= null
    trigger gg_trg_Teal= null
    trigger gg_trg_Purple= null
    trigger gg_trg_Yellow= null
    trigger gg_trg_Orange= null
    trigger gg_trg_Green= null
    trigger gg_trg_Gray= null
    trigger gg_trg_Light_Blue= null
    unit gg_unit_HC03_0002= null
    unit gg_unit_HC02_0003= null
    unit gg_unit_HC05_0005= null
    unit gg_unit_HC08_0006= null
    unit gg_unit_HC01_0009= null
    unit gg_unit_HC07_0008= null
    unit gg_unit_HC06_0007= null
    unit gg_unit_HC04_0004= null
    unit gg_unit_nC12_0022= null
    unit gg_unit_nC18_0178= null
    unit gg_unit_n000_0032= null
    unit gg_unit_n000_0045= null
    unit gg_unit_nchw_0053= null
    unit gg_unit_nchw_0051= null
    unit gg_unit_n000_0034= null
    unit gg_unit_nC14_0134= null
    unit gg_unit_n000_0028= null
    unit gg_unit_n000_0027= null
    unit gg_unit_nchw_0285= null
    unit gg_unit_nchw_0287= null
    unit gg_unit_nchw_0288= null
    unit gg_unit_n000_0040= null
    unit gg_unit_n000_0041= null
    unit gg_unit_n000_0043= null
    unit gg_unit_nchw_0291= null
    unit gg_unit_n000_0044= null
    unit gg_unit_n000_0042= null
    unit gg_unit_n000_0035= null
    unit gg_unit_nchw_0132= null
    unit gg_unit_nchw_0295= null
    unit gg_unit_Opgh_0341= null
    unit gg_unit_Nbbc_0350= null
    unit gg_unit_Nbbc_0344= null
    unit gg_unit_Nbbc_0349= null
    unit gg_unit_Nbbc_0342= null
    unit gg_unit_HC00_0001= null
    unit gg_unit_Nbbc_0345= null
    unit gg_unit_nC16_0024= null
    unit gg_unit_Nbbc_0093= null
    unit gg_unit_nC16_0039= null
    unit gg_unit_Nbbc_0087= null
    unit gg_unit_nC16_0174= null
    unit gg_unit_nC16_0176= null
    unit gg_unit_nC16_0180= null
    unit gg_unit_Nbbc_0094= null
    unit gg_unit_n001_0025= null
    unit gg_unit_o001_0026= null
    unit gg_unit_o001_0029= null
    unit gg_unit_u000_0033= null
    unit gg_unit_o005_0135= null
    destructable gg_dest_DTrc_0055= null
    destructable gg_dest_DTrc_0056= null
    destructable gg_dest_DTrc_0057= null
    destructable gg_dest_DTrc_0058= null
    destructable gg_dest_DTrc_0060= null
    destructable gg_dest_DTrc_0059= null
    destructable gg_dest_DTrc_0061= null


    //JASSHelper struct globals:

    endglobals


    //===========================================================================
    //
    // Balin's Tomb Reforged 2.8
    //
    //   Warcraft III map script
    //   Generated by the Warcraft III World Editor
    //   Date: Thu Aug  8 21:28:50 2019
    //   Map Author: Darkbringer
    //
    //===========================================================================

    //***************************************************************************
    //*
    //*  Global Variables
    //*
    //***************************************************************************


    function InitGlobals takes nothing returns nothing
        local integer i= 0
        set udg_Heroes=CreateForce()
        set udg_ItemCleanupFlag=false
        set udg_ItemCleanupTimer=CreateTimer()
        set udg_ItemsToClean=0
        set udg_Loop=0
    endfunction

    //***************************************************************************
    //*
    //*  Custom Script Code
    //*
    //***************************************************************************

    //***************************************************************************
    //*
    //*  Unit Item Tables
    //*
    //***************************************************************************

    function Unit000022_DropItems takes nothing returns nothing
        local widget trigWidget= null
        local unit trigUnit= null
        local integer itemID= 0
        local boolean canDrop= true

        set trigWidget=bj_lastDyingWidget
        if ( trigWidget == null ) then
            set trigUnit=GetTriggerUnit()
        endif

        if ( trigUnit != null ) then
            set canDrop=not IsUnitHidden(trigUnit)
            if ( canDrop and GetChangingUnit() != null ) then
                set canDrop=( GetChangingUnitPrevOwner() == Player(PLAYER_NEUTRAL_AGGRESSIVE) )
            endif
        endif

        if ( canDrop ) then
            // Item set 0
            call RandomDistReset()
            call RandomDistAddItem('gold', 100)
            set itemID=RandomDistChoose()
            if ( trigUnit != null ) then
                call UnitDropItem(trigUnit, itemID)
            else
                call WidgetDropItem(trigWidget, itemID)
            endif

        endif

        set bj_lastDyingWidget=null
        call DestroyTrigger(GetTriggeringTrigger())
    endfunction

    function Unit000037_DropItems takes nothing returns nothing
        local widget trigWidget= null
        local unit trigUnit= null
        local integer itemID= 0
        local boolean canDrop= true

        set trigWidget=bj_lastDyingWidget
        if ( trigWidget == null ) then
            set trigUnit=GetTriggerUnit()
        endif

        if ( trigUnit != null ) then
            set canDrop=not IsUnitHidden(trigUnit)
            if ( canDrop and GetChangingUnit() != null ) then
                set canDrop=( GetChangingUnitPrevOwner() == Player(PLAYER_NEUTRAL_AGGRESSIVE) )
            endif
        endif

        if ( canDrop ) then
            // Item set 0
            call RandomDistReset()
            call RandomDistAddItem('fgdg', 100)
            set itemID=RandomDistChoose()
            if ( trigUnit != null ) then
                call UnitDropItem(trigUnit, itemID)
            else
                call WidgetDropItem(trigWidget, itemID)
            endif

        endif

        set bj_lastDyingWidget=null
        call DestroyTrigger(GetTriggeringTrigger())
    endfunction

    function Unit000146_DropItems takes nothing returns nothing
        local widget trigWidget= null
        local unit trigUnit= null
        local integer itemID= 0
        local boolean canDrop= true

        set trigWidget=bj_lastDyingWidget
        if ( trigWidget == null ) then
            set trigUnit=GetTriggerUnit()
        endif

        if ( trigUnit != null ) then
            set canDrop=not IsUnitHidden(trigUnit)
            if ( canDrop and GetChangingUnit() != null ) then
                set canDrop=( GetChangingUnitPrevOwner() == Player(PLAYER_NEUTRAL_AGGRESSIVE) )
            endif
        endif

        if ( canDrop ) then
            // Item set 0
            call RandomDistReset()
            call RandomDistAddItem('I00I', 100)
            set itemID=RandomDistChoose()
            if ( trigUnit != null ) then
                call UnitDropItem(trigUnit, itemID)
            else
                call WidgetDropItem(trigWidget, itemID)
            endif

        endif

        set bj_lastDyingWidget=null
        call DestroyTrigger(GetTriggeringTrigger())
    endfunction


    //***************************************************************************
    //*
    //*  Sounds
    //*
    //***************************************************************************

    function InitSounds takes nothing returns nothing
        set gg_snd_O04Mannoroth38=CreateSound("Sound\\Dialogue\\OrcCampaign\\Orc04Interlude\\O04Mannoroth38.mp3", false, false, false, 10, 10, "DefaultEAXON")
        call SetSoundParamsFromLabel(gg_snd_O04Mannoroth38, "O04Mannoroth38")
        call SetSoundDuration(gg_snd_O04Mannoroth38, 12617)
        set gg_snd_N07Archimonde24=CreateSound("Sound\\Dialogue\\NightElfCampaign\\NightElf07\\N07Archimonde24.mp3", false, false, false, 10, 10, "")
        call SetSoundParamsFromLabel(gg_snd_N07Archimonde24, "N07Archimonde24")
        call SetSoundDuration(gg_snd_N07Archimonde24, 7157)
        set gg_snd_N07Archimonde26=CreateSound("Sound\\Dialogue\\NightElfCampaign\\NightElf07\\N07Archimonde26.mp3", false, false, false, 10, 10, "")
        call SetSoundParamsFromLabel(gg_snd_N07Archimonde26, "N07Archimonde26")
        call SetSoundDuration(gg_snd_N07Archimonde26, 10631)
        set gg_snd_U08Archimonde19=CreateSound("Sound\\Dialogue\\UndeadCampaign\\Undead08\\U08Archimonde19.mp3", false, false, false, 10, 10, "")
        call SetSoundParamsFromLabel(gg_snd_U08Archimonde19, "U08Archimonde19")
        call SetSoundDuration(gg_snd_U08Archimonde19, 7575)
        set gg_snd_U08Archimonde24=CreateSound("Sound\\Dialogue\\UndeadCampaign\\Undead08\\U08Archimonde24.mp3", false, false, false, 10, 10, "")
        call SetSoundParamsFromLabel(gg_snd_U08Archimonde24, "U08Archimonde24")
        call SetSoundDuration(gg_snd_U08Archimonde24, 15438)
        set gg_snd_O02Mannoroth34=CreateSound("Sound\\Dialogue\\OrcCampaign\\Orc02Interlude\\O02Mannoroth34.mp3", false, false, false, 10, 10, "")
        call SetSoundParamsFromLabel(gg_snd_O02Mannoroth34, "O02Mannoroth34")
        call SetSoundDuration(gg_snd_O02Mannoroth34, 6217)
        set gg_snd_TheHornOfCenarius=CreateSound("Sound\\Ambient\\DoodadEffects\\TheHornOfCenarius.wav", false, false, false, 10, 10, "DefaultEAXON")
        call SetSoundParamsFromLabel(gg_snd_TheHornOfCenarius, "HornOfCenariusSound")
        call SetSoundDuration(gg_snd_TheHornOfCenarius, 12120)
        call SetSoundChannel(gg_snd_TheHornOfCenarius, 0)
        set gg_snd_LightningBolt1=CreateSound("Doodads\\Cinematic\\Lightningbolt\\LightningBolt1.wav", false, false, true, 10, 10, "DefaultEAXON")
        call SetSoundParamsFromLabel(gg_snd_LightningBolt1, "CinematicLightningBolt")
        call SetSoundDuration(gg_snd_LightningBolt1, 3000)
        call SetSoundChannel(gg_snd_LightningBolt1, 0)
        set gg_snd_GameFound=CreateSound("Sound\\Interface\\GameFound.wav", false, false, false, 10, 10, "DefaultEAXON")
        call SetSoundParamsFromLabel(gg_snd_GameFound, "GameFound")
        call SetSoundDuration(gg_snd_GameFound, 7488)
        call SetSoundChannel(gg_snd_GameFound, 0)
        set gg_snd_SacrificeUnit=CreateSound("Abilities\\Spells\\Other\\ANsa\\SacrificeUnit.wav", false, false, true, 10, 10, "DefaultEAXON")
        call SetSoundParamsFromLabel(gg_snd_SacrificeUnit, "SacrificeUnit")
        call SetSoundDuration(gg_snd_SacrificeUnit, 2693)
        call SetSoundChannel(gg_snd_SacrificeUnit, 0)
        set gg_snd_LightningBolt=CreateSound("Abilities\\Spells\\Orc\\LightningBolt\\LightningBolt.wav", false, false, true, 10, 10, "DefaultEAXON")
        call SetSoundParamsFromLabel(gg_snd_LightningBolt, "LightningBolt")
        call SetSoundDuration(gg_snd_LightningBolt, 2136)
        call SetSoundChannel(gg_snd_LightningBolt, 0)
        set gg_snd_GryphonRiderPissed2=CreateSound("Units\\Human\\GryphonRider\\GryphonRiderPissed2.wav", false, false, true, 10, 10, "DefaultEAXON")
        call SetSoundParamsFromLabel(gg_snd_GryphonRiderPissed2, "GryphonRiderPissed")
        call SetSoundDuration(gg_snd_GryphonRiderPissed2, 5526)
        call SetSoundChannel(gg_snd_GryphonRiderPissed2, 0)
        set gg_snd_PriestPissed1=CreateSound("Units\\Human\\Priest\\PriestPissed1.wav", false, false, true, 10, 10, "DefaultEAXON")
        call SetSoundParamsFromLabel(gg_snd_PriestPissed1, "PriestPissed")
        call SetSoundDuration(gg_snd_PriestPissed1, 3306)
        call SetSoundChannel(gg_snd_PriestPissed1, 0)
        set gg_snd_HeroBladeMasterPissed2=CreateSound("Units\\Orc\\HeroBladeMaster\\HeroBladeMasterPissed2.wav", false, false, true, 10, 10, "DefaultEAXON")
        call SetSoundParamsFromLabel(gg_snd_HeroBladeMasterPissed2, "HeroBladeMasterPissed")
        call SetSoundDuration(gg_snd_HeroBladeMasterPissed2, 3204)
        call SetSoundChannel(gg_snd_HeroBladeMasterPissed2, 0)
        set gg_snd_HeroLichPissed8=CreateSound("Units\\Undead\\HeroLich\\HeroLichPissed8.wav", false, false, true, 10, 10, "DefaultEAXON")
        call SetSoundParamsFromLabel(gg_snd_HeroLichPissed8, "HeroLichPissed")
        call SetSoundDuration(gg_snd_HeroLichPissed8, 2001)
        call SetSoundChannel(gg_snd_HeroLichPissed8, 0)
        set gg_snd_HumanCallToArmsWhat1=CreateSound("Abilities\\Spells\\Human\\CallToArms\\HumanCallToArmsWhat1.wav", false, false, true, 10, 10, "DefaultEAXON")
        call SetSoundParamsFromLabel(gg_snd_HumanCallToArmsWhat1, "TownHallCallToArms")
        call SetSoundDuration(gg_snd_HumanCallToArmsWhat1, 3970)
        call SetSoundChannel(gg_snd_HumanCallToArmsWhat1, 0)
        set gg_snd_RollingThunder1=CreateSound("Sound\\Ambient\\DoodadEffects\\RollingThunder1.wav", false, false, false, 10, 10, "DefaultEAXON")
        call SetSoundParamsFromLabel(gg_snd_RollingThunder1, "RollingThunderSound")
        call SetSoundDuration(gg_snd_RollingThunder1, 3831)
        call SetSoundChannel(gg_snd_RollingThunder1, 0)
        set gg_snd_UtherReturns=CreateSound("Sound\\Ambient\\DoodadEffects\\UtherReturns.wav", false, false, false, 10, 10, "DefaultEAXON")
        call SetSoundParamsFromLabel(gg_snd_UtherReturns, "UtherReturnsSound")
        call SetSoundDuration(gg_snd_UtherReturns, 6710)
        call SetSoundChannel(gg_snd_UtherReturns, 0)
        set gg_snd_H06MalGanis32=CreateSound("Sound\\Dialogue\\HumanCampaign\\Human06\\H06MalGanis32.mp3", false, false, false, 10, 10, "")
        call SetSoundParamsFromLabel(gg_snd_H06MalGanis32, "H06MalGanis32")
        call SetSoundDuration(gg_snd_H06MalGanis32, 15151)
        set gg_snd_MuradinPissed7=CreateSound("Units\\Human\\Muradin\\MuradinPissed7.wav", false, true, true, 10, 10, "HeroAcksEAX")
        call SetSoundParamsFromLabel(gg_snd_MuradinPissed7, "MuradinPissed")
        call SetSoundDuration(gg_snd_MuradinPissed7, 2542)
        set gg_snd_BattlenetBirth1=CreateSound("Sound\\Interface\\BattlenetBirth1.wav", false, false, false, 10, 10, "DefaultEAXON")
        call SetSoundParamsFromLabel(gg_snd_BattlenetBirth1, "GlueScreenBNetClose")
        call SetSoundDuration(gg_snd_BattlenetBirth1, 1999)
        call SetSoundChannel(gg_snd_BattlenetBirth1, 0)
        set gg_snd_BattleNetDoorsStereo2=CreateSound("Sound\\Interface\\BattleNetDoorsStereo2.wav", false, false, false, 10, 10, "DefaultEAXON")
        call SetSoundParamsFromLabel(gg_snd_BattleNetDoorsStereo2, "GlueScreenBNetSlam")
        call SetSoundDuration(gg_snd_BattleNetDoorsStereo2, 2645)
        call SetSoundChannel(gg_snd_BattleNetDoorsStereo2, 0)
        set gg_snd_WarlockAppears=CreateSound("Sound\\Ambient\\DoodadEffects\\WarlockAppears.wav", false, false, false, 10, 10, "DefaultEAXON")
        call SetSoundParamsFromLabel(gg_snd_WarlockAppears, "ArchimondeAppearsSound")
        call SetSoundDuration(gg_snd_WarlockAppears, 7360)
        call SetSoundChannel(gg_snd_WarlockAppears, 0)
        set gg_snd_FrostmourneChant1=CreateSound("Sound\\Ambient\\DoodadEffects\\FrostmourneChant1.wav", false, false, false, 10, 10, "DefaultEAXON")
        call SetSoundParamsFromLabel(gg_snd_FrostmourneChant1, "FrostmourneChantSound")
        call SetSoundDuration(gg_snd_FrostmourneChant1, 5038)
        call SetSoundChannel(gg_snd_FrostmourneChant1, 0)
        set gg_snd_Mortal_Kombat_Theme_Song_Original__Short_u=CreateSound("war3mapImported\\Mortal Kombat Theme Song Original (Short).mp3", false, false, false, 10, 10, "")
        call SetSoundDuration(gg_snd_Mortal_Kombat_Theme_Song_Original__Short_u, 54177)
        call SetSoundChannel(gg_snd_Mortal_Kombat_Theme_Song_Original__Short_u, 0)
        call SetSoundVolume(gg_snd_Mortal_Kombat_Theme_Song_Original__Short_u, 127)
        call SetSoundPitch(gg_snd_Mortal_Kombat_Theme_Song_Original__Short_u, 1.0)
        set gg_snd_The_Fellowship_of_the_Ring_Soundtrack_02_Concerning_Hobbits__Short_u=CreateSound("war3mapImported\\The Fellowship of the Ring Soundtrack-02-Concerning Hobbits (Short).mp3", false, false, false, 10, 10, "")
        call SetSoundDuration(gg_snd_The_Fellowship_of_the_Ring_Soundtrack_02_Concerning_Hobbits__Short_u, 9195)
        call SetSoundChannel(gg_snd_The_Fellowship_of_the_Ring_Soundtrack_02_Concerning_Hobbits__Short_u, 0)
        call SetSoundVolume(gg_snd_The_Fellowship_of_the_Ring_Soundtrack_02_Concerning_Hobbits__Short_u, 127)
        call SetSoundPitch(gg_snd_The_Fellowship_of_the_Ring_Soundtrack_02_Concerning_Hobbits__Short_u, 1.0)
        set gg_snd_The_Fellowship_of_the_Ring_Theme_Song__Short_u=CreateSound("war3mapImported\\The Fellowship of the Ring Theme Song (Short).mp3", false, false, false, 10, 10, "")
        call SetSoundDuration(gg_snd_The_Fellowship_of_the_Ring_Theme_Song__Short_u, 30249)
        call SetSoundChannel(gg_snd_The_Fellowship_of_the_Ring_Theme_Song__Short_u, 0)
        call SetSoundVolume(gg_snd_The_Fellowship_of_the_Ring_Theme_Song__Short_u, 127)
        call SetSoundPitch(gg_snd_The_Fellowship_of_the_Ring_Theme_Song__Short_u, 1.0)
    endfunction

    //***************************************************************************
    //*
    //*  Destructable Objects
    //*
    //***************************************************************************

    function CreateAllDestructables takes nothing returns nothing
        local destructable d
        local trigger t
        local real life
        set gg_dest_DTrc_0056=CreateDestructable('DTrc', - 3072.0, 2880.0, 55.000, 1.000, 5)
        set gg_dest_DTrc_0057=CreateDestructable('DTrc', - 3072.0, 3072.0, 242.000, 1.000, 3)
        set gg_dest_DTrc_0058=CreateDestructable('DTrc', - 2944.0, 2880.0, 255.000, 1.000, 2)
        set gg_dest_DTrc_0060=CreateDestructable('DTrc', - 3648.0, 2752.0, 62.000, 1.000, 0)
        set gg_dest_DTrc_0059=CreateDestructable('DTrc', - 3712.0, 2880.0, 47.000, 1.000, 2)
        set gg_dest_DTrc_0061=CreateDestructable('DTrc', - 3712.0, 3008.0, 258.000, 1.000, 2)
        set gg_dest_DTrc_0055=CreateDestructable('DTrc', - 3072.0, 2752.0, 184.000, 1.000, 0)
    endfunction

    //***************************************************************************
    //*
    //*  Unit Creation
    //*
    //***************************************************************************

    //===========================================================================
    function CreateUnitsForPlayer0 takes nothing returns nothing
        local player p= Player(0)
        local unit u
        local integer unitID
        local trigger t
        local real life

        set gg_unit_HC03_0002=CreateUnit(p, 'HC03', - 3956.0, - 1437.5, 8.510)
        call UnitAddItemToSlotById(gg_unit_HC03_0002, 'ankh', 0)
        call UnitAddItemToSlotById(gg_unit_HC03_0002, 'pghe', 1)
    endfunction

    //===========================================================================
    function CreateUnitsForPlayer1 takes nothing returns nothing
        local player p= Player(1)
        local unit u
        local integer unitID
        local trigger t
        local real life

        set gg_unit_HC00_0001=CreateUnit(p, 'HC00', - 3884.6, - 1058.7, 198.910)
        call UnitAddItemToSlotById(gg_unit_HC00_0001, 'I000', 0)
        call UnitAddItemToSlotById(gg_unit_HC00_0001, 'pghe', 1)
    endfunction

    //===========================================================================
    function CreateUnitsForPlayer2 takes nothing returns nothing
        local player p= Player(2)
        local unit u
        local integer unitID
        local trigger t
        local real life

        set gg_unit_HC04_0004=CreateUnit(p, 'HC04', - 4072.3, - 1788.3, 67.570)
        call UnitAddItemToSlotById(gg_unit_HC04_0004, 'IC13', 0)
        call UnitAddItemToSlotById(gg_unit_HC04_0004, 'pghe', 1)
    endfunction

    //===========================================================================
    function CreateUnitsForPlayer3 takes nothing returns nothing
        local player p= Player(3)
        local unit u
        local integer unitID
        local trigger t
        local real life

        set gg_unit_HC05_0005=CreateUnit(p, 'HC05', - 4299.1, - 1693.8, 34.710)
        call UnitAddItemToSlotById(gg_unit_HC05_0005, 'I008', 0)
        call UnitAddItemToSlotById(gg_unit_HC05_0005, 'I001', 1)
        call UnitAddItemToSlotById(gg_unit_HC05_0005, 'I009', 2)
        call UnitAddItemToSlotById(gg_unit_HC05_0005, 'pghe', 3)
    endfunction

    //===========================================================================
    function CreateUnitsForPlayer4 takes nothing returns nothing
        local player p= Player(4)
        local unit u
        local integer unitID
        local trigger t
        local real life

        set gg_unit_HC08_0006=CreateUnit(p, 'HC08', - 4222.2, - 1860.5, 35.270)
        call UnitAddItemToSlotById(gg_unit_HC08_0006, 'I00G', 0)
        call UnitAddItemToSlotById(gg_unit_HC08_0006, 'I00C', 1)
        call UnitAddItemToSlotById(gg_unit_HC08_0006, 'I00H', 2)
        call UnitAddItemToSlotById(gg_unit_HC08_0006, 'pghe', 3)
    endfunction

    //===========================================================================
    function CreateUnitsForPlayer5 takes nothing returns nothing
        local player p= Player(5)
        local unit u
        local integer unitID
        local trigger t
        local real life

        set gg_unit_HC02_0003=CreateUnit(p, 'HC02', - 4165.7, - 1226.5, 17.120)
        call UnitAddItemToSlotById(gg_unit_HC02_0003, 'I00A', 0)
        call UnitAddItemToSlotById(gg_unit_HC02_0003, 'pghe', 1)
    endfunction

    //===========================================================================
    function CreateUnitsForPlayer6 takes nothing returns nothing
        local player p= Player(6)
        local unit u
        local integer unitID
        local trigger t
        local real life

        set gg_unit_HC01_0009=CreateUnit(p, 'HC01', - 4047.7, - 821.5, 327.280)
        call UnitAddItemToSlotById(gg_unit_HC01_0009, 'I00B', 0)
        call UnitAddItemToSlotById(gg_unit_HC01_0009, 'pghe', 1)
    endfunction

    //===========================================================================
    function CreateUnitsForPlayer8 takes nothing returns nothing
        local player p= Player(8)
        local unit u
        local integer unitID
        local trigger t
        local real life

        set gg_unit_HC07_0008=CreateUnit(p, 'HC07', - 4179.6, - 1957.9, 68.810)
        call UnitAddItemToSlotById(gg_unit_HC07_0008, 'I00F', 0)
    endfunction

    //===========================================================================
    function CreateUnitsForPlayer9 takes nothing returns nothing
        local player p= Player(9)
        local unit u
        local integer unitID
        local trigger t
        local real life

        set gg_unit_HC06_0007=CreateUnit(p, 'HC06', - 4345.7, - 1839.2, 14.060)
        call UnitAddItemToSlotById(gg_unit_HC06_0007, 'I00F', 0)
    endfunction

    //===========================================================================
    function CreateBuildingsForPlayer10 takes nothing returns nothing
        local player p= Player(10)
        local unit u
        local integer unitID
        local trigger t
        local real life

        set u=CreateUnit(p, 'nC14', 4992.0, - 4544.0, 270.000)
    endfunction

    //===========================================================================
    function CreateUnitsForPlayer10 takes nothing returns nothing
        local player p= Player(10)
        local unit u
        local integer unitID
        local trigger t
        local real life

        set gg_unit_u000_0033=CreateUnit(p, 'u000', - 2970.0, 3919.9, 21.017)
        set u=CreateUnit(p, 'nchw', 3828.8, 4507.4, 308.231)
        set gg_unit_nchw_0051=CreateUnit(p, 'nchw', 3754.2, 4505.5, 252.078)
        set u=CreateUnit(p, 'nchw', 3781.3, 4572.4, 282.390)
        set gg_unit_nchw_0053=CreateUnit(p, 'nchw', 3701.8, 4574.4, 323.843)
        set u=CreateUnit(p, 'nchw', 3760.0, 4387.8, 110.240)
        set u=CreateUnit(p, 'nchw', 1587.4, 2368.5, 230.555)
        set u=CreateUnit(p, 'nchw', 1584.2, 2193.1, 259.703)
        set u=CreateUnit(p, 'nchw', 1570.9, 2034.4, 227.896)
        set u=CreateUnit(p, 'nchw', 1566.7, 1925.0, 270.634)
        set u=CreateUnit(p, 'nchw', 1677.9, 1897.5, 321.920)
        set u=CreateUnit(p, 'nchw', 1907.8, 1927.9, 310.384)
        set u=CreateUnit(p, 'nchw', 2043.8, 1996.3, 94.606)
        set u=CreateUnit(p, 'nchw', 2203.3, 2151.9, 242.520)
        set u=CreateUnit(p, 'nchr', 1731.4, 2036.0, 254.330)
        call SetUnitAcquireRange(u, 200.0)
        set u=CreateUnit(p, 'nchr', 1906.1, 2100.2, 147.331)
        call SetUnitAcquireRange(u, 200.0)
        set u=CreateUnit(p, 'nchr', 1923.7, 2235.2, 311.593)
        call SetUnitAcquireRange(u, 200.0)
        set u=CreateUnit(p, 'nchr', 1761.2, 2357.7, 72.842)
        call SetUnitAcquireRange(u, 200.0)
        set u=CreateUnit(p, 'nchr', 2081.4, 2352.3, 190.124)
        call SetUnitAcquireRange(u, 200.0)
        set u=CreateUnit(p, 'Nbbc', 2527.2, 3095.5, 5.933)
        call SetHeroLevel(u, 10, false)
        call SetUnitAcquireRange(u, 200.0)
        call SelectHeroSkill(u, 'AOwk')
        call SelectHeroSkill(u, 'AOwk')
        call SelectHeroSkill(u, 'AOwk')
        call SelectHeroSkill(u, 'AOmi')
        call SelectHeroSkill(u, 'AOmi')
        call SelectHeroSkill(u, 'AOmi')
        call SelectHeroSkill(u, 'AOcr')
        call SelectHeroSkill(u, 'AOcr')
        call SelectHeroSkill(u, 'AOcr')
        set u=CreateUnit(p, 'Nbbc', 1546.5, 3086.4, 73.402)
        set u=CreateUnit(p, 'Nbbc', 3035.3, 4399.5, 254.869)
        call SetHeroLevel(u, 10, false)
        call SetUnitAcquireRange(u, 200.0)
        call SelectHeroSkill(u, 'AOwk')
        call SelectHeroSkill(u, 'AOwk')
        call SelectHeroSkill(u, 'AOwk')
        call SelectHeroSkill(u, 'AOmi')
        call SelectHeroSkill(u, 'AOmi')
        call SelectHeroSkill(u, 'AOmi')
        call SelectHeroSkill(u, 'AOcr')
        call SelectHeroSkill(u, 'AOcr')
        call SelectHeroSkill(u, 'AOcr')
        set gg_unit_Nbbc_0087=CreateUnit(p, 'Nbbc', 3684.2, 4679.2, 40.486)
        call SetHeroLevel(gg_unit_Nbbc_0087, 10, false)
        call SelectHeroSkill(gg_unit_Nbbc_0087, 'AOwk')
        call SelectHeroSkill(gg_unit_Nbbc_0087, 'AOwk')
        call SelectHeroSkill(gg_unit_Nbbc_0087, 'AOwk')
        call SelectHeroSkill(gg_unit_Nbbc_0087, 'AOmi')
        call SelectHeroSkill(gg_unit_Nbbc_0087, 'AOmi')
        call SelectHeroSkill(gg_unit_Nbbc_0087, 'AOmi')
        call SelectHeroSkill(gg_unit_Nbbc_0087, 'AOcr')
        call SelectHeroSkill(gg_unit_Nbbc_0087, 'AOcr')
        call SelectHeroSkill(gg_unit_Nbbc_0087, 'AOcr')
        set u=CreateUnit(p, 'Nbbc', 3736.8, 4749.9, 161.086)
        call SetHeroLevel(u, 10, false)
        call SelectHeroSkill(u, 'AOwk')
        call SelectHeroSkill(u, 'AOwk')
        call SelectHeroSkill(u, 'AOwk')
        call SelectHeroSkill(u, 'AOmi')
        call SelectHeroSkill(u, 'AOmi')
        call SelectHeroSkill(u, 'AOmi')
        call SelectHeroSkill(u, 'AOcr')
        call SelectHeroSkill(u, 'AOcr')
        call SelectHeroSkill(u, 'AOcr')
        set gg_unit_Nbbc_0093=CreateUnit(p, 'Nbbc', 3807.4, 4700.4, 88.377)
        call SetHeroLevel(gg_unit_Nbbc_0093, 10, false)
        call SelectHeroSkill(gg_unit_Nbbc_0093, 'AOwk')
        call SelectHeroSkill(gg_unit_Nbbc_0093, 'AOwk')
        call SelectHeroSkill(gg_unit_Nbbc_0093, 'AOwk')
        call SelectHeroSkill(gg_unit_Nbbc_0093, 'AOmi')
        call SelectHeroSkill(gg_unit_Nbbc_0093, 'AOmi')
        call SelectHeroSkill(gg_unit_Nbbc_0093, 'AOmi')
        call SelectHeroSkill(gg_unit_Nbbc_0093, 'AOcr')
        call SelectHeroSkill(gg_unit_Nbbc_0093, 'AOcr')
        call SelectHeroSkill(gg_unit_Nbbc_0093, 'AOcr')
        set gg_unit_Nbbc_0094=CreateUnit(p, 'Nbbc', 4658.7, 3069.3, 165.980)
        call SetHeroLevel(gg_unit_Nbbc_0094, 10, false)
        call SetUnitAcquireRange(gg_unit_Nbbc_0094, 200.0)
        call SelectHeroSkill(gg_unit_Nbbc_0094, 'AOwk')
        call SelectHeroSkill(gg_unit_Nbbc_0094, 'AOwk')
        call SelectHeroSkill(gg_unit_Nbbc_0094, 'AOwk')
        call SelectHeroSkill(gg_unit_Nbbc_0094, 'AOmi')
        call SelectHeroSkill(gg_unit_Nbbc_0094, 'AOmi')
        call SelectHeroSkill(gg_unit_Nbbc_0094, 'AOmi')
        call SelectHeroSkill(gg_unit_Nbbc_0094, 'AOcr')
        call SelectHeroSkill(gg_unit_Nbbc_0094, 'AOcr')
        call SelectHeroSkill(gg_unit_Nbbc_0094, 'AOcr')
        set u=CreateUnit(p, 'nchw', 1888.5, 4544.5, 230.995)
        set u=CreateUnit(p, 'nchw', 1503.3, 4669.1, 335.379)
        set u=CreateUnit(p, 'nchw', 1324.2, 4379.1, 235.246)
        set u=CreateUnit(p, 'nchw', 1292.6, 4243.4, 157.604)
        set u=CreateUnit(p, 'nchw', 1328.9, 4581.3, 158.966)
        set u=CreateUnit(p, 'nchw', 1410.3, 4611.9, 311.681)
        set u=CreateUnit(p, 'nchw', 1892.0, 4396.0, 100.978)
        set u=CreateUnit(p, 'nchw', 1676.4, 4547.9, 318.459)
        set u=CreateUnit(p, 'nchw', 1169.9, 3238.9, 247.420)
        set u=CreateUnit(p, 'nchw', 1360.6, 3052.0, 209.450)
        set u=CreateUnit(p, 'nchw', 1556.7, 2974.8, 303.957)
        set u=CreateUnit(p, 'nchw', 1974.5, 3227.0, 211.933)
        set u=CreateUnit(p, 'nchw', 1775.5, 3535.8, 276.732)
        set u=CreateUnit(p, 'nchw', 1329.5, 3344.7, 343.828)
        set u=CreateUnit(p, 'nchw', 1317.4, 3694.1, 210.834)
        set u=CreateUnit(p, 'nchw', 2550.9, 3417.5, 115.931)
        set gg_unit_nchw_0132=CreateUnit(p, 'nchw', 3459.3, 2950.6, 174.677)
        set u=CreateUnit(p, 'nchw', 2826.9, 3251.3, 72.710)
        set gg_unit_nC18_0178=CreateUnit(p, 'nC18', 4289.4, - 1307.0, 25.860)
        set t=CreateTrigger()
        call TriggerRegisterUnitEvent(t, gg_unit_nC18_0178, EVENT_UNIT_DEATH)
        call TriggerRegisterUnitEvent(t, gg_unit_nC18_0178, EVENT_UNIT_CHANGE_OWNER)
        call TriggerAddAction(t, function Unit000037_DropItems)
        set u=CreateUnit(p, 'nchr', 3877.9, 4446.3, 304.506)
        call SetUnitAcquireRange(u, 200.0)
        set u=CreateUnit(p, 'nchr', 3941.6, 4517.1, 68.809)
        call SetUnitAcquireRange(u, 200.0)
        set u=CreateUnit(p, 'nchr', 3895.7, 4623.0, 23.819)
        call SetUnitAcquireRange(u, 200.0)
        set u=CreateUnit(p, 'nchr', 3317.3, 3677.4, 343.322)
        call SetUnitAcquireRange(u, 200.0)
        set u=CreateUnit(p, 'nchr', 3123.9, 4072.2, 170.590)
        call SetUnitAcquireRange(u, 200.0)
        set u=CreateUnit(p, 'nchw', 2372.6, 4764.4, 142.266)
        set gg_unit_nchw_0285=CreateUnit(p, 'nchw', 2412.2, 4107.6, 163.350)
        set u=CreateUnit(p, 'nchw', 2288.2, 4509.1, 275.809)
        set gg_unit_nchw_0287=CreateUnit(p, 'nchw', 2455.0, 4180.8, 348.014)
        set gg_unit_nchw_0288=CreateUnit(p, 'nchw', 2528.7, 4172.7, 51.396)
        set u=CreateUnit(p, 'nchw', 2991.5, 3799.5, 335.829)
        set u=CreateUnit(p, 'nchw', 2873.4, 4670.1, 18.963)
        set gg_unit_nchw_0291=CreateUnit(p, 'nchw', 2492.5, 4077.3, 38.497)
        set u=CreateUnit(p, 'nchw', 2487.1, 4640.6, 212.691)
        set u=CreateUnit(p, 'nchw', 2587.3, 4603.8, 349.343)
        set u=CreateUnit(p, 'nchw', 3168.0, 4552.3, 14.546)
        set gg_unit_nchw_0295=CreateUnit(p, 'nchw', 2601.9, 4064.6, 204.363)
        set u=CreateUnit(p, 'nchr', 1607.6, 4516.3, 110.702)
        call SetUnitAcquireRange(u, 200.0)
        set u=CreateUnit(p, 'nchr', 1662.8, 4370.5, 61.251)
        call SetUnitAcquireRange(u, 200.0)
        set u=CreateUnit(p, 'nchr', 1492.3, 4348.2, 168.173)
        call SetUnitAcquireRange(u, 200.0)
        set u=CreateUnit(p, 'nchr', 1343.5, 3556.1, 135.092)
        call SetUnitAcquireRange(u, 200.0)
        set u=CreateUnit(p, 'nchr', 2105.7, 4058.7, 321.063)
        call SetUnitAcquireRange(u, 200.0)
        set u=CreateUnit(p, 'nchr', 2013.1, 3934.2, 137.476)
        call SetUnitAcquireRange(u, 200.0)
        set u=CreateUnit(p, 'nchr', 2118.0, 3968.5, 15.370)
        call SetUnitAcquireRange(u, 200.0)
        set u=CreateUnit(p, 'nchr', 2001.2, 4040.7, 159.054)
        call SetUnitAcquireRange(u, 200.0)
        set u=CreateUnit(p, 'nchg', 1390.5, 2900.2, 82.356)
        set gg_unit_Opgh_0341=CreateUnit(p, 'Opgh', 3195.6, 2345.9, 353.750)
        call SetHeroLevel(gg_unit_Opgh_0341, 10, false)
        call SetUnitAcquireRange(gg_unit_Opgh_0341, 200.0)
        call SelectHeroSkill(gg_unit_Opgh_0341, 'AOwk')
        call SelectHeroSkill(gg_unit_Opgh_0341, 'AOwk')
        call SelectHeroSkill(gg_unit_Opgh_0341, 'AOwk')
        call SelectHeroSkill(gg_unit_Opgh_0341, 'AOmi')
        call SelectHeroSkill(gg_unit_Opgh_0341, 'AOmi')
        call SelectHeroSkill(gg_unit_Opgh_0341, 'AOmi')
        call SelectHeroSkill(gg_unit_Opgh_0341, 'AOcr')
        call SelectHeroSkill(gg_unit_Opgh_0341, 'AOcr')
        call SelectHeroSkill(gg_unit_Opgh_0341, 'AOcr')
        set t=CreateTrigger()
        call TriggerRegisterUnitEvent(t, gg_unit_Opgh_0341, EVENT_UNIT_DEATH)
        call TriggerRegisterUnitEvent(t, gg_unit_Opgh_0341, EVENT_UNIT_CHANGE_OWNER)
        call TriggerAddAction(t, function Unit000146_DropItems)
        set gg_unit_Nbbc_0342=CreateUnit(p, 'Nbbc', 3248.5, 2541.3, 79.445)
        call SetHeroLevel(gg_unit_Nbbc_0342, 10, false)
        call SetUnitAcquireRange(gg_unit_Nbbc_0342, 200.0)
        call SelectHeroSkill(gg_unit_Nbbc_0342, 'AOwk')
        call SelectHeroSkill(gg_unit_Nbbc_0342, 'AOwk')
        call SelectHeroSkill(gg_unit_Nbbc_0342, 'AOwk')
        call SelectHeroSkill(gg_unit_Nbbc_0342, 'AOmi')
        call SelectHeroSkill(gg_unit_Nbbc_0342, 'AOmi')
        call SelectHeroSkill(gg_unit_Nbbc_0342, 'AOmi')
        call SelectHeroSkill(gg_unit_Nbbc_0342, 'AOcr')
        call SelectHeroSkill(gg_unit_Nbbc_0342, 'AOcr')
        call SelectHeroSkill(gg_unit_Nbbc_0342, 'AOcr')
        set u=CreateUnit(p, 'Nbbc', 3162.8, 2106.0, 351.551)
        call SetHeroLevel(u, 10, false)
        call SetUnitAcquireRange(u, 200.0)
        call SelectHeroSkill(u, 'AOwk')
        call SelectHeroSkill(u, 'AOwk')
        call SelectHeroSkill(u, 'AOwk')
        call SelectHeroSkill(u, 'AOmi')
        call SelectHeroSkill(u, 'AOmi')
        call SelectHeroSkill(u, 'AOmi')
        call SelectHeroSkill(u, 'AOcr')
        call SelectHeroSkill(u, 'AOcr')
        call SelectHeroSkill(u, 'AOcr')
        set gg_unit_Nbbc_0344=CreateUnit(p, 'Nbbc', 3431.8, 2036.4, 300.101)
        call SetHeroLevel(gg_unit_Nbbc_0344, 10, false)
        call SetUnitAcquireRange(gg_unit_Nbbc_0344, 200.0)
        call SelectHeroSkill(gg_unit_Nbbc_0344, 'AOwk')
        call SelectHeroSkill(gg_unit_Nbbc_0344, 'AOwk')
        call SelectHeroSkill(gg_unit_Nbbc_0344, 'AOwk')
        call SelectHeroSkill(gg_unit_Nbbc_0344, 'AOmi')
        call SelectHeroSkill(gg_unit_Nbbc_0344, 'AOmi')
        call SelectHeroSkill(gg_unit_Nbbc_0344, 'AOmi')
        call SelectHeroSkill(gg_unit_Nbbc_0344, 'AOcr')
        call SelectHeroSkill(gg_unit_Nbbc_0344, 'AOcr')
        call SelectHeroSkill(gg_unit_Nbbc_0344, 'AOcr')
        set gg_unit_Nbbc_0345=CreateUnit(p, 'Nbbc', 3424.8, 2290.2, 294.058)
        call SetHeroLevel(gg_unit_Nbbc_0345, 10, false)
        call SetUnitAcquireRange(gg_unit_Nbbc_0345, 200.0)
        call SelectHeroSkill(gg_unit_Nbbc_0345, 'AOwk')
        call SelectHeroSkill(gg_unit_Nbbc_0345, 'AOwk')
        call SelectHeroSkill(gg_unit_Nbbc_0345, 'AOwk')
        call SelectHeroSkill(gg_unit_Nbbc_0345, 'AOmi')
        call SelectHeroSkill(gg_unit_Nbbc_0345, 'AOmi')
        call SelectHeroSkill(gg_unit_Nbbc_0345, 'AOmi')
        call SelectHeroSkill(gg_unit_Nbbc_0345, 'AOcr')
        call SelectHeroSkill(gg_unit_Nbbc_0345, 'AOcr')
        call SelectHeroSkill(gg_unit_Nbbc_0345, 'AOcr')
        set u=CreateUnit(p, 'Nbbc', 3443.5, 2484.8, 336.851)
        call SetHeroLevel(u, 10, false)
        call SetUnitAcquireRange(u, 200.0)
        call SelectHeroSkill(u, 'AOwk')
        call SelectHeroSkill(u, 'AOwk')
        call SelectHeroSkill(u, 'AOwk')
        call SelectHeroSkill(u, 'AOmi')
        call SelectHeroSkill(u, 'AOmi')
        call SelectHeroSkill(u, 'AOmi')
        call SelectHeroSkill(u, 'AOcr')
        call SelectHeroSkill(u, 'AOcr')
        call SelectHeroSkill(u, 'AOcr')
        set u=CreateUnit(p, 'Nbbc', 3598.7, 2390.7, 4.318)
        call SetHeroLevel(u, 10, false)
        call SetUnitAcquireRange(u, 200.0)
        call SelectHeroSkill(u, 'AOwk')
        call SelectHeroSkill(u, 'AOwk')
        call SelectHeroSkill(u, 'AOwk')
        call SelectHeroSkill(u, 'AOmi')
        call SelectHeroSkill(u, 'AOmi')
        call SelectHeroSkill(u, 'AOmi')
        call SelectHeroSkill(u, 'AOcr')
        call SelectHeroSkill(u, 'AOcr')
        call SelectHeroSkill(u, 'AOcr')
        set u=CreateUnit(p, 'Nbbc', 3612.8, 2108.7, 41.617)
        call SetHeroLevel(u, 10, false)
        call SetUnitAcquireRange(u, 200.0)
        call SelectHeroSkill(u, 'AOwk')
        call SelectHeroSkill(u, 'AOwk')
        call SelectHeroSkill(u, 'AOwk')
        call SelectHeroSkill(u, 'AOmi')
        call SelectHeroSkill(u, 'AOmi')
        call SelectHeroSkill(u, 'AOmi')
        call SelectHeroSkill(u, 'AOcr')
        call SelectHeroSkill(u, 'AOcr')
        call SelectHeroSkill(u, 'AOcr')
        set gg_unit_Nbbc_0349=CreateUnit(p, 'Nbbc', 3607.2, 2272.1, 190.157)
        call SetHeroLevel(gg_unit_Nbbc_0349, 10, false)
        call SetUnitAcquireRange(gg_unit_Nbbc_0349, 200.0)
        call SelectHeroSkill(gg_unit_Nbbc_0349, 'AOwk')
        call SelectHeroSkill(gg_unit_Nbbc_0349, 'AOwk')
        call SelectHeroSkill(gg_unit_Nbbc_0349, 'AOwk')
        call SelectHeroSkill(gg_unit_Nbbc_0349, 'AOmi')
        call SelectHeroSkill(gg_unit_Nbbc_0349, 'AOmi')
        call SelectHeroSkill(gg_unit_Nbbc_0349, 'AOmi')
        call SelectHeroSkill(gg_unit_Nbbc_0349, 'AOcr')
        call SelectHeroSkill(gg_unit_Nbbc_0349, 'AOcr')
        call SelectHeroSkill(gg_unit_Nbbc_0349, 'AOcr')
        set gg_unit_Nbbc_0350=CreateUnit(p, 'Nbbc', 3086.5, 2394.0, 6.856)
        call SetHeroLevel(gg_unit_Nbbc_0350, 10, false)
        call SetUnitAcquireRange(gg_unit_Nbbc_0350, 200.0)
        call SelectHeroSkill(gg_unit_Nbbc_0350, 'AOwk')
        call SelectHeroSkill(gg_unit_Nbbc_0350, 'AOwk')
        call SelectHeroSkill(gg_unit_Nbbc_0350, 'AOwk')
        call SelectHeroSkill(gg_unit_Nbbc_0350, 'AOmi')
        call SelectHeroSkill(gg_unit_Nbbc_0350, 'AOmi')
        call SelectHeroSkill(gg_unit_Nbbc_0350, 'AOmi')
        call SelectHeroSkill(gg_unit_Nbbc_0350, 'AOcr')
        call SelectHeroSkill(gg_unit_Nbbc_0350, 'AOcr')
        call SelectHeroSkill(gg_unit_Nbbc_0350, 'AOcr')
    endfunction

    //===========================================================================
    function CreateBuildingsForPlayer11 takes nothing returns nothing
        local player p= Player(11)
        local unit u
        local integer unitID
        local trigger t
        local real life

        set gg_unit_o001_0026=CreateUnit(p, 'o001', 1600.0, - 1856.0, 270.000)
        set gg_unit_o001_0029=CreateUnit(p, 'o001', 704.0, - 1856.0, 270.000)
        set gg_unit_o005_0135=CreateUnit(p, 'o005', 1152.0, - 2432.0, 270.000)
    endfunction

    //===========================================================================
    function CreateUnitsForPlayer11 takes nothing returns nothing
        local player p= Player(11)
        local unit u
        local integer unitID
        local trigger t
        local real life

        set gg_unit_nC12_0022=CreateUnit(p, 'nC12', - 1623.4, - 3254.1, 108.470)
        set t=CreateTrigger()
        call TriggerRegisterUnitEvent(t, gg_unit_nC12_0022, EVENT_UNIT_DEATH)
        call TriggerRegisterUnitEvent(t, gg_unit_nC12_0022, EVENT_UNIT_CHANGE_OWNER)
        call TriggerAddAction(t, function Unit000022_DropItems)
        set gg_unit_nC16_0024=CreateUnit(p, 'nC16', - 1311.3, - 5109.8, 191.421)
        set gg_unit_n000_0027=CreateUnit(p, 'n000', - 1964.9, - 5245.8, 145.441)
        set gg_unit_n000_0028=CreateUnit(p, 'n000', - 1651.8, - 5075.2, 245.717)
        set gg_unit_n000_0032=CreateUnit(p, 'n000', - 1447.5, - 4727.7, 229.456)
        set gg_unit_n000_0034=CreateUnit(p, 'n000', 3264.7, - 5538.2, 78.697)
        set gg_unit_n000_0035=CreateUnit(p, 'n000', 3257.9, - 5432.8, 264.658)
        set u=CreateUnit(p, 'nC20', 2135.8, - 4849.8, 205.714)
        set u=CreateUnit(p, 'nC20', 2393.5, - 4868.6, 319.009)
        set u=CreateUnit(p, 'n000', 2226.2, - 5411.7, 95.606)
        set gg_unit_nC16_0039=CreateUnit(p, 'nC16', - 1577.5, - 5558.7, 156.439)
        set gg_unit_n000_0040=CreateUnit(p, 'n000', 3254.5, - 5301.0, 56.340)
        set gg_unit_n000_0041=CreateUnit(p, 'n000', 3272.7, - 5195.2, 162.427)
        set gg_unit_n000_0042=CreateUnit(p, 'n000', 3292.0, - 5068.6, 215.910)
        set gg_unit_n000_0043=CreateUnit(p, 'n000', 3313.5, - 4946.5, 278.292)
        set gg_unit_n000_0044=CreateUnit(p, 'n000', 3325.7, - 4811.2, 144.057)
        set gg_unit_n000_0045=CreateUnit(p, 'n000', 3408.0, - 5576.2, 163.624)
        set u=CreateUnit(p, 'n000', 2631.2, - 5266.3, 357.858)
        set u=CreateUnit(p, 'n000', 2294.4, - 4998.5, 112.503)
        set u=CreateUnit(p, 'n000', 2518.6, - 4950.6, 31.543)
        set u=CreateUnit(p, 'n000', 2431.4, - 5182.5, 158.691)
        set u=CreateUnit(p, 'nC20', 2267.9, - 4837.1, 207.252)
        set u=CreateUnit(p, 'nC17', - 1828.4, - 5093.8, 12.657)
        set u=CreateUnit(p, 'o000', - 2082.0, - 5566.6, 119.348)
        set u=CreateUnit(p, 'o000', - 1884.0, - 4996.1, 163.668)
        set u=CreateUnit(p, 'o000', - 2210.3, - 5220.3, 88.959)
        set u=CreateUnit(p, 'o000', - 1439.3, - 5173.7, 250.551)
        set u=CreateUnit(p, 'o000', - 1528.4, - 4979.6, 120.710)
        set u=CreateUnit(p, 'o000', - 1216.4, - 4927.0, 24.676)
        set u=CreateUnit(p, 'o000', - 2378.7, - 5357.4, 89.003)
        set u=CreateUnit(p, 'nC20', 2106.4, - 5377.7, 20.237)
        set u=CreateUnit(p, 'nC20', 2110.0, - 5449.6, 152.539)
        set u=CreateUnit(p, 'nC20', 2096.4, - 4971.2, 68.403)
        set u=CreateUnit(p, 'nC20', 2023.0, - 5137.7, 317.921)
        set u=CreateUnit(p, 'nC20', 2069.6, - 5067.7, 223.260)
        set u=CreateUnit(p, 'nC20', 2062.6, - 5497.6, 214.526)
        set u=CreateUnit(p, 'nC20', 2053.7, - 5285.4, 171.623)
        set u=CreateUnit(p, 'nC20', 2131.5, - 5528.0, 124.633)
        set u=CreateUnit(p, 'nC20', 2181.2, - 5584.8, 321.492)
        set u=CreateUnit(p, 'nC20', 2259.5, - 5142.9, 280.347)
        set u=CreateUnit(p, 'nC20', 2205.0, - 5092.3, 198.254)
        set u=CreateUnit(p, 'nC20', 2346.8, - 5111.1, 117.469)
        set u=CreateUnit(p, 'nC20', 2420.1, - 5067.7, 0.956)
        set u=CreateUnit(p, 'nC20', 2456.0, - 5320.7, 297.530)
        set u=CreateUnit(p, 'nC20', 2387.6, - 5413.0, 201.781)
        set u=CreateUnit(p, 'nC20', 2312.2, - 5579.0, 204.660)
        set u=CreateUnit(p, 'nC20', 2376.8, - 5302.0, 287.752)
        set u=CreateUnit(p, 'nC20', 2485.3, - 4811.6, 266.690)
        set u=CreateUnit(p, 'nC20', 2547.5, - 5119.1, 21.929)
        set u=CreateUnit(p, 'nC20', 2500.1, - 5555.7, 167.799)
        set u=CreateUnit(p, 'nC20', 2542.4, - 5476.9, 310.494)
        set u=CreateUnit(p, 'nC20', 2597.9, - 5434.7, 334.917)
        set u=CreateUnit(p, 'nC20', 2725.9, - 4950.6, 9.690)
        set u=CreateUnit(p, 'nC20', 2713.9, - 4849.8, 116.656)
        set u=CreateUnit(p, 'nC20', 2633.3, - 4801.9, 89.102)
        set u=CreateUnit(p, 'nC20', 2602.7, - 5075.9, 258.835)
        set u=CreateUnit(p, 'nC20', 2646.5, - 5142.9, 246.046)
        set u=CreateUnit(p, 'nC20', 2635.7, - 5555.7, 279.677)
        set u=CreateUnit(p, 'nC20', 2702.9, - 5472.8, 51.044)
        set u=CreateUnit(p, 'nC20', 2723.8, - 5364.3, 229.325)
        set u=CreateUnit(p, 'nC20', 3033.4, - 5336.9, 234.027)
        set u=CreateUnit(p, 'nC20', 2878.8, - 5505.7, 172.655)
        set u=CreateUnit(p, 'nC20', 2985.2, - 4902.5, 139.597)
        set u=CreateUnit(p, 'nC20', 2954.9, - 4782.3, 278.116)
        set u=CreateUnit(p, 'nC20', 2861.7, - 4772.5, 95.826)
        set u=CreateUnit(p, 'nC20', 2818.1, - 5081.4, 275.139)
        set u=CreateUnit(p, 'nC20', 2813.9, - 4997.3, 191.596)
        set u=CreateUnit(p, 'nC20', 2795.8, - 4827.6, 193.871)
        set u=CreateUnit(p, 'nC20', 2870.4, - 5174.1, 281.533)
        set u=CreateUnit(p, 'nC20', 2869.5, - 4852.9, 354.584)
        set u=CreateUnit(p, 'nC20', 2971.2, - 5323.1, 150.385)
        set u=CreateUnit(p, 'nC20', 2870.5, - 5377.7, 214.416)
        set u=CreateUnit(p, 'nC20', 2953.1, - 5419.6, 80.840)
        set u=CreateUnit(p, 'nC20', 2743.2, - 5598.2, 85.553)
        set u=CreateUnit(p, 'nC20', 2954.5, - 5567.4, 155.659)
        set u=CreateUnit(p, 'nC20', 2792.8, - 5519.9, 204.165)
        set u=CreateUnit(p, 'nC20', 2635.8, - 5017.3, 169.689)
        set u=CreateUnit(p, 'nC20', 2214.0, - 5249.2, 313.867)
        set u=CreateUnit(p, 'nC17', - 1545.9, - 4872.6, 95.990)
        set gg_unit_nC16_0174=CreateUnit(p, 'nC16', - 1469.1, - 5333.2, 210.933)
        set u=CreateUnit(p, 'nC17', - 1746.9, - 5464.7, 82.828)
        set gg_unit_nC16_0176=CreateUnit(p, 'nC16', - 872.8, - 5077.2, 84.619)
        set gg_unit_nC16_0180=CreateUnit(p, 'nC16', - 626.9, - 4753.1, 338.664)
        set u=CreateUnit(p, 'nC17', - 1011.8, - 4964.3, 9.723)
        set u=CreateUnit(p, 'nC20', - 2342.9, - 5556.5, 203.923)
        set u=CreateUnit(p, 'nC20', - 1762.8, - 4828.5, 206.912)
        set u=CreateUnit(p, 'nC20', - 867.7, - 4902.7, 75.292)
        set u=CreateUnit(p, 'nC20', - 1644.1, - 4745.1, 104.176)
        set u=CreateUnit(p, 'nC20', - 1582.4, - 4542.6, 216.624)
        set u=CreateUnit(p, 'nC20', - 1326.1, - 4542.6, 329.018)
        set u=CreateUnit(p, 'nC20', - 1193.0, - 4638.9, 250.331)
        set u=CreateUnit(p, 'nC20', - 983.3, - 4732.2, 277.062)
        set u=CreateUnit(p, 'nC20', - 853.2, - 4601.1, 352.628)
        set u=CreateUnit(p, 'nC20', - 753.1, - 4627.9, 185.213)
        set u=CreateUnit(p, 'nC20', - 1002.8, - 4546.1, 253.495)
        set u=CreateUnit(p, 'nC20', - 1149.7, - 4807.0, 188.443)
        set u=CreateUnit(p, 'nC20', - 1365.3, - 4947.9, 17.798)
        set u=CreateUnit(p, 'nC20', - 1623.3, - 5296.7, 321.777)
        set u=CreateUnit(p, 'nC20', - 1782.4, - 5320.2, 349.760)
        set u=CreateUnit(p, 'nC20', - 2151.4, - 5408.9, 172.348)
        set u=CreateUnit(p, 'nC20', - 1940.1, - 5458.4, 81.027)
        set u=CreateUnit(p, 'nC20', - 2082.1, - 5058.9, 252.089)
        set u=CreateUnit(p, 'nC20', - 1737.9, - 5582.8, 242.256)
        set u=CreateUnit(p, 'nC20', - 1577.6, - 5456.8, 346.289)
    endfunction

    //===========================================================================
    function CreateNeutralHostile takes nothing returns nothing
        local player p= Player(PLAYER_NEUTRAL_AGGRESSIVE)
        local unit u
        local integer unitID
        local trigger t
        local real life

        set gg_unit_n001_0025=CreateUnit(p, 'n001', - 1673.1, 307.0, 90.000)
    endfunction

    //===========================================================================
    function CreateNeutralPassiveBuildings takes nothing returns nothing
        local player p= Player(PLAYER_NEUTRAL_PASSIVE)
        local unit u
        local integer unitID
        local trigger t
        local real life

        set u=CreateUnit(p, 'nfoh', - 4096.0, - 2432.0, 270.000)
        set u=CreateUnit(p, 'nmoo', - 4608.0, - 2432.0, 270.000)
        set u=CreateUnit(p, 'nC15', - 5120.0, - 1600.0, 270.000)
        set u=CreateUnit(p, 'nC15', 2688.0, - 960.0, 270.000)
        set u=CreateUnit(p, 'ngad', 2304.0, - 960.0, 270.000)
        set u=CreateUnit(p, 'nC15', 576.0, 960.0, 270.000)
        set u=CreateUnit(p, 'ngad', 960.0, 960.0, 270.000)
        set gg_unit_nC14_0134=CreateUnit(p, 'nC14', 5184.0, 3200.0, 270.000)
        set u=CreateUnit(p, 'nC15', 4672.0, - 5184.0, 270.000)
        set u=CreateUnit(p, 'nC15', 5120.0, - 5184.0, 270.000)
        set u=CreateUnit(p, 'nC15', - 5120.0, - 1984.0, 270.000)
        set u=CreateUnit(p, 'nC15', 5120.0, 2688.0, 270.000)
        set u=CreateUnit(p, 'ngad', 4736.0, 2688.0, 270.000)
    endfunction

    //===========================================================================
    function CreatePlayerBuildings takes nothing returns nothing
        call CreateBuildingsForPlayer10()
        call CreateBuildingsForPlayer11()
    endfunction

    //===========================================================================
    function CreatePlayerUnits takes nothing returns nothing
        call CreateUnitsForPlayer0()
        call CreateUnitsForPlayer1()
        call CreateUnitsForPlayer2()
        call CreateUnitsForPlayer3()
        call CreateUnitsForPlayer4()
        call CreateUnitsForPlayer5()
        call CreateUnitsForPlayer6()
        call CreateUnitsForPlayer8()
        call CreateUnitsForPlayer9()
        call CreateUnitsForPlayer10()
        call CreateUnitsForPlayer11()
    endfunction

    //===========================================================================
    function CreateAllUnits takes nothing returns nothing
        call CreateNeutralPassiveBuildings()
        call CreatePlayerBuildings()
        call CreateNeutralHostile()
        call CreatePlayerUnits()
    endfunction

    //***************************************************************************
    //*
    //*  Regions
    //*
    //***************************************************************************

    function CreateRegions takes nothing returns nothing
        local weathereffect we

        set gg_rct_Region_000=Rect(- 2464.0, - 2880.0, - 1088.0, - 1920.0)
        set gg_rct_Region_001=Rect(- 4896.0, - 1504.0, - 4480.0, - 928.0)
        set gg_rct_Region_002=Rect(- 3136.0, 160.0, - 2720.0, 576.0)
        set gg_rct_Region_003=Rect(- 4352.0, 224.0, - 3744.0, 448.0)
        set gg_rct_Region_004=Rect(- 2464.0, - 3584.0, - 1376.0, - 2880.0)
        set gg_rct_Region_005=Rect(- 4576.0, - 832.0, - 4448.0, - 736.0)
        set gg_rct_Region_006=Rect(- 4416.0, - 1472.0, - 4256.0, - 1376.0)
        set gg_rct_Region_007=Rect(- 2432.0, - 1664.0, - 1472.0, - 576.0)
        set gg_rct_Region_008=Rect(- 3808.0, - 2176.0, - 3712.0, - 2080.0)
        set gg_rct_Region_009=Rect(4256.0, - 288.0, 4544.0, - 96.0)
        set gg_rct_Region_010=Rect(4480.0, 4416.0, 5280.0, 4800.0)
        set gg_rct_Region_011=Rect(4160.0, 2688.0, 5376.0, 3744.0)
        set gg_rct_Region_012=Rect(2688.0, 2208.0, 3200.0, 2688.0)
        set gg_rct_Region_013=Rect(- 2464.0, - 4704.0, - 1760.0, - 3840.0)
        set gg_rct_Region_014=Rect(3264.0, - 5664.0, 3680.0, - 4512.0)
        set gg_rct_Region_015=Rect(- 2848.0, - 1632.0, - 2528.0, - 1344.0)
        set gg_rct_Region_015_Copy=Rect(- 2848.0, - 1472.0, - 2528.0, - 1184.0)
        set gg_rct_Region_015_Copy_2=Rect(- 2848.0, - 1280.0, - 2528.0, - 992.0)
        set gg_rct_Region_015_Copy_3=Rect(- 2848.0, - 1120.0, - 2528.0, - 832.0)
        set gg_rct_Region_015_Copy_4=Rect(- 2848.0, - 960.0, - 2528.0, - 672.0)
        set gg_rct_Region_015_Copy_5=Rect(- 2848.0, - 800.0, - 2528.0, - 512.0)
        set gg_rct_Region_015_Copy_6=Rect(- 2848.0, - 768.0, - 2528.0, - 480.0)
        set gg_rct_Region_022=Rect(- 1792.0, - 1056.0, - 1408.0, - 768.0)
        set gg_rct_Region_023=Rect(1536.0, - 5664.0, 1728.0, - 4800.0)
        set gg_rct_Region_024=Rect(- 608.0, - 5632.0, - 64.0, - 4448.0)
        set gg_rct_Region_025=Rect(32.0, - 5632.0, 352.0, - 4800.0)
        set gg_rct_Region_026=Rect(512.0, 1216.0, 896.0, 1600.0)
        set gg_rct_Region_027=Rect(256.0, - 864.0, 1408.0, 64.0)
        set gg_rct_Region_028=Rect(- 736.0, 4480.0, - 320.0, 4928.0)
        set gg_rct_Region_030=Rect(2272.0, 4288.0, 2880.0, 4672.0)
        set gg_rct_Region_031=Rect(1792.0, 3200.0, 2368.0, 3456.0)
        set gg_rct_Region_032=Rect(736.0, - 2656.0, 1568.0, - 2176.0)
        set gg_rct_Region_029=Rect(- 3552.0, - 5216.0, - 3168.0, - 4832.0)
        set gg_rct_Region_029_Copy=Rect(- 3552.0, - 4320.0, - 3168.0, - 3936.0)
        set gg_rct_Region_029_Copy_2=Rect(- 4768.0, - 4320.0, - 4384.0, - 3936.0)
        set gg_rct_Region_029_Copy_3=Rect(- 4768.0, - 5184.0, - 4384.0, - 4800.0)
        set gg_rct_Region_036=Rect(- 4352.0, - 4640.0, - 4000.0, - 4512.0)
        set gg_rct_Region_037=Rect(- 3520.0, 3936.0, - 2624.0, 4768.0)
    endfunction

    //***************************************************************************
    //*
    //*  Triggers
    //*
    //***************************************************************************

    //===========================================================================
    // Trigger: Item Cleanup
    //
    // Original mechanics by Trilititi, made portable for GUI users by Bribe.
    // Disclaimer: Don't set the life of a dead item unless you know what you are doing.
    // It will bug the system if you set a dead item's life to a value between 0 and 1.
    //===========================================================================
    function Trig_Item_Cleanup_Func001Func010Func001C takes nothing returns boolean
        if ( not ( GetItemLifeBJ(GetEnumItem()) == 0.00 ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Item_Cleanup_Func001Func010A takes nothing returns nothing
        if ( Trig_Item_Cleanup_Func001Func010Func001C() ) then
            set udg_ItemsToClean=( udg_ItemsToClean + 1 )
            set udg_CleanedItem[udg_ItemsToClean]=GetEnumItem()
        else
        endif
    endfunction

    function Trig_Item_Cleanup_Func001Func011C takes nothing returns boolean
        if ( not ( udg_ItemsToClean >= 0 ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Item_Cleanup_Func001C takes nothing returns boolean
        if ( not ( udg_ItemCleanupFlag == true ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Item_Cleanup_Actions takes nothing returns nothing
        if ( Trig_Item_Cleanup_Func001C() ) then
            set udg_ItemCleanupFlag=false
            //
            // Loop through all dead items and remove them
            //
            set udg_Loop=0
            loop
                exitwhen udg_Loop > udg_ItemsToClean
                call SetItemLifeBJ(udg_CleanedItem[udg_Loop], 1.00)
                call RemoveItem(udg_CleanedItem[udg_Loop])
                set udg_CleanedItem[udg_Loop]=null
                set udg_Loop=udg_Loop + 1
            endloop
        else
            //
            // Clean up all dead items on the map every 15 seconds
            //
            set udg_ItemsToClean=- 1
            call EnumItemsInRectBJ(GetPlayableMapRect(), function Trig_Item_Cleanup_Func001Func010A)
            if ( Trig_Item_Cleanup_Func001Func011C() ) then
                //
                // Start a 1.50 second timer to give time for any death animations to play
                //
                call StartTimerBJ(udg_ItemCleanupTimer, false, 1.50)
                set udg_ItemCleanupFlag=true
            else
            endif
        endif
    endfunction

    //===========================================================================
    function InitTrig_Item_Cleanup takes nothing returns nothing
        set gg_trg_Item_Cleanup=CreateTrigger()
        call TriggerRegisterTimerEventPeriodic(gg_trg_Item_Cleanup, 15.00)
        call TriggerRegisterTimerExpireEventBJ(gg_trg_Item_Cleanup, udg_ItemCleanupTimer)
        call TriggerAddAction(gg_trg_Item_Cleanup, function Trig_Item_Cleanup_Actions)
    endfunction

    //===========================================================================
    // Trigger: Solo
    //===========================================================================
    function Trig_Solo_Actions takes nothing returns nothing
        call DisplayTimedTextToForce(GetPlayersAll(), 5.00, "TRIGSTR_337")
        call SetPlayerFlagBJ(PLAYER_STATE_GIVES_BOUNTY, true, Player(10))
        call SetPlayerFlagBJ(PLAYER_STATE_GIVES_BOUNTY, true, Player(11))
        call DisableTrigger(gg_trg_Cave_Troll_Gold)
        call DisableTrigger(gg_trg_Deep_Cave_Troll_Gold)
        call DisableTrigger(gg_trg_Deep_Orc_Gold)
        call DisableTrigger(gg_trg_Goblin_1_Gold)
        call DisableTrigger(gg_trg_Goblin_2_Gold)
        call DisableTrigger(gg_trg_Goblin_Archer_Gold)
        call DisableTrigger(gg_trg_Goblin_Commander_Gold)
        call DisableTrigger(gg_trg_Orc_Gold)
        call DisableTrigger(gg_trg_Saurons_Speaker_Gold)
        call DisableTrigger(gg_trg_Savage_Orc_Gold)
        call DisableTrigger(gg_trg_Uruk_Hai_Gold)
        call DisableTrigger(gg_trg_Warg_Rider_Gold)
        call DisableTrigger(gg_trg_Uruk_Hai_Captain_Gold)
        call DisableTrigger(gg_trg_Saurons_Chosen_Gold)
        call DisableTrigger(gg_trg_Isengard_Uruk_Hai_Gold)
        call DisableTrigger(gg_trg_Mordor_Orc_Gold)
        call DisableTrigger(gg_trg_Ringwraith_Gold)
        call DisableTrigger(gg_trg_Solo)
    endfunction

    //===========================================================================
    function InitTrig_Solo takes nothing returns nothing
        set gg_trg_Solo=CreateTrigger()
        call DisableTrigger(gg_trg_Solo)
        call TriggerRegisterPlayerChatEvent(gg_trg_Solo, Player(3), "-solo", true)
        call TriggerAddAction(gg_trg_Solo, function Trig_Solo_Actions)
    endfunction

    //===========================================================================
    // Trigger: Initialize
    //===========================================================================
    function Trig_Initialize_Func020002 takes nothing returns nothing
        call AdjustPlayerStateBJ(300, GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD)
    endfunction

    function Trig_Initialize_Actions takes nothing returns nothing
        call ForceAddPlayerSimple(Player(0), udg_Heroes)
        call ForceAddPlayerSimple(Player(1), udg_Heroes)
        call ForceAddPlayerSimple(Player(2), udg_Heroes)
        call ForceAddPlayerSimple(Player(3), udg_Heroes)
        call ForceAddPlayerSimple(Player(4), udg_Heroes)
        call ForceAddPlayerSimple(Player(5), udg_Heroes)
        call ForceAddPlayerSimple(Player(6), udg_Heroes)
        call ForceAddPlayerSimple(Player(7), udg_Heroes)
        call ForceAddPlayerSimple(Player(8), udg_Heroes)
        call ForceAddPlayerSimple(Player(9), udg_Heroes)
        call SetDestructableInvulnerableBJ(gg_dest_DTrc_0059, true)
        call SetDestructableInvulnerableBJ(gg_dest_DTrc_0061, true)
        call SetDestructableInvulnerableBJ(gg_dest_DTrc_0060, true)
        call SetDestructableInvulnerableBJ(gg_dest_DTrc_0056, true)
        call SetDestructableInvulnerableBJ(gg_dest_DTrc_0055, true)
        call SetDestructableInvulnerableBJ(gg_dest_DTrc_0057, true)
        call SetDestructableInvulnerableBJ(gg_dest_DTrc_0058, true)
        call SetTimeOfDay(24.00)
        call UseTimeOfDayBJ(false)
        call ForForce(udg_Heroes, function Trig_Initialize_Func020002)
        call TriggerSleepAction(5.00)
        call PlayThematicMusicBJ("Sound\\Music\\mp3Music\\HeroicVictory.mp3")
        call DisplayTimedTextToForce(GetPlayersAll(), 5.00, "TRIGSTR_325")
        call TriggerSleepAction(10.00)
        call DisplayTimedTextToForce(GetPlayersAll(), 5.00, "TRIGSTR_287")
        call TriggerSleepAction(10.00)
        call DisplayTimedTextToForce(GetPlayersAll(), 5.00, "TRIGSTR_288")
        call TriggerSleepAction(10.00)
        call DisplayTimedTextToForce(GetPlayersAll(), 5.00, "TRIGSTR_327")
        call TriggerSleepAction(10.00)
        call DisplayTimedTextToForce(GetPlayersAll(), 5.00, "TRIGSTR_328")
        call DisableTrigger(gg_trg_Easy_Mode)
        call DisableTrigger(gg_trg_Solo)
    endfunction

    //===========================================================================
    function InitTrig_Initialize takes nothing returns nothing
        set gg_trg_Initialize=CreateTrigger()
        call TriggerAddAction(gg_trg_Initialize, function Trig_Initialize_Actions)
    endfunction

    //===========================================================================
    // Trigger: Easy Mode
    //===========================================================================
    function Trig_Easy_Mode_Actions takes nothing returns nothing
        call DisplayTimedTextToForce(GetPlayersAll(), 10.00, "TRIGSTR_336")
        call UnitRemoveItemFromSlotSwapped(3, gg_unit_HC05_0005)
        call RemoveItem(GetLastRemovedItem())
        call UnitAddItemByIdSwapped('I00D', gg_unit_HC05_0005)
        call AddHeroXPSwapped(200, gg_unit_HC01_0009, true)
        call AddHeroXPSwapped(200, gg_unit_HC00_0001, true)
        call AddHeroXPSwapped(200, gg_unit_HC02_0003, true)
        call AddHeroXPSwapped(200, gg_unit_HC03_0002, true)
        call AddHeroXPSwapped(200, gg_unit_HC05_0005, true)
        call AddHeroXPSwapped(200, gg_unit_HC06_0007, true)
        call AddHeroXPSwapped(200, gg_unit_HC07_0008, true)
        call AddHeroXPSwapped(200, gg_unit_HC04_0004, true)
        call AddHeroXPSwapped(200, gg_unit_HC08_0006, true)
        call RemoveUnit(gg_unit_n000_0027)
        call RemoveUnit(gg_unit_n000_0028)
        call RemoveUnit(gg_unit_nC16_0174)
        call RemoveUnit(gg_unit_nC16_0039)
        call RemoveUnit(gg_unit_nC16_0176)
        call RemoveUnit(gg_unit_nC16_0180)
        call RemoveUnit(gg_unit_nC16_0024)
        call RemoveUnit(gg_unit_n000_0045)
        call RemoveUnit(gg_unit_n000_0034)
        call RemoveUnit(gg_unit_n000_0032)
        call RemoveUnit(gg_unit_n000_0035)
        call RemoveUnit(gg_unit_n000_0040)
        call RemoveUnit(gg_unit_n000_0041)
        call RemoveUnit(gg_unit_n000_0042)
        call RemoveUnit(gg_unit_n000_0043)
        call RemoveUnit(gg_unit_n000_0044)
        call RemoveUnit(gg_unit_Nbbc_0093)
        call RemoveUnit(gg_unit_Nbbc_0087)
        call RemoveUnit(gg_unit_nchw_0053)
        call RemoveUnit(gg_unit_nchw_0051)
        call RemoveUnit(gg_unit_Nbbc_0345)
        call RemoveUnit(gg_unit_Nbbc_0349)
        call RemoveUnit(gg_unit_Nbbc_0344)
        call RemoveUnit(gg_unit_Nbbc_0342)
        call RemoveUnit(gg_unit_Nbbc_0350)
        call RemoveUnit(gg_unit_nchw_0285)
        call RemoveUnit(gg_unit_nchw_0287)
        call RemoveUnit(gg_unit_nchw_0291)
        call RemoveUnit(gg_unit_nchw_0288)
        call RemoveUnit(gg_unit_nchw_0295)
        call RemoveUnit(gg_unit_nchw_0132)
        call RemoveUnit(gg_unit_Nbbc_0094)
        call DisableTrigger(gg_trg_part_of_sixth_wave)
        call DisableTrigger(gg_trg_part_of_eight_wave)
        call DisableTrigger(gg_trg_part_of_fifth_wave)
        call DisableTrigger(gg_trg_Balrog_Attacked)
        call DisableTrigger(gg_trg_Easy_Mode)
    endfunction

    //===========================================================================
    function InitTrig_Easy_Mode takes nothing returns nothing
        set gg_trg_Easy_Mode=CreateTrigger()
        call TriggerRegisterPlayerChatEvent(gg_trg_Easy_Mode, Player(3), "-easy", true)
        call TriggerAddAction(gg_trg_Easy_Mode, function Trig_Easy_Mode_Actions)
    endfunction

    //===========================================================================
    // Trigger: Orc Leader Message
    //===========================================================================
    function Trig_Orc_Leader_Message_Conditions takes nothing returns boolean
        if ( not ( IsUnitInGroup(GetEnteringUnit(), GetUnitsOfPlayerAll(Player(10))) == false ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Orc_Leader_Message_Actions takes nothing returns nothing
        call PlaySoundBJ(gg_snd_U08Archimonde19)
        call DisplayTextToForce(GetPlayersAll(), "TRIGSTR_480")
        call DisableTrigger(gg_trg_Orc_Leader_Message)
    endfunction

    //===========================================================================
    function InitTrig_Orc_Leader_Message takes nothing returns nothing
        set gg_trg_Orc_Leader_Message=CreateTrigger()
        call TriggerRegisterEnterRectSimple(gg_trg_Orc_Leader_Message, gg_rct_Region_011)
        call TriggerAddCondition(gg_trg_Orc_Leader_Message, Condition(function Trig_Orc_Leader_Message_Conditions))
        call TriggerAddAction(gg_trg_Orc_Leader_Message, function Trig_Orc_Leader_Message_Actions)
    endfunction

    //===========================================================================
    // Trigger: Mouth of Sauron Dies
    //===========================================================================
    function Trig_Mouth_of_Sauron_Dies_Actions takes nothing returns nothing
        call PlaySoundBJ(gg_snd_The_Fellowship_of_the_Ring_Theme_Song__Short_u)
        call DisplayTimedTextToForce(GetPlayersAll(), 12.00, "TRIGSTR_474")
        call SetDestructableInvulnerableBJ(gg_dest_DTrc_0061, false)
        call SetDestructableInvulnerableBJ(gg_dest_DTrc_0059, false)
        call SetDestructableInvulnerableBJ(gg_dest_DTrc_0060, false)
        call SetUnitPositionLoc(gg_unit_HC00_0001, GetRectCenter(gg_rct_Region_029_Copy_2))
        call SetUnitPositionLoc(gg_unit_HC02_0003, GetRectCenter(gg_rct_Region_029_Copy))
        call SetUnitPositionLoc(gg_unit_HC04_0004, GetRectCenter(gg_rct_Region_029_Copy_3))
        call SetUnitPositionLoc(GroupPickRandomUnit(GetUnitsOfPlayerAndTypeId(Player(2), 'H000')), GetRectCenter(gg_rct_Region_029_Copy_3))
        call SetUnitPositionLoc(GroupPickRandomUnit(GetUnitsOfPlayerAndTypeId(Player(2), 'hphx')), GetRectCenter(gg_rct_Region_029_Copy_3))
        call SetUnitPositionLoc(GroupPickRandomUnit(GetUnitsOfPlayerAndTypeId(Player(2), 'hpxe')), GetRectCenter(gg_rct_Region_029_Copy_3))
        call SetUnitPositionLoc(gg_unit_HC01_0009, GetRectCenter(gg_rct_Region_029))
        call PanCameraToTimedLocForPlayer(Player(1), GetRectCenter(gg_rct_Region_029_Copy_2), 0.50)
        call PanCameraToTimedLocForPlayer(Player(5), GetRectCenter(gg_rct_Region_029_Copy), 0.50)
        call PanCameraToTimedLocForPlayer(Player(2), GetRectCenter(gg_rct_Region_029_Copy_3), 0.50)
        call PanCameraToTimedLocForPlayer(Player(6), GetRectCenter(gg_rct_Region_029), 0.50)
        call SetForceAllianceStateBJ(udg_Heroes, bj_FORCE_PLAYER[1], bj_ALLIANCE_UNALLIED_VISION)
        call SetForceAllianceStateBJ(udg_Heroes, bj_FORCE_PLAYER[5], bj_ALLIANCE_UNALLIED_VISION)
        call SetForceAllianceStateBJ(udg_Heroes, bj_FORCE_PLAYER[2], bj_ALLIANCE_UNALLIED_VISION)
        call SetForceAllianceStateBJ(udg_Heroes, bj_FORCE_PLAYER[6], bj_ALLIANCE_UNALLIED_VISION)
    endfunction

    //===========================================================================
    function InitTrig_Mouth_of_Sauron_Dies takes nothing returns nothing
        set gg_trg_Mouth_of_Sauron_Dies=CreateTrigger()
        call TriggerRegisterUnitEvent(gg_trg_Mouth_of_Sauron_Dies, gg_unit_o005_0135, EVENT_UNIT_DEATH)
        call TriggerAddAction(gg_trg_Mouth_of_Sauron_Dies, function Trig_Mouth_of_Sauron_Dies_Actions)
    endfunction

    //===========================================================================
    // Trigger: Orthanc Dies
    //===========================================================================
    function Trig_Orthanc_Dies_Conditions takes nothing returns boolean
        if ( not ( GetUnitTypeId(GetDyingUnit()) == 'h001' ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Orthanc_Dies_Actions takes nothing returns nothing
        call PlaySoundBJ(gg_snd_The_Fellowship_of_the_Ring_Theme_Song__Short_u)
        call DisableTrigger(gg_trg_Ent_Eaters)
        call DisplayTimedTextToForce(GetPlayersAll(), 12.00, "TRIGSTR_469")
        call SetDestructableInvulnerableBJ(gg_dest_DTrc_0055, false)
        call SetDestructableInvulnerableBJ(gg_dest_DTrc_0056, false)
        call SetDestructableInvulnerableBJ(gg_dest_DTrc_0057, false)
        call SetDestructableInvulnerableBJ(gg_dest_DTrc_0058, false)
        call SetUnitPositionLoc(gg_unit_HC03_0002, GetRectCenter(gg_rct_Region_029_Copy_2))
        call SetUnitPositionLoc(gg_unit_HC06_0007, GetRectCenter(gg_rct_Region_029_Copy))
        call SetUnitPositionLoc(gg_unit_HC07_0008, GetRectCenter(gg_rct_Region_029_Copy_3))
        call PanCameraToTimedLocForPlayer(Player(0), GetRectCenter(gg_rct_Region_029_Copy_2), 0.50)
        call PanCameraToTimedLocForPlayer(Player(9), GetRectCenter(gg_rct_Region_029_Copy), 0.50)
        call PanCameraToTimedLocForPlayer(Player(8), GetRectCenter(gg_rct_Region_029_Copy_3), 0.50)
        call SetForceAllianceStateBJ(udg_Heroes, bj_FORCE_PLAYER[0], bj_ALLIANCE_UNALLIED_VISION)
        call SetForceAllianceStateBJ(udg_Heroes, bj_FORCE_PLAYER[9], bj_ALLIANCE_UNALLIED_VISION)
        call SetForceAllianceStateBJ(udg_Heroes, bj_FORCE_PLAYER[8], bj_ALLIANCE_UNALLIED_VISION)
    endfunction

    //===========================================================================
    function InitTrig_Orthanc_Dies takes nothing returns nothing
        set gg_trg_Orthanc_Dies=CreateTrigger()
        call DisableTrigger(gg_trg_Orthanc_Dies)
        call TriggerRegisterPlayerUnitEventSimple(gg_trg_Orthanc_Dies, Player(11), EVENT_PLAYER_UNIT_DEATH)
        call TriggerAddCondition(gg_trg_Orthanc_Dies, Condition(function Trig_Orthanc_Dies_Conditions))
        call TriggerAddAction(gg_trg_Orthanc_Dies, function Trig_Orthanc_Dies_Actions)
    endfunction

    //===========================================================================
    // Trigger: Shelob Dies
    //===========================================================================
    function Trig_Shelob_Dies_Actions takes nothing returns nothing
        call PlaySoundBJ(gg_snd_The_Fellowship_of_the_Ring_Theme_Song__Short_u)
        call DisplayTextToForce(GetPlayersAll(), "TRIGSTR_481")
        call SetUnitPositionLoc(gg_unit_HC05_0005, GetRectCenter(gg_rct_Region_028))
        call SetUnitPositionLoc(gg_unit_HC08_0006, GetRectCenter(gg_rct_Region_029))
        call PanCameraToTimedLocForPlayer(Player(3), GetRectCenter(gg_rct_Region_028), 0.50)
        call PanCameraToTimedLocForPlayer(Player(4), GetRectCenter(gg_rct_Region_029), 0.50)
        call SetForceAllianceStateBJ(udg_Heroes, bj_FORCE_PLAYER[4], bj_ALLIANCE_UNALLIED_VISION)
    endfunction

    //===========================================================================
    function InitTrig_Shelob_Dies takes nothing returns nothing
        set gg_trg_Shelob_Dies=CreateTrigger()
        call TriggerRegisterUnitEvent(gg_trg_Shelob_Dies, gg_unit_n001_0025, EVENT_UNIT_DEATH)
        call TriggerAddAction(gg_trg_Shelob_Dies, function Trig_Shelob_Dies_Actions)
    endfunction

    //===========================================================================
    // Trigger: Ring Destroyed
    //===========================================================================
    function Trig_Ring_Destroyed_Func001002 takes nothing returns nothing
        call PanCameraToTimedLocForPlayer(GetEnumPlayer(), GetUnitLoc(GetDyingUnit()), 0.50)
    endfunction

    function Trig_Ring_Destroyed_Func011002 takes nothing returns nothing
        call CustomVictoryBJ(GetEnumPlayer(), true, true)
    endfunction

    function Trig_Ring_Destroyed_Actions takes nothing returns nothing
        call ForForce(udg_Heroes, function Trig_Ring_Destroyed_Func001002)
        call UnitRemoveItemFromSlotSwapped(1, gg_unit_HC05_0005)
        call RemoveItem(GetLastRemovedItem())
        call DisplayTimedTextToForce(GetPlayersAll(), 10.00, "TRIGSTR_482")
        call PlaySoundBJ(gg_snd_LightningBolt)
        call TriggerSleepAction(8.00)
        call DisplayTimedTextToForce(GetPlayersAll(), 5.00, "TRIGSTR_468")
        call PlaySoundBJ(gg_snd_The_Fellowship_of_the_Ring_Soundtrack_02_Concerning_Hobbits__Short_u)
        call TriggerSleepAction(10.00)
        call ForForce(udg_Heroes, function Trig_Ring_Destroyed_Func011002)
    endfunction

    //===========================================================================
    function InitTrig_Ring_Destroyed takes nothing returns nothing
        set gg_trg_Ring_Destroyed=CreateTrigger()
        call TriggerRegisterUnitEvent(gg_trg_Ring_Destroyed, gg_unit_u000_0033, EVENT_UNIT_DEATH)
        call TriggerAddAction(gg_trg_Ring_Destroyed, function Trig_Ring_Destroyed_Actions)
    endfunction

    //===========================================================================
    // Trigger: Uruk Hai Spawn
    //===========================================================================
    function Trig_Uruk_Hai_Spawn_Actions takes nothing returns nothing
        call EnableTrigger(gg_trg_Uruk_Hai_Respawning)
        call EnableTrigger(gg_trg_Stop_Uruk_Hai_Respawning)
        call DisableTrigger(gg_trg_Uruk_Hai_Spawn)
    endfunction

    //===========================================================================
    function InitTrig_Uruk_Hai_Spawn takes nothing returns nothing
        set gg_trg_Uruk_Hai_Spawn=CreateTrigger()
        call TriggerRegisterEnterRectSimple(gg_trg_Uruk_Hai_Spawn, gg_rct_Region_010)
        call TriggerAddAction(gg_trg_Uruk_Hai_Spawn, function Trig_Uruk_Hai_Spawn_Actions)
    endfunction

    //===========================================================================
    // Trigger: Halfway to Balrog
    //===========================================================================
    function Trig_Halfway_to_Balrog_Func005002 takes nothing returns nothing
        call IssuePointOrderLocBJ(GetEnumUnit(), "attack", GetRandomLocInRect(gg_rct_Region_014))
    endfunction

    function Trig_Halfway_to_Balrog_Func006002 takes nothing returns nothing
        call IssuePointOrderLocBJ(GetEnumUnit(), "attack", GetRandomLocInRect(gg_rct_Region_014))
    endfunction

    function Trig_Halfway_to_Balrog_Actions takes nothing returns nothing
        call PlaySoundBJ(gg_snd_BattleNetDoorsStereo2)
        call CreateNUnitsAtLoc(30, 'o000', Player(11), GetRectCenter(gg_rct_Region_025), bj_UNIT_FACING)
        call CreateNUnitsAtLoc(3, 'nC17', Player(11), GetRectCenter(gg_rct_Region_025), bj_UNIT_FACING)
        call CreateNUnitsAtLoc(10, 'nC16', Player(11), GetRectCenter(gg_rct_Region_024), bj_UNIT_FACING)
        call ForGroupBJ(GetUnitsInRectOfPlayer(gg_rct_Region_024, Player(11)), function Trig_Halfway_to_Balrog_Func005002)
        call ForGroupBJ(GetUnitsInRectOfPlayer(gg_rct_Region_025, Player(11)), function Trig_Halfway_to_Balrog_Func006002)
        call DisableTrigger(gg_trg_Halfway_to_Balrog)
    endfunction

    //===========================================================================
    function InitTrig_Halfway_to_Balrog takes nothing returns nothing
        set gg_trg_Halfway_to_Balrog=CreateTrigger()
        call TriggerRegisterEnterRectSimple(gg_trg_Halfway_to_Balrog, gg_rct_Region_023)
        call TriggerAddAction(gg_trg_Halfway_to_Balrog, function Trig_Halfway_to_Balrog_Actions)
    endfunction

    //===========================================================================
    // Trigger: Enter Balrogs Lair
    //===========================================================================
    function Trig_Enter_Balrogs_Lair_Actions takes nothing returns nothing
        call DisableTrigger(gg_trg_Deep_Respawning)
        call DisableTrigger(gg_trg_Enter_Balrogs_Lair)
    endfunction

    //===========================================================================
    function InitTrig_Enter_Balrogs_Lair takes nothing returns nothing
        set gg_trg_Enter_Balrogs_Lair=CreateTrigger()
        call TriggerRegisterEnterRectSimple(gg_trg_Enter_Balrogs_Lair, gg_rct_Region_014)
        call TriggerAddAction(gg_trg_Enter_Balrogs_Lair, function Trig_Enter_Balrogs_Lair_Actions)
    endfunction

    //===========================================================================
    // Trigger: Gandalf Threatens Balrog
    //===========================================================================
    function Trig_Gandalf_Threatens_Balrog_Conditions takes nothing returns boolean
        if ( not ( GetSpellTargetUnit() == gg_unit_nC18_0178 ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Balrog_Attacked_Actions takes nothing returns nothing
        call TriggerSleepAction(1.00)
        call DisplayTimedTextToForce(GetPlayersAll(), 5.00, "TRIGSTR_338")
        call EnableTrigger(gg_trg_Gandalf_Dies)
        call EnableTrigger(gg_trg_Mountain_Cave)
        call DisableTrigger(gg_trg_Deep_Respawning)
        call DisableTrigger(gg_trg_Balrog_Attacked)
    endfunction

    //===========================================================================
    function InitTrig_Balrog_Attacked takes nothing returns nothing
        set gg_trg_Balrog_Attacked=CreateTrigger()
        call TriggerRegisterUnitEvent(gg_trg_Balrog_Attacked, gg_unit_HC04_0004, EVENT_UNIT_SPELL_CAST)
        call TriggerAddCondition(gg_trg_Balrog_Attacked, Condition(function Trig_Balrog_Attacked_Conditions))
        call TriggerAddAction(gg_trg_Balrog_Attacked, function Trig_Balrog_Attacked_Actions)
    endfunction

    //===========================================================================
    // Trigger: Grom Dies
    //===========================================================================
    function Trig_Grom_Dies_Conditions takes nothing returns boolean
        if ( not ( gg_trg_Grom_Dies == gg_trg_Grom_Dies ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Grom_Dies_Func046002 takes nothing returns nothing
        call RemoveUnit(GetEnumUnit())
    endfunction

    function Trig_Grom_Dies_Func051002 takes nothing returns nothing
        call IssuePointOrderLocBJ(GetEnumUnit(), "attack", GetRandomLocInRect(gg_rct_Region_027))
    endfunction

    function Trig_Grom_Dies_Func054002 takes nothing returns nothing
        call IssuePointOrderLocBJ(GetEnumUnit(), "attack", GetRandomLocInRect(gg_rct_Region_027))
    endfunction

    function Trig_Grom_Dies_Func058002 takes nothing returns nothing
        call IssuePointOrderLocBJ(GetEnumUnit(), "attack", GetRandomLocInRect(gg_rct_Region_027))
    endfunction

    function Trig_Grom_Dies_Func062002 takes nothing returns nothing
        call IssuePointOrderLocBJ(GetEnumUnit(), "attack", GetRandomLocInRect(gg_rct_Region_027))
    endfunction

    function Trig_Grom_Dies_Func066002 takes nothing returns nothing
        call IssuePointOrderLocBJ(GetEnumUnit(), "attack", GetRandomLocInRect(gg_rct_Region_027))
    endfunction

    function Trig_Grom_Dies_Func071002 takes nothing returns nothing
        call IssuePointOrderLocBJ(GetEnumUnit(), "attack", GetRandomLocInRect(gg_rct_Region_027))
    endfunction

    function Trig_Grom_Dies_Actions takes nothing returns nothing
        call DisplayTimedTextToForce(GetPlayersAll(), 12.00, "TRIGSTR_466")
        call PlayThematicMusicBJ("Sound\\Music\\mp3Music\\DarkVictory.mp3")
        call TriggerSleepAction(12.00)
        call DisplayTimedTextToForce(GetPlayersAll(), 5.00, "TRIGSTR_467")
        call PlaySoundBJ(gg_snd_Mortal_Kombat_Theme_Song_Original__Short_u)
        call TriggerSleepAction(5.00)
        call CreateTextTagLocBJ("TRIGSTR_487", GetRectCenter(gg_rct_Region_036), 0, 10, 100, 100, 100, 0)
        call SetUnitPositionLoc(gg_unit_HC00_0001, GetRectCenter(gg_rct_Region_027))
        call SetUnitPositionLoc(gg_unit_HC02_0003, GetRectCenter(gg_rct_Region_027))
        call SetUnitPositionLoc(gg_unit_HC04_0004, GetRectCenter(gg_rct_Region_027))
        call SetUnitPositionLoc(gg_unit_HC01_0009, GetRectCenter(gg_rct_Region_027))
        call SetUnitPositionLoc(GroupPickRandomUnit(GetUnitsOfPlayerAndTypeId(Player(2), 'H000')), GetRectCenter(gg_rct_Region_027))
        call SetUnitPositionLoc(GroupPickRandomUnit(GetUnitsOfPlayerAndTypeId(Player(2), 'hphx')), GetRectCenter(gg_rct_Region_027))
        call SetUnitPositionLoc(GroupPickRandomUnit(GetUnitsOfPlayerAndTypeId(Player(2), 'hpxe')), GetRectCenter(gg_rct_Region_027))
        call PanCameraToTimedLocForPlayer(Player(1), GetRectCenter(gg_rct_Region_027), 0.50)
        call PanCameraToTimedLocForPlayer(Player(5), GetRectCenter(gg_rct_Region_027), 0.50)
        call PanCameraToTimedLocForPlayer(Player(2), GetRectCenter(gg_rct_Region_027), 0.50)
        call PanCameraToTimedLocForPlayer(Player(6), GetRectCenter(gg_rct_Region_027), 0.50)
        call DisplayTimedTextToForce(bj_FORCE_PLAYER[1], 30.00, "TRIGSTR_488")
        call DisplayTimedTextToForce(bj_FORCE_PLAYER[5], 30.00, "TRIGSTR_489")
        call DisplayTimedTextToForce(bj_FORCE_PLAYER[2], 30.00, "TRIGSTR_490")
        call DisplayTimedTextToForce(bj_FORCE_PLAYER[6], 30.00, "TRIGSTR_491")
        call SetUnitPositionLoc(gg_unit_HC05_0005, GetRectCenter(gg_rct_Region_026))
        call SetUnitPositionLoc(gg_unit_HC08_0006, GetRectCenter(gg_rct_Region_026))
        call DisplayTimedTextToForce(bj_FORCE_PLAYER[3], 30.00, "TRIGSTR_493")
        call DisplayTimedTextToForce(bj_FORCE_PLAYER[4], 30.00, "TRIGSTR_494")
        call PanCameraToTimedLocForPlayer(Player(3), GetRectCenter(gg_rct_Region_026), 0.50)
        call PanCameraToTimedLocForPlayer(Player(4), GetRectCenter(gg_rct_Region_026), 0.50)
        call SetUnitPositionLoc(gg_unit_HC03_0002, GetRectCenter(gg_rct_Region_011))
        call SetUnitPositionLoc(gg_unit_HC06_0007, GetRectCenter(gg_rct_Region_011))
        call SetUnitPositionLoc(gg_unit_HC07_0008, GetRectCenter(gg_rct_Region_011))
        call DisplayTimedTextToForce(bj_FORCE_PLAYER[0], 30.00, "TRIGSTR_495")
        call DisplayTimedTextToForce(bj_FORCE_PLAYER[9], 30.00, "TRIGSTR_496")
        call DisplayTimedTextToForce(bj_FORCE_PLAYER[8], 30.00, "TRIGSTR_497")
        call PanCameraToTimedLocForPlayer(Player(0), GetRectCenter(gg_rct_Region_011), 0.50)
        call PanCameraToTimedLocForPlayer(Player(9), GetRectCenter(gg_rct_Region_011), 0.50)
        call PanCameraToTimedLocForPlayer(Player(8), GetRectCenter(gg_rct_Region_011), 0.50)
        call CreateNUnitsAtLoc(3, 'e000', Player(8), GetRectCenter(gg_rct_Region_011), bj_UNIT_FACING)
        call CreateNUnitsAtLoc(3, 'e000', Player(9), GetRectCenter(gg_rct_Region_011), bj_UNIT_FACING)
        call CreateNUnitsAtLoc(3, 'e000', Player(0), GetRectCenter(gg_rct_Region_011), bj_UNIT_FACING)
        call CreateNUnitsAtLoc(1, 'h001', Player(11), GetRectCenter(gg_rct_Region_012), bj_UNIT_FACING)
        call RemoveUnit(gg_unit_nC14_0134)
        call DisableTrigger(gg_trg_Uruk_Hai_Respawning)
        call ForGroupBJ(GetUnitsInRectOfPlayer(gg_rct_Region_011, Player(10)), function Trig_Grom_Dies_Func046002)
        call EnableTrigger(gg_trg_Orthanc_Dies)
        call EnableTrigger(gg_trg_Ent_Eaters)
        call TriggerSleepAction(5.00)
        call CreateNUnitsAtLoc(1, 'o002', Player(10), GetRectCenter(gg_rct_Region_032), bj_UNIT_FACING)
        call ForGroupBJ(GetUnitsInRectOfPlayer(gg_rct_Region_032, Player(10)), function Trig_Grom_Dies_Func051002)
        call TriggerSleepAction(5.00)
        call CreateNUnitsAtLoc(3, 'o002', Player(10), GetRectCenter(gg_rct_Region_032), bj_UNIT_FACING)
        call ForGroupBJ(GetUnitsInRectOfPlayer(gg_rct_Region_032, Player(10)), function Trig_Grom_Dies_Func054002)
        call TriggerSleepAction(10.00)
        call CreateNUnitsAtLoc(6, 'o002', Player(10), GetRectCenter(gg_rct_Region_032), bj_UNIT_FACING)
        call CreateNUnitsAtLoc(1, 'o003', Player(10), GetRectCenter(gg_rct_Region_032), bj_UNIT_FACING)
        call ForGroupBJ(GetUnitsInRectOfPlayer(gg_rct_Region_032, Player(10)), function Trig_Grom_Dies_Func058002)
        call TriggerSleepAction(20.00)
        call CreateNUnitsAtLoc(12, 'o002', Player(10), GetRectCenter(gg_rct_Region_032), bj_UNIT_FACING)
        call CreateNUnitsAtLoc(3, 'o003', Player(10), GetRectCenter(gg_rct_Region_032), bj_UNIT_FACING)
        call ForGroupBJ(GetUnitsInRectOfPlayer(gg_rct_Region_032, Player(10)), function Trig_Grom_Dies_Func062002)
        call TriggerSleepAction(40.00)
        call CreateNUnitsAtLoc(24, 'o002', Player(10), GetRectCenter(gg_rct_Region_032), bj_UNIT_FACING)
        call CreateNUnitsAtLoc(6, 'o003', Player(10), GetRectCenter(gg_rct_Region_032), bj_UNIT_FACING)
        call ForGroupBJ(GetUnitsInRectOfPlayer(gg_rct_Region_032, Player(10)), function Trig_Grom_Dies_Func066002)
        call TriggerSleepAction(80.00)
        call CreateNUnitsAtLoc(36, 'o002', Player(10), GetRectCenter(gg_rct_Region_032), bj_UNIT_FACING)
        call CreateNUnitsAtLoc(8, 'o003', Player(10), GetRectCenter(gg_rct_Region_032), bj_UNIT_FACING)
        call CreateNUnitsAtLoc(1, 'o004', Player(10), GetRectCenter(gg_rct_Region_032), bj_UNIT_FACING)
        call ForGroupBJ(GetUnitsInRectOfPlayer(gg_rct_Region_032, Player(10)), function Trig_Grom_Dies_Func071002)
        call SetUnitInvulnerable(gg_unit_o001_0029, false)
        call SetUnitInvulnerable(gg_unit_o001_0026, false)
        call SetUnitInvulnerable(gg_unit_o005_0135, false)
    endfunction

    //===========================================================================
    function InitTrig_Grom_Dies takes nothing returns nothing
        set gg_trg_Grom_Dies=CreateTrigger()
        call TriggerRegisterUnitEvent(gg_trg_Grom_Dies, gg_unit_Opgh_0341, EVENT_UNIT_DEATH)
        call TriggerAddCondition(gg_trg_Grom_Dies, Condition(function Trig_Grom_Dies_Conditions))
        call TriggerAddAction(gg_trg_Grom_Dies, function Trig_Grom_Dies_Actions)
    endfunction

    //===========================================================================
    // Trigger: Balrog Dies
    //===========================================================================
    function Trig_Balrog_Dies_Conditions takes nothing returns boolean
        if ( not ( IsTriggerEnabled(gg_trg_Gandalf_Dies) == false ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Balrog_Dies_Actions takes nothing returns nothing
        call EnableTrigger(gg_trg_Mountain_Cave)
        call DisableTrigger(gg_trg_Deep_Respawning)
        call DisplayTextToForce(GetPlayersAll(), "TRIGSTR_088")
        call PlayThematicMusicBJ("Sound\\Music\\mp3Music\\DarkVictory.mp3")
    endfunction

    //===========================================================================
    function InitTrig_Balrog_Dies takes nothing returns nothing
        set gg_trg_Balrog_Dies=CreateTrigger()
        call TriggerRegisterUnitEvent(gg_trg_Balrog_Dies, gg_unit_nC18_0178, EVENT_UNIT_DEATH)
        call TriggerAddCondition(gg_trg_Balrog_Dies, Condition(function Trig_Balrog_Dies_Conditions))
        call TriggerAddAction(gg_trg_Balrog_Dies, function Trig_Balrog_Dies_Actions)
    endfunction

    //===========================================================================
    // Trigger: Mountain Cave
    //===========================================================================
    function Trig_Mountain_Cave_Actions takes nothing returns nothing
        call SetUnitPositionLoc(GetTriggerUnit(), GetRectCenter(gg_rct_Region_010))
        call PanCameraToTimedLocForPlayer(GetOwningPlayer(GetTriggerUnit()), GetRectCenter(gg_rct_Region_010), 0.50)
        call SetTimeOfDay(12.00)
        call UseTimeOfDayBJ(false)
    endfunction

    //===========================================================================
    function InitTrig_Mountain_Cave takes nothing returns nothing
        set gg_trg_Mountain_Cave=CreateTrigger()
        call DisableTrigger(gg_trg_Mountain_Cave)
        call TriggerRegisterEnterRectSimple(gg_trg_Mountain_Cave, gg_rct_Region_009)
        call TriggerAddAction(gg_trg_Mountain_Cave, function Trig_Mountain_Cave_Actions)
    endfunction

    //===========================================================================
    // Trigger: Mountain Cave Merry
    //===========================================================================
    function Trig_Mountain_Cave_Merry_Conditions takes nothing returns boolean
        if ( not ( GetTriggerUnit() == gg_unit_HC06_0007 ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Mountain_Cave_Merry_Actions takes nothing returns nothing
        call UnitAddAbilityBJ('ANeg', GetTriggerUnit())
    endfunction

    //===========================================================================
    function InitTrig_Mountain_Cave_Merry takes nothing returns nothing
        set gg_trg_Mountain_Cave_Merry=CreateTrigger()
        call DisableTrigger(gg_trg_Mountain_Cave_Merry)
        call TriggerRegisterEnterRectSimple(gg_trg_Mountain_Cave_Merry, gg_rct_Region_009)
        call TriggerAddCondition(gg_trg_Mountain_Cave_Merry, Condition(function Trig_Mountain_Cave_Merry_Conditions))
        call TriggerAddAction(gg_trg_Mountain_Cave_Merry, function Trig_Mountain_Cave_Merry_Actions)
    endfunction

    //===========================================================================
    // Trigger: Gandalf Dies
    //===========================================================================
    function Trig_Gandalf_Dies_Conditions takes nothing returns boolean
        if ( not ( GetKillingUnitBJ() == gg_unit_nC18_0178 ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Gandalf_Dies_Actions takes nothing returns nothing
        call DisplayTimedTextToForce(GetPlayersAll(), 10.00, "TRIGSTR_329")
        call UnitDamageTargetBJ(gg_unit_HC04_0004, gg_unit_nC18_0178, 800000.00, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL)
        call RemoveUnit(GroupPickRandomUnit(GetUnitsOfPlayerAndTypeId(Player(2), 'hphx')))
        call RemoveUnit(GroupPickRandomUnit(GetUnitsOfPlayerAndTypeId(Player(2), 'hpxe')))
        call RemoveUnit(GroupPickRandomUnit(GetUnitsOfPlayerAndTypeId(Player(2), 'HC04')))
        call PlayThematicMusicBJ("Sound\\Music\\mp3Music\\DarkVictory.mp3")
        call TriggerSleepAction(5.00)
        call PanCameraToTimedLocForPlayer(Player(2), GetRectCenter(gg_rct_Region_010), 0.50)
        call CreateNUnitsAtLocFacingLocBJ(1, 'H000', Player(2), GetRectCenter(gg_rct_Region_010), GetRectCenter(gg_rct_Region_010))
        call UnitAddItemByIdSwapped('I00E', GetLastCreatedUnit())
    endfunction

    //===========================================================================
    function InitTrig_Gandalf_Dies takes nothing returns nothing
        set gg_trg_Gandalf_Dies=CreateTrigger()
        call DisableTrigger(gg_trg_Gandalf_Dies)
        call TriggerRegisterUnitEvent(gg_trg_Gandalf_Dies, gg_unit_HC04_0004, EVENT_UNIT_DEATH)
        call TriggerAddCondition(gg_trg_Gandalf_Dies, Condition(function Trig_Gandalf_Dies_Conditions))
        call TriggerAddAction(gg_trg_Gandalf_Dies, function Trig_Gandalf_Dies_Actions)
    endfunction

    //===========================================================================
    // Trigger: Frodo dies
    //===========================================================================
    function Trig_Frodo_dies_Conditions takes nothing returns boolean
        if ( not ( IsUnitDeadBJ(gg_unit_HC05_0005) == true ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Frodo_dies_Func020002 takes nothing returns nothing
        call CustomDefeatBJ(GetEnumPlayer(), "TRIGSTR_508")
    endfunction

    function Trig_Frodo_dies_Actions takes nothing returns nothing
        call DisplayTimedTextToForce(GetPlayersAll(), 10.00, "TRIGSTR_057")
        call DisplayTimedTextToForce(GetPlayersAll(), 10.00, "TRIGSTR_347")
        call DisplayTimedTextToForce(GetPlayersAll(), 10.00, "TRIGSTR_348")
        call TriggerSleepAction(1.00)
        call DisplayTimedTextToForce(GetPlayersAll(), 10.00, "TRIGSTR_339")
        call DisplayTimedTextToForce(GetPlayersAll(), 10.00, "TRIGSTR_349")
        call DisplayTimedTextToForce(GetPlayersAll(), 10.00, "TRIGSTR_350")
        call TriggerSleepAction(1.00)
        call DisplayTimedTextToForce(GetPlayersAll(), 10.00, "TRIGSTR_340")
        call DisplayTimedTextToForce(GetPlayersAll(), 10.00, "TRIGSTR_351")
        call DisplayTimedTextToForce(GetPlayersAll(), 10.00, "TRIGSTR_352")
        call TriggerSleepAction(1.00)
        call DisplayTimedTextToForce(GetPlayersAll(), 10.00, "TRIGSTR_341")
        call DisplayTimedTextToForce(GetPlayersAll(), 10.00, "TRIGSTR_353")
        call DisplayTimedTextToForce(GetPlayersAll(), 10.00, "TRIGSTR_354")
        call TriggerSleepAction(1.00)
        call DisplayTimedTextToForce(GetPlayersAll(), 10.00, "TRIGSTR_342")
        call DisplayTimedTextToForce(GetPlayersAll(), 10.00, "TRIGSTR_343")
        call DisplayTimedTextToForce(GetPlayersAll(), 10.00, "TRIGSTR_346")
        call ForForce(udg_Heroes, function Trig_Frodo_dies_Func020002)
    endfunction

    //===========================================================================
    function InitTrig_Frodo_dies takes nothing returns nothing
        set gg_trg_Frodo_dies=CreateTrigger()
        call TriggerRegisterUnitEvent(gg_trg_Frodo_dies, gg_unit_HC05_0005, EVENT_UNIT_DEATH)
        call TriggerAddCondition(gg_trg_Frodo_dies, Condition(function Trig_Frodo_dies_Conditions))
        call TriggerAddAction(gg_trg_Frodo_dies, function Trig_Frodo_dies_Actions)
    endfunction

    //===========================================================================
    // Trigger: Cave Troll message
    //===========================================================================
    function Trig_Cave_Troll_message_Actions takes nothing returns nothing
        call DisplayTimedTextToForce(GetPlayersAll(), 15.00, "TRIGSTR_269")
        call TriggerSleepAction(2)
        call DisableTrigger(gg_trg_Cave_Troll_message)
    endfunction

    //===========================================================================
    function InitTrig_Cave_Troll_message takes nothing returns nothing
        set gg_trg_Cave_Troll_message=CreateTrigger()
        call TriggerRegisterUnitEvent(gg_trg_Cave_Troll_message, gg_unit_nC12_0022, EVENT_UNIT_DAMAGED)
        call TriggerAddAction(gg_trg_Cave_Troll_message, function Trig_Cave_Troll_message_Actions)
    endfunction

    //===========================================================================
    // Trigger: Cave Troll attacked
    //===========================================================================
    function Trig_Cave_Troll_attacked_Func002002 takes nothing returns nothing
        call PanCameraToTimedLocForPlayer(GetEnumPlayer(), GetRectCenter(gg_rct_Region_000), 0.50)
    endfunction

    function Trig_Cave_Troll_attacked_Func003002002 takes nothing returns nothing
        call SetUnitPositionLoc(GetEnumUnit(), GetRectCenter(gg_rct_Region_000))
    endfunction

    function Trig_Cave_Troll_attacked_Func003002 takes nothing returns nothing
        call ForGroupBJ(GetUnitsOfPlayerAll(GetEnumPlayer()), function Trig_Cave_Troll_attacked_Func003002002)
    endfunction

    function Trig_Cave_Troll_attacked_Func004002 takes nothing returns nothing
        call SetUnitPositionLoc(GetEnumUnit(), GetRectCenter(gg_rct_Region_004))
    endfunction

    function Trig_Cave_Troll_attacked_Func005002 takes nothing returns nothing
        call IssuePointOrderLocBJ(GetEnumUnit(), "attack", GetRandomLocInRect(gg_rct_Region_001))
    endfunction

    function Trig_Cave_Troll_attacked_Func007002 takes nothing returns nothing
        call IssuePointOrderLocBJ(GetEnumUnit(), "attack", GetRandomLocInRect(gg_rct_Region_004))
    endfunction

    function Trig_Cave_Troll_attacked_Func009002 takes nothing returns nothing
        call IssuePointOrderLocBJ(GetEnumUnit(), "attack", GetRandomLocInRect(gg_rct_Region_000))
    endfunction

    function Trig_Cave_Troll_attacked_Actions takes nothing returns nothing
        call PlaySoundBJ(gg_snd_TheHornOfCenarius)
        call ForForce(udg_Heroes, function Trig_Cave_Troll_attacked_Func002002)
        call ForForce(udg_Heroes, function Trig_Cave_Troll_attacked_Func003002)
        call ForGroupBJ(GetUnitsOfPlayerAndTypeId(Player(11), 'nC12'), function Trig_Cave_Troll_attacked_Func004002)
        call ForGroupBJ(GetUnitsOfPlayerAndTypeId(Player(11), 'nC12'), function Trig_Cave_Troll_attacked_Func005002)
        call CreateNUnitsAtLocFacingLocBJ(25, 'oC10', Player(11), GetRectCenter(gg_rct_Region_007), GetUnitLoc(GetTriggerUnit()))
        call ForGroupBJ(GetUnitsInRectOfPlayer(gg_rct_Region_007, Player(11)), function Trig_Cave_Troll_attacked_Func007002)
        call CreateNUnitsAtLocFacingLocBJ(25, 'oC10', Player(11), GetRectCenter(gg_rct_Region_013), GetUnitLoc(GetTriggerUnit()))
        call ForGroupBJ(GetUnitsInRectOfPlayer(gg_rct_Region_013, Player(11)), function Trig_Cave_Troll_attacked_Func009002)
        call CreateDestructableLoc('LTrc', GetRectCenter(gg_rct_Region_015), GetRandomDirectionDeg(), 3.00, 0)
        call SetDestructableInvulnerableBJ(GetLastCreatedDestructable(), true)
        call CreateDestructableLoc('LTrc', GetRectCenter(gg_rct_Region_015_Copy), GetRandomDirectionDeg(), 3.00, 0)
        call SetDestructableInvulnerableBJ(GetLastCreatedDestructable(), true)
        call CreateDestructableLoc('LTrc', GetRectCenter(gg_rct_Region_015_Copy_2), GetRandomDirectionDeg(), 3.00, 0)
        call SetDestructableInvulnerableBJ(GetLastCreatedDestructable(), true)
        call CreateDestructableLoc('LTrc', GetRectCenter(gg_rct_Region_015_Copy_3), GetRandomDirectionDeg(), 3.00, 0)
        call SetDestructableInvulnerableBJ(GetLastCreatedDestructable(), true)
        call CreateDestructableLoc('LTrc', GetRectCenter(gg_rct_Region_015_Copy_4), GetRandomDirectionDeg(), 3.00, 0)
        call SetDestructableInvulnerableBJ(GetLastCreatedDestructable(), true)
        call CreateDestructableLoc('LTrc', GetRectCenter(gg_rct_Region_015_Copy_6), GetRandomDirectionDeg(), 3.00, 0)
        call SetDestructableInvulnerableBJ(GetLastCreatedDestructable(), true)
        call CreateDestructableLoc('LTrc', GetRectCenter(gg_rct_Region_015_Copy_5), GetRandomDirectionDeg(), 3.00, 0)
        call SetDestructableInvulnerableBJ(GetLastCreatedDestructable(), true)
        call CreateNUnitsAtLoc(1, 'nC14', Player(PLAYER_NEUTRAL_PASSIVE), GetRectCenter(gg_rct_Region_022), bj_UNIT_FACING)
        call EnableTrigger(gg_trg_Deep_Respawning_Delay)
        call DisableTrigger(gg_trg_first_wave)
        call DisableTrigger(gg_trg_second_wave)
        call DisableTrigger(gg_trg_third_wave)
        call DisableTrigger(gg_trg_fourth_wave)
        call DisableTrigger(gg_trg_fifth_wave)
        call DisableTrigger(gg_trg_part_of_fifth_wave)
        call DisableTrigger(gg_trg_sixth_wave)
        call DisableTrigger(gg_trg_part_of_sixth_wave)
        call DisableTrigger(gg_trg_seventh_wave)
        call DisableTrigger(gg_trg_eigth_wave)
        call DisableTrigger(gg_trg_part_of_eight_wave)
        call DisableTrigger(gg_trg_Final_wave)
        call DisableTrigger(gg_trg_Cave_Troll_attacked)
    endfunction

    //===========================================================================
    function InitTrig_Cave_Troll_attacked takes nothing returns nothing
        set gg_trg_Cave_Troll_attacked=CreateTrigger()
        call TriggerRegisterUnitEvent(gg_trg_Cave_Troll_attacked, gg_unit_nC12_0022, EVENT_UNIT_DAMAGED)
        call TriggerAddAction(gg_trg_Cave_Troll_attacked, function Trig_Cave_Troll_attacked_Actions)
    endfunction

    //===========================================================================
    // Trigger: Deep Respawning Delay
    //===========================================================================
    function Trig_Deep_Respawning_Delay_Actions takes nothing returns nothing
        call TriggerSleepAction(30.00)
        call EnableTrigger(gg_trg_Deep_Respawning)
        call DisableTrigger(gg_trg_Deep_Respawning_Delay)
    endfunction

    //===========================================================================
    function InitTrig_Deep_Respawning_Delay takes nothing returns nothing
        set gg_trg_Deep_Respawning_Delay=CreateTrigger()
        call DisableTrigger(gg_trg_Deep_Respawning_Delay)
        call TriggerRegisterTimerEventPeriodic(gg_trg_Deep_Respawning_Delay, 2.00)
        call TriggerAddAction(gg_trg_Deep_Respawning_Delay, function Trig_Deep_Respawning_Delay_Actions)
    endfunction

    //===========================================================================
    // Trigger: Deep Respawning
    //===========================================================================
    function Trig_Deep_Respawning_Func004002 takes nothing returns nothing
        call IssuePointOrderLocBJ(GetEnumUnit(), "attack", GetRectCenter(gg_rct_Region_014))
    endfunction

    function Trig_Deep_Respawning_Actions takes nothing returns nothing
        call CreateNUnitsAtLoc(5, 'o000', Player(11), GetRectCenter(gg_rct_Region_007), bj_UNIT_FACING)
        call CreateNUnitsAtLoc(1, 'nC17', Player(11), GetRectCenter(gg_rct_Region_007), bj_UNIT_FACING)
        call CreateNUnitsAtLoc(2, 'n000', Player(11), GetRectCenter(gg_rct_Region_007), bj_UNIT_FACING)
        call ForGroupBJ(GetUnitsInRectOfPlayer(gg_rct_Region_007, Player(11)), function Trig_Deep_Respawning_Func004002)
    endfunction

    //===========================================================================
    function InitTrig_Deep_Respawning takes nothing returns nothing
        set gg_trg_Deep_Respawning=CreateTrigger()
        call DisableTrigger(gg_trg_Deep_Respawning)
        call TriggerRegisterTimerEventPeriodic(gg_trg_Deep_Respawning, 30.00)
        call TriggerAddAction(gg_trg_Deep_Respawning, function Trig_Deep_Respawning_Actions)
    endfunction

    //===========================================================================
    // Trigger: Uruk Hai Respawning
    //===========================================================================
    function Trig_Uruk_Hai_Respawning_Actions takes nothing returns nothing
        call CreateNUnitsAtLoc(20, 'nchg', Player(10), GetRectCenter(gg_rct_Region_011), bj_UNIT_FACING)
    endfunction

    //===========================================================================
    function InitTrig_Uruk_Hai_Respawning takes nothing returns nothing
        set gg_trg_Uruk_Hai_Respawning=CreateTrigger()
        call DisableTrigger(gg_trg_Uruk_Hai_Respawning)
        call TriggerRegisterTimerEventPeriodic(gg_trg_Uruk_Hai_Respawning, 45.00)
        call TriggerAddAction(gg_trg_Uruk_Hai_Respawning, function Trig_Uruk_Hai_Respawning_Actions)
    endfunction

    //===========================================================================
    // Trigger: Stop Uruk Hai Respawning
    //===========================================================================
    function Trig_Stop_Uruk_Hai_Respawning_Actions takes nothing returns nothing
        call DisableTrigger(gg_trg_Uruk_Hai_Respawning)
    endfunction

    //===========================================================================
    function InitTrig_Stop_Uruk_Hai_Respawning takes nothing returns nothing
        set gg_trg_Stop_Uruk_Hai_Respawning=CreateTrigger()
        call DisableTrigger(gg_trg_Stop_Uruk_Hai_Respawning)
        call TriggerRegisterUnitEvent(gg_trg_Stop_Uruk_Hai_Respawning, gg_unit_Opgh_0341, EVENT_UNIT_ATTACKED)
        call TriggerAddAction(gg_trg_Stop_Uruk_Hai_Respawning, function Trig_Stop_Uruk_Hai_Respawning_Actions)
    endfunction

    //===========================================================================
    // Trigger: Ent Eaters
    //===========================================================================
    function Trig_Ent_Eaters_Conditions takes nothing returns boolean
        if ( not ( CountLivingPlayerUnitsOfTypeId('nspr', Player(10)) < 27 ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Ent_Eaters_Func005002 takes nothing returns nothing
        call IssuePointOrderLocBJ(GetEnumUnit(), "attack", GetRectCenter(gg_rct_Region_011))
    endfunction

    function Trig_Ent_Eaters_Func006002 takes nothing returns nothing
        call IssuePointOrderLocBJ(GetEnumUnit(), "attack", GetRectCenter(gg_rct_Region_031))
    endfunction

    function Trig_Ent_Eaters_Func007002 takes nothing returns nothing
        call IssuePointOrderLocBJ(GetEnumUnit(), "attack", GetRectCenter(gg_rct_Region_011))
    endfunction

    function Trig_Ent_Eaters_Func008002 takes nothing returns nothing
        call IssuePointOrderLocBJ(GetEnumUnit(), "attack", GetRectCenter(gg_rct_Region_012))
    endfunction

    function Trig_Ent_Eaters_Actions takes nothing returns nothing
        call CreateNUnitsAtLoc(3, 'nspr', Player(10), GetRectCenter(gg_rct_Region_012), bj_UNIT_FACING)
        call CreateNUnitsAtLoc(3, 'nspr', Player(10), GetRectCenter(gg_rct_Region_030), bj_UNIT_FACING)
        call CreateNUnitsAtLoc(3, 'nspr', Player(10), GetRectCenter(gg_rct_Region_031), bj_UNIT_FACING)
        call ForGroupBJ(GetUnitsInRectOfPlayer(gg_rct_Region_012, Player(10)), function Trig_Ent_Eaters_Func005002)
        call ForGroupBJ(GetUnitsInRectOfPlayer(gg_rct_Region_011, Player(10)), function Trig_Ent_Eaters_Func006002)
        call ForGroupBJ(GetUnitsInRectOfPlayer(gg_rct_Region_030, Player(10)), function Trig_Ent_Eaters_Func007002)
        call ForGroupBJ(GetUnitsInRectOfPlayer(gg_rct_Region_031, Player(10)), function Trig_Ent_Eaters_Func008002)
    endfunction

    //===========================================================================
    function InitTrig_Ent_Eaters takes nothing returns nothing
        set gg_trg_Ent_Eaters=CreateTrigger()
        call DisableTrigger(gg_trg_Ent_Eaters)
        call TriggerRegisterTimerEventPeriodic(gg_trg_Ent_Eaters, 5.00)
        call TriggerAddCondition(gg_trg_Ent_Eaters, Condition(function Trig_Ent_Eaters_Conditions))
        call TriggerAddAction(gg_trg_Ent_Eaters, function Trig_Ent_Eaters_Actions)
    endfunction

    //===========================================================================
    // Trigger: first wave
    //===========================================================================
    function Trig_first_wave_Func002002 takes nothing returns nothing
        call IssuePointOrderLocBJ(GetEnumUnit(), "attack", GetRectCenter(gg_rct_Region_001))
    endfunction

    function Trig_first_wave_Actions takes nothing returns nothing
        call CreateNUnitsAtLocFacingLocBJ(10, 'uC09', Player(11), GetRectCenter(gg_rct_Region_000), GetUnitLoc(GetTriggerUnit()))
        call ForGroupBJ(GetUnitsInRectOfPlayer(gg_rct_Region_000, Player(11)), function Trig_first_wave_Func002002)
    endfunction

    //===========================================================================
    function InitTrig_first_wave takes nothing returns nothing
        set gg_trg_first_wave=CreateTrigger()
        call TriggerRegisterTimerEventSingle(gg_trg_first_wave, 45.00)
        call TriggerAddAction(gg_trg_first_wave, function Trig_first_wave_Actions)
    endfunction

    //===========================================================================
    // Trigger: second wave
    //===========================================================================
    function Trig_second_wave_Func003002 takes nothing returns nothing
        call IssuePointOrderLocBJ(GetEnumUnit(), "attack", GetRandomLocInRect(gg_rct_Region_001))
    endfunction

    function Trig_second_wave_Actions takes nothing returns nothing
        call CreateNUnitsAtLocFacingLocBJ(10, 'uC09', Player(11), GetRectCenter(gg_rct_Region_000), GetUnitLoc(GetTriggerUnit()))
        call CreateNUnitsAtLocFacingLocBJ(8, 'uC11', Player(11), GetRectCenter(gg_rct_Region_000), GetUnitLoc(GetTriggerUnit()))
        call ForGroupBJ(GetUnitsInRectOfPlayer(gg_rct_Region_000, Player(11)), function Trig_second_wave_Func003002)
    endfunction

    //===========================================================================
    function InitTrig_second_wave takes nothing returns nothing
        set gg_trg_second_wave=CreateTrigger()
        call TriggerRegisterTimerEventSingle(gg_trg_second_wave, 75.00)
        call TriggerAddAction(gg_trg_second_wave, function Trig_second_wave_Actions)
    endfunction

    //===========================================================================
    // Trigger: third wave
    //===========================================================================
    function Trig_third_wave_Func003002 takes nothing returns nothing
        call IssuePointOrderLocBJ(GetEnumUnit(), "attack", GetRectCenter(gg_rct_Region_001))
    endfunction

    function Trig_third_wave_Actions takes nothing returns nothing
        call CreateNUnitsAtLocFacingLocBJ(10, 'uC09', Player(11), GetRectCenter(gg_rct_Region_000), GetUnitLoc(GetTriggerUnit()))
        call CreateNUnitsAtLocFacingLocBJ(10, 'uC11', Player(11), GetRectCenter(gg_rct_Region_000), GetUnitLoc(GetTriggerUnit()))
        call ForGroupBJ(GetUnitsInRectOfPlayer(gg_rct_Region_000, Player(11)), function Trig_third_wave_Func003002)
    endfunction

    //===========================================================================
    function InitTrig_third_wave takes nothing returns nothing
        set gg_trg_third_wave=CreateTrigger()
        call TriggerRegisterTimerEventSingle(gg_trg_third_wave, 105.00)
        call TriggerAddAction(gg_trg_third_wave, function Trig_third_wave_Actions)
    endfunction

    //===========================================================================
    // Trigger: fourth wave
    //===========================================================================
    function Trig_fourth_wave_Func004002 takes nothing returns nothing
        call IssuePointOrderLocBJ(GetEnumUnit(), "attack", GetRectCenter(gg_rct_Region_001))
    endfunction

    function Trig_fourth_wave_Actions takes nothing returns nothing
        call CreateNUnitsAtLocFacingLocBJ(10, 'uC09', Player(11), GetRectCenter(gg_rct_Region_000), GetUnitLoc(GetTriggerUnit()))
        call CreateNUnitsAtLocFacingLocBJ(10, 'uC11', Player(11), GetRectCenter(gg_rct_Region_000), GetUnitLoc(GetTriggerUnit()))
        call CreateNUnitsAtLocFacingLocBJ(5, 'oC10', Player(11), GetRectCenter(gg_rct_Region_000), GetUnitLoc(GetTriggerUnit()))
        call ForGroupBJ(GetUnitsInRectOfPlayer(gg_rct_Region_000, Player(11)), function Trig_fourth_wave_Func004002)
    endfunction

    //===========================================================================
    function InitTrig_fourth_wave takes nothing returns nothing
        set gg_trg_fourth_wave=CreateTrigger()
        call TriggerRegisterTimerEventSingle(gg_trg_fourth_wave, 135.00)
        call TriggerAddAction(gg_trg_fourth_wave, function Trig_fourth_wave_Actions)
    endfunction

    //===========================================================================
    // Trigger: fifth wave
    //===========================================================================
    function Trig_fifth_wave_Func004002 takes nothing returns nothing
        call IssuePointOrderLocBJ(GetEnumUnit(), "attack", GetRectCenter(gg_rct_Region_001))
    endfunction

    function Trig_fifth_wave_Actions takes nothing returns nothing
        call CreateNUnitsAtLocFacingLocBJ(10, 'uC09', Player(11), GetRectCenter(gg_rct_Region_000), GetUnitLoc(GetTriggerUnit()))
        call CreateNUnitsAtLocFacingLocBJ(10, 'uC11', Player(11), GetRectCenter(gg_rct_Region_000), GetUnitLoc(GetTriggerUnit()))
        call CreateNUnitsAtLocFacingLocBJ(8, 'oC10', Player(11), GetRectCenter(gg_rct_Region_000), GetUnitLoc(GetTriggerUnit()))
        call ForGroupBJ(GetUnitsInRectOfPlayer(gg_rct_Region_000, Player(11)), function Trig_fifth_wave_Func004002)
    endfunction

    //===========================================================================
    function InitTrig_fifth_wave takes nothing returns nothing
        set gg_trg_fifth_wave=CreateTrigger()
        call TriggerRegisterTimerEventSingle(gg_trg_fifth_wave, 180.00)
        call TriggerAddAction(gg_trg_fifth_wave, function Trig_fifth_wave_Actions)
    endfunction

    //===========================================================================
    // Trigger: part of fifth wave
    //===========================================================================
    function Trig_part_of_fifth_wave_Func003002 takes nothing returns nothing
        call IssuePointOrderLocBJ(GetEnumUnit(), "attack", GetRectCenter(gg_rct_Region_003))
    endfunction

    function Trig_part_of_fifth_wave_Actions takes nothing returns nothing
        call CreateFogModifierRadiusLocBJ(true, Player(0), FOG_OF_WAR_VISIBLE, GetRectCenter(gg_rct_Region_002), 512)
        call CreateNUnitsAtLocFacingLocBJ(5, 'nC16', Player(11), GetRectCenter(gg_rct_Region_002), GetUnitLoc(GetTriggerUnit()))
        call ForGroupBJ(GetUnitsInRectOfPlayer(gg_rct_Region_002, Player(11)), function Trig_part_of_fifth_wave_Func003002)
    endfunction

    //===========================================================================
    function InitTrig_part_of_fifth_wave takes nothing returns nothing
        set gg_trg_part_of_fifth_wave=CreateTrigger()
        call TriggerRegisterTimerEventSingle(gg_trg_part_of_fifth_wave, 180.00)
        call TriggerAddAction(gg_trg_part_of_fifth_wave, function Trig_part_of_fifth_wave_Actions)
    endfunction

    //===========================================================================
    // Trigger: sixth wave
    //===========================================================================
    function Trig_sixth_wave_Func005002 takes nothing returns nothing
        call IssuePointOrderLocBJ(GetEnumUnit(), "attack", GetRectCenter(gg_rct_Region_001))
    endfunction

    function Trig_sixth_wave_Actions takes nothing returns nothing
        call CreateNUnitsAtLocFacingLocBJ(10, 'uC09', Player(11), GetRectCenter(gg_rct_Region_000), GetUnitLoc(GetTriggerUnit()))
        call CreateNUnitsAtLocFacingLocBJ(10, 'uC11', Player(11), GetRectCenter(gg_rct_Region_000), GetUnitLoc(GetTriggerUnit()))
        call CreateNUnitsAtLocFacingLocBJ(10, 'oC10', Player(11), GetRectCenter(gg_rct_Region_000), GetUnitLoc(GetTriggerUnit()))
        call CreateNUnitsAtLocFacingLocBJ(5, 'nC17', Player(11), GetRectCenter(gg_rct_Region_000), GetUnitLoc(GetTriggerUnit()))
        call ForGroupBJ(GetUnitsInRectOfPlayer(gg_rct_Region_000, Player(11)), function Trig_sixth_wave_Func005002)
    endfunction

    //===========================================================================
    function InitTrig_sixth_wave takes nothing returns nothing
        set gg_trg_sixth_wave=CreateTrigger()
        call TriggerRegisterTimerEventSingle(gg_trg_sixth_wave, 230.00)
        call TriggerAddAction(gg_trg_sixth_wave, function Trig_sixth_wave_Actions)
    endfunction

    //===========================================================================
    // Trigger: part of sixth wave
    //===========================================================================
    function Trig_part_of_sixth_wave_Func002002 takes nothing returns nothing
        call IssuePointOrderLocBJ(GetEnumUnit(), "attack", GetRectCenter(gg_rct_Region_003))
    endfunction

    function Trig_part_of_sixth_wave_Actions takes nothing returns nothing
        call CreateNUnitsAtLocFacingLocBJ(10, 'nC16', Player(11), GetRectCenter(gg_rct_Region_002), GetUnitLoc(GetTriggerUnit()))
        call ForGroupBJ(GetUnitsInRectOfPlayer(gg_rct_Region_002, Player(11)), function Trig_part_of_sixth_wave_Func002002)
    endfunction

    //===========================================================================
    function InitTrig_part_of_sixth_wave takes nothing returns nothing
        set gg_trg_part_of_sixth_wave=CreateTrigger()
        call TriggerRegisterTimerEventSingle(gg_trg_part_of_sixth_wave, 230.00)
        call TriggerAddAction(gg_trg_part_of_sixth_wave, function Trig_part_of_sixth_wave_Actions)
    endfunction

    //===========================================================================
    // Trigger: seventh wave
    //===========================================================================
    function Trig_seventh_wave_Func003002 takes nothing returns nothing
        call IssuePointOrderLocBJ(GetEnumUnit(), "attack", GetRectCenter(gg_rct_Region_001))
    endfunction

    function Trig_seventh_wave_Actions takes nothing returns nothing
        call CreateNUnitsAtLocFacingLocBJ(10, 'oC10', Player(11), GetRectCenter(gg_rct_Region_000), GetUnitLoc(GetTriggerUnit()))
        call CreateNUnitsAtLocFacingLocBJ(10, 'nC17', Player(11), GetRectCenter(gg_rct_Region_000), GetUnitLoc(GetTriggerUnit()))
        call ForGroupBJ(GetUnitsInRectOfPlayer(gg_rct_Region_000, Player(11)), function Trig_seventh_wave_Func003002)
    endfunction

    //===========================================================================
    function InitTrig_seventh_wave takes nothing returns nothing
        set gg_trg_seventh_wave=CreateTrigger()
        call TriggerRegisterTimerEventSingle(gg_trg_seventh_wave, 280.00)
        call TriggerAddAction(gg_trg_seventh_wave, function Trig_seventh_wave_Actions)
    endfunction

    //===========================================================================
    // Trigger: eigth wave
    //===========================================================================
    function Trig_eigth_wave_Func004002 takes nothing returns nothing
        call IssuePointOrderLocBJ(GetEnumUnit(), "attack", GetRectCenter(gg_rct_Region_001))
    endfunction

    function Trig_eigth_wave_Actions takes nothing returns nothing
        call CreateNUnitsAtLocFacingLocBJ(10, 'uC11', Player(11), GetRectCenter(gg_rct_Region_000), GetUnitLoc(GetTriggerUnit()))
        call CreateNUnitsAtLocFacingLocBJ(10, 'oC10', Player(11), GetRectCenter(gg_rct_Region_000), GetUnitLoc(GetTriggerUnit()))
        call CreateNUnitsAtLocFacingLocBJ(10, 'nC17', Player(11), GetRectCenter(gg_rct_Region_000), GetUnitLoc(GetTriggerUnit()))
        call ForGroupBJ(GetUnitsInRectOfPlayer(gg_rct_Region_000, Player(11)), function Trig_eigth_wave_Func004002)
    endfunction

    //===========================================================================
    function InitTrig_eigth_wave takes nothing returns nothing
        set gg_trg_eigth_wave=CreateTrigger()
        call TriggerRegisterTimerEventSingle(gg_trg_eigth_wave, 330.00)
        call TriggerAddAction(gg_trg_eigth_wave, function Trig_eigth_wave_Actions)
    endfunction

    //===========================================================================
    // Trigger: part of eight wave
    //===========================================================================
    function Trig_part_of_eight_wave_Func002002 takes nothing returns nothing
        call IssuePointOrderLocBJ(GetEnumUnit(), "attack", GetRectCenter(gg_rct_Region_003))
    endfunction

    function Trig_part_of_eight_wave_Actions takes nothing returns nothing
        call CreateNUnitsAtLocFacingLocBJ(15, 'nC16', Player(11), GetRectCenter(gg_rct_Region_002), GetUnitLoc(GetTriggerUnit()))
        call ForGroupBJ(GetUnitsInRectOfPlayer(gg_rct_Region_002, Player(11)), function Trig_part_of_eight_wave_Func002002)
    endfunction

    //===========================================================================
    function InitTrig_part_of_eight_wave takes nothing returns nothing
        set gg_trg_part_of_eight_wave=CreateTrigger()
        call TriggerRegisterTimerEventSingle(gg_trg_part_of_eight_wave, 330.00)
        call TriggerAddAction(gg_trg_part_of_eight_wave, function Trig_part_of_eight_wave_Actions)
    endfunction

    //===========================================================================
    // Trigger: Final wave
    //===========================================================================
    function Trig_Final_wave_Func002002 takes nothing returns nothing
        call IssuePointOrderLocBJ(GetEnumUnit(), "attack", GetRectCenter(gg_rct_Region_001))
    endfunction

    function Trig_Final_wave_Actions takes nothing returns nothing
        call CreateNUnitsAtLocFacingLocBJ(20, 'nC17', Player(11), GetRectCenter(gg_rct_Region_000), GetUnitLoc(GetTriggerUnit()))
        call ForGroupBJ(GetUnitsInRectOfPlayer(gg_rct_Region_000, Player(11)), function Trig_Final_wave_Func002002)
    endfunction

    //===========================================================================
    function InitTrig_Final_wave takes nothing returns nothing
        set gg_trg_Final_wave=CreateTrigger()
        call TriggerRegisterTimerEventSingle(gg_trg_Final_wave, 380.00)
        call TriggerAddAction(gg_trg_Final_wave, function Trig_Final_wave_Actions)
    endfunction

    //===========================================================================
    // Trigger: Isengard Uruk Hai Gold
    //===========================================================================
    function Trig_Isengard_Uruk_Hai_Gold_Conditions takes nothing returns boolean
        if ( not ( GetUnitTypeId(GetDyingUnit()) == 'nspr' ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Isengard_Uruk_Hai_Gold_Func001002 takes nothing returns nothing
        call AdjustPlayerStateBJ(50, GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD)
    endfunction

    function Trig_Isengard_Uruk_Hai_Gold_Actions takes nothing returns nothing
        call ForForce(udg_Heroes, function Trig_Isengard_Uruk_Hai_Gold_Func001002)
    endfunction

    //===========================================================================
    function InitTrig_Isengard_Uruk_Hai_Gold takes nothing returns nothing
        set gg_trg_Isengard_Uruk_Hai_Gold=CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(gg_trg_Isengard_Uruk_Hai_Gold, EVENT_PLAYER_UNIT_DEATH)
        call TriggerAddCondition(gg_trg_Isengard_Uruk_Hai_Gold, Condition(function Trig_Isengard_Uruk_Hai_Gold_Conditions))
        call TriggerAddAction(gg_trg_Isengard_Uruk_Hai_Gold, function Trig_Isengard_Uruk_Hai_Gold_Actions)
    endfunction

    //===========================================================================
    // Trigger: Uruk Hai Captain Gold
    //===========================================================================
    function Trig_Uruk_Hai_Captain_Gold_Conditions takes nothing returns boolean
        if ( not ( GetUnitTypeId(GetDyingUnit()) == 'Nbbc' ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Uruk_Hai_Captain_Gold_Func001002 takes nothing returns nothing
        call AdjustPlayerStateBJ(500, GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD)
    endfunction

    function Trig_Uruk_Hai_Captain_Gold_Actions takes nothing returns nothing
        call ForForce(udg_Heroes, function Trig_Uruk_Hai_Captain_Gold_Func001002)
    endfunction

    //===========================================================================
    function InitTrig_Uruk_Hai_Captain_Gold takes nothing returns nothing
        set gg_trg_Uruk_Hai_Captain_Gold=CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(gg_trg_Uruk_Hai_Captain_Gold, EVENT_PLAYER_UNIT_DEATH)
        call TriggerAddCondition(gg_trg_Uruk_Hai_Captain_Gold, Condition(function Trig_Uruk_Hai_Captain_Gold_Conditions))
        call TriggerAddAction(gg_trg_Uruk_Hai_Captain_Gold, function Trig_Uruk_Hai_Captain_Gold_Actions)
    endfunction

    //===========================================================================
    // Trigger: Saurons Chosen Gold
    //===========================================================================
    function Trig_Saurons_Chosen_Gold_Conditions takes nothing returns boolean
        if ( not ( GetUnitTypeId(GetDyingUnit()) == 'Opgh' ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Saurons_Chosen_Gold_Func001002 takes nothing returns nothing
        call AdjustPlayerStateBJ(2500, GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD)
    endfunction

    function Trig_Saurons_Chosen_Gold_Actions takes nothing returns nothing
        call ForForce(udg_Heroes, function Trig_Saurons_Chosen_Gold_Func001002)
    endfunction

    //===========================================================================
    function InitTrig_Saurons_Chosen_Gold takes nothing returns nothing
        set gg_trg_Saurons_Chosen_Gold=CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(gg_trg_Saurons_Chosen_Gold, EVENT_PLAYER_UNIT_DEATH)
        call TriggerAddCondition(gg_trg_Saurons_Chosen_Gold, Condition(function Trig_Saurons_Chosen_Gold_Conditions))
        call TriggerAddAction(gg_trg_Saurons_Chosen_Gold, function Trig_Saurons_Chosen_Gold_Actions)
    endfunction

    //===========================================================================
    // Trigger: Ringwraith Gold
    //===========================================================================
    function Trig_Ringwraith_Gold_Conditions takes nothing returns boolean
        if ( not ( GetUnitTypeId(GetDyingUnit()) == 'o003' ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Ringwraith_Gold_Func001002 takes nothing returns nothing
        call AdjustPlayerStateBJ(5000, GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD)
    endfunction

    function Trig_Ringwraith_Gold_Actions takes nothing returns nothing
        call ForForce(udg_Heroes, function Trig_Ringwraith_Gold_Func001002)
    endfunction

    //===========================================================================
    function InitTrig_Ringwraith_Gold takes nothing returns nothing
        set gg_trg_Ringwraith_Gold=CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(gg_trg_Ringwraith_Gold, EVENT_PLAYER_UNIT_DEATH)
        call TriggerAddCondition(gg_trg_Ringwraith_Gold, Condition(function Trig_Ringwraith_Gold_Conditions))
        call TriggerAddAction(gg_trg_Ringwraith_Gold, function Trig_Ringwraith_Gold_Actions)
    endfunction

    //===========================================================================
    // Trigger: Mordor Orc Gold
    //===========================================================================
    function Trig_Mordor_Orc_Gold_Conditions takes nothing returns boolean
        if ( not ( GetUnitTypeId(GetDyingUnit()) == 'o002' ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Mordor_Orc_Gold_Func001002 takes nothing returns nothing
        call AdjustPlayerStateBJ(1000, GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD)
    endfunction

    function Trig_Mordor_Orc_Gold_Actions takes nothing returns nothing
        call ForForce(udg_Heroes, function Trig_Mordor_Orc_Gold_Func001002)
    endfunction

    //===========================================================================
    function InitTrig_Mordor_Orc_Gold takes nothing returns nothing
        set gg_trg_Mordor_Orc_Gold=CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(gg_trg_Mordor_Orc_Gold, EVENT_PLAYER_UNIT_DEATH)
        call TriggerAddCondition(gg_trg_Mordor_Orc_Gold, Condition(function Trig_Mordor_Orc_Gold_Conditions))
        call TriggerAddAction(gg_trg_Mordor_Orc_Gold, function Trig_Mordor_Orc_Gold_Actions)
    endfunction

    //===========================================================================
    // Trigger: Savage Orc Gold
    //===========================================================================
    function Trig_Savage_Orc_Gold_Conditions takes nothing returns boolean
        if ( not ( GetUnitTypeId(GetDyingUnit()) == 'nC20' ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Savage_Orc_Gold_Func001002 takes nothing returns nothing
        call AdjustPlayerStateBJ(125, GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD)
    endfunction

    function Trig_Savage_Orc_Gold_Actions takes nothing returns nothing
        call ForForce(udg_Heroes, function Trig_Savage_Orc_Gold_Func001002)
    endfunction

    //===========================================================================
    function InitTrig_Savage_Orc_Gold takes nothing returns nothing
        set gg_trg_Savage_Orc_Gold=CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(gg_trg_Savage_Orc_Gold, EVENT_PLAYER_UNIT_DEATH)
        call TriggerAddCondition(gg_trg_Savage_Orc_Gold, Condition(function Trig_Savage_Orc_Gold_Conditions))
        call TriggerAddAction(gg_trg_Savage_Orc_Gold, function Trig_Savage_Orc_Gold_Actions)
    endfunction

    //===========================================================================
    // Trigger: Warg Rider Gold
    //===========================================================================
    function Trig_Warg_Rider_Gold_Conditions takes nothing returns boolean
        if ( not ( GetUnitTypeId(GetDyingUnit()) == 'nchr' ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Warg_Rider_Gold_Func001002 takes nothing returns nothing
        call AdjustPlayerStateBJ(5000, GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD)
    endfunction

    function Trig_Warg_Rider_Gold_Actions takes nothing returns nothing
        call ForForce(udg_Heroes, function Trig_Warg_Rider_Gold_Func001002)
    endfunction

    //===========================================================================
    function InitTrig_Warg_Rider_Gold takes nothing returns nothing
        set gg_trg_Warg_Rider_Gold=CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(gg_trg_Warg_Rider_Gold, EVENT_PLAYER_UNIT_DEATH)
        call TriggerAddCondition(gg_trg_Warg_Rider_Gold, Condition(function Trig_Warg_Rider_Gold_Conditions))
        call TriggerAddAction(gg_trg_Warg_Rider_Gold, function Trig_Warg_Rider_Gold_Actions)
    endfunction

    //===========================================================================
    // Trigger: Saurons Speaker Gold
    //===========================================================================
    function Trig_Saurons_Speaker_Gold_Conditions takes nothing returns boolean
        if ( not ( GetUnitTypeId(GetDyingUnit()) == 'nchw' ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Saurons_Speaker_Gold_Func001002 takes nothing returns nothing
        call AdjustPlayerStateBJ(1000, GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD)
    endfunction

    function Trig_Saurons_Speaker_Gold_Actions takes nothing returns nothing
        call ForForce(udg_Heroes, function Trig_Saurons_Speaker_Gold_Func001002)
    endfunction

    //===========================================================================
    function InitTrig_Saurons_Speaker_Gold takes nothing returns nothing
        set gg_trg_Saurons_Speaker_Gold=CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(gg_trg_Saurons_Speaker_Gold, EVENT_PLAYER_UNIT_DEATH)
        call TriggerAddCondition(gg_trg_Saurons_Speaker_Gold, Condition(function Trig_Saurons_Speaker_Gold_Conditions))
        call TriggerAddAction(gg_trg_Saurons_Speaker_Gold, function Trig_Saurons_Speaker_Gold_Actions)
    endfunction

    //===========================================================================
    // Trigger: Uruk Hai Gold
    //===========================================================================
    function Trig_Uruk_Hai_Gold_Conditions takes nothing returns boolean
        if ( not ( GetUnitTypeId(GetDyingUnit()) == 'nchg' ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Uruk_Hai_Gold_Func001002 takes nothing returns nothing
        call AdjustPlayerStateBJ(250, GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD)
    endfunction

    function Trig_Uruk_Hai_Gold_Actions takes nothing returns nothing
        call ForForce(udg_Heroes, function Trig_Uruk_Hai_Gold_Func001002)
    endfunction

    //===========================================================================
    function InitTrig_Uruk_Hai_Gold takes nothing returns nothing
        set gg_trg_Uruk_Hai_Gold=CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(gg_trg_Uruk_Hai_Gold, EVENT_PLAYER_UNIT_DEATH)
        call TriggerAddCondition(gg_trg_Uruk_Hai_Gold, Condition(function Trig_Uruk_Hai_Gold_Conditions))
        call TriggerAddAction(gg_trg_Uruk_Hai_Gold, function Trig_Uruk_Hai_Gold_Actions)
    endfunction

    //===========================================================================
    // Trigger: Deep Orc Gold
    //===========================================================================
    function Trig_Deep_Orc_Gold_Conditions takes nothing returns boolean
        if ( not ( GetUnitTypeId(GetDyingUnit()) == 'o000' ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Deep_Orc_Gold_Func001002 takes nothing returns nothing
        call AdjustPlayerStateBJ(125, GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD)
    endfunction

    function Trig_Deep_Orc_Gold_Actions takes nothing returns nothing
        call ForForce(udg_Heroes, function Trig_Deep_Orc_Gold_Func001002)
    endfunction

    //===========================================================================
    function InitTrig_Deep_Orc_Gold takes nothing returns nothing
        set gg_trg_Deep_Orc_Gold=CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(gg_trg_Deep_Orc_Gold, EVENT_PLAYER_UNIT_DEATH)
        call TriggerAddCondition(gg_trg_Deep_Orc_Gold, Condition(function Trig_Deep_Orc_Gold_Conditions))
        call TriggerAddAction(gg_trg_Deep_Orc_Gold, function Trig_Deep_Orc_Gold_Actions)
    endfunction

    //===========================================================================
    // Trigger: Deep Cave Troll Gold
    //===========================================================================
    function Trig_Deep_Cave_Troll_Gold_Conditions takes nothing returns boolean
        if ( not ( GetUnitTypeId(GetDyingUnit()) == 'n000' ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Deep_Cave_Troll_Gold_Func001002 takes nothing returns nothing
        call AdjustPlayerStateBJ(250, GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD)
    endfunction

    function Trig_Deep_Cave_Troll_Gold_Actions takes nothing returns nothing
        call ForForce(udg_Heroes, function Trig_Deep_Cave_Troll_Gold_Func001002)
    endfunction

    //===========================================================================
    function InitTrig_Deep_Cave_Troll_Gold takes nothing returns nothing
        set gg_trg_Deep_Cave_Troll_Gold=CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(gg_trg_Deep_Cave_Troll_Gold, EVENT_PLAYER_UNIT_DEATH)
        call TriggerAddCondition(gg_trg_Deep_Cave_Troll_Gold, Condition(function Trig_Deep_Cave_Troll_Gold_Conditions))
        call TriggerAddAction(gg_trg_Deep_Cave_Troll_Gold, function Trig_Deep_Cave_Troll_Gold_Actions)
    endfunction

    //===========================================================================
    // Trigger: Cave Troll Gold
    //===========================================================================
    function Trig_Cave_Troll_Gold_Conditions takes nothing returns boolean
        if ( not ( GetUnitTypeId(GetDyingUnit()) == 'nC12' ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Cave_Troll_Gold_Func001002 takes nothing returns nothing
        call AdjustPlayerStateBJ(1000, GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD)
    endfunction

    function Trig_Cave_Troll_Gold_Actions takes nothing returns nothing
        call ForForce(udg_Heroes, function Trig_Cave_Troll_Gold_Func001002)
    endfunction

    //===========================================================================
    function InitTrig_Cave_Troll_Gold takes nothing returns nothing
        set gg_trg_Cave_Troll_Gold=CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(gg_trg_Cave_Troll_Gold, EVENT_PLAYER_UNIT_DEATH)
        call TriggerAddCondition(gg_trg_Cave_Troll_Gold, Condition(function Trig_Cave_Troll_Gold_Conditions))
        call TriggerAddAction(gg_trg_Cave_Troll_Gold, function Trig_Cave_Troll_Gold_Actions)
    endfunction

    //===========================================================================
    // Trigger: Goblin Commander Gold
    //===========================================================================
    function Trig_Goblin_Commander_Gold_Conditions takes nothing returns boolean
        if ( not ( GetUnitTypeId(GetDyingUnit()) == 'nC17' ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Goblin_Commander_Gold_Func001002 takes nothing returns nothing
        call AdjustPlayerStateBJ(50, GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD)
    endfunction

    function Trig_Goblin_Commander_Gold_Actions takes nothing returns nothing
        call ForForce(udg_Heroes, function Trig_Goblin_Commander_Gold_Func001002)
    endfunction

    //===========================================================================
    function InitTrig_Goblin_Commander_Gold takes nothing returns nothing
        set gg_trg_Goblin_Commander_Gold=CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(gg_trg_Goblin_Commander_Gold, EVENT_PLAYER_UNIT_DEATH)
        call TriggerAddCondition(gg_trg_Goblin_Commander_Gold, Condition(function Trig_Goblin_Commander_Gold_Conditions))
        call TriggerAddAction(gg_trg_Goblin_Commander_Gold, function Trig_Goblin_Commander_Gold_Actions)
    endfunction

    //===========================================================================
    // Trigger: Goblin Archer Gold
    //===========================================================================
    function Trig_Goblin_Archer_Gold_Conditions takes nothing returns boolean
        if ( not ( GetUnitTypeId(GetDyingUnit()) == 'nC16' ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Goblin_Archer_Gold_Func001002 takes nothing returns nothing
        call AdjustPlayerStateBJ(50, GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD)
    endfunction

    function Trig_Goblin_Archer_Gold_Actions takes nothing returns nothing
        call ForForce(udg_Heroes, function Trig_Goblin_Archer_Gold_Func001002)
    endfunction

    //===========================================================================
    function InitTrig_Goblin_Archer_Gold takes nothing returns nothing
        set gg_trg_Goblin_Archer_Gold=CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(gg_trg_Goblin_Archer_Gold, EVENT_PLAYER_UNIT_DEATH)
        call TriggerAddCondition(gg_trg_Goblin_Archer_Gold, Condition(function Trig_Goblin_Archer_Gold_Conditions))
        call TriggerAddAction(gg_trg_Goblin_Archer_Gold, function Trig_Goblin_Archer_Gold_Actions)
    endfunction

    //===========================================================================
    // Trigger: Goblin 1 Gold
    //===========================================================================
    function Trig_Goblin_1_Gold_Conditions takes nothing returns boolean
        if ( not ( GetUnitTypeId(GetDyingUnit()) == 'uC11' ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Goblin_1_Gold_Func001002 takes nothing returns nothing
        call AdjustPlayerStateBJ(10, GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD)
    endfunction

    function Trig_Goblin_1_Gold_Actions takes nothing returns nothing
        call ForForce(udg_Heroes, function Trig_Goblin_1_Gold_Func001002)
    endfunction

    //===========================================================================
    function InitTrig_Goblin_1_Gold takes nothing returns nothing
        set gg_trg_Goblin_1_Gold=CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(gg_trg_Goblin_1_Gold, EVENT_PLAYER_UNIT_DEATH)
        call TriggerAddCondition(gg_trg_Goblin_1_Gold, Condition(function Trig_Goblin_1_Gold_Conditions))
        call TriggerAddAction(gg_trg_Goblin_1_Gold, function Trig_Goblin_1_Gold_Actions)
    endfunction

    //===========================================================================
    // Trigger: Goblin 2 Gold
    //===========================================================================
    function Trig_Goblin_2_Gold_Conditions takes nothing returns boolean
        if ( not ( GetUnitTypeId(GetDyingUnit()) == 'uC09' ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Goblin_2_Gold_Func001002 takes nothing returns nothing
        call AdjustPlayerStateBJ(10, GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD)
    endfunction

    function Trig_Goblin_2_Gold_Actions takes nothing returns nothing
        call ForForce(udg_Heroes, function Trig_Goblin_2_Gold_Func001002)
    endfunction

    //===========================================================================
    function InitTrig_Goblin_2_Gold takes nothing returns nothing
        set gg_trg_Goblin_2_Gold=CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(gg_trg_Goblin_2_Gold, EVENT_PLAYER_UNIT_DEATH)
        call TriggerAddCondition(gg_trg_Goblin_2_Gold, Condition(function Trig_Goblin_2_Gold_Conditions))
        call TriggerAddAction(gg_trg_Goblin_2_Gold, function Trig_Goblin_2_Gold_Actions)
    endfunction

    //===========================================================================
    // Trigger: Orc Gold
    //===========================================================================
    function Trig_Orc_Gold_Conditions takes nothing returns boolean
        if ( not ( GetUnitTypeId(GetDyingUnit()) == 'oC10' ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Orc_Gold_Func001002 takes nothing returns nothing
        call AdjustPlayerStateBJ(25, GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD)
    endfunction

    function Trig_Orc_Gold_Actions takes nothing returns nothing
        call ForForce(udg_Heroes, function Trig_Orc_Gold_Func001002)
    endfunction

    //===========================================================================
    function InitTrig_Orc_Gold takes nothing returns nothing
        set gg_trg_Orc_Gold=CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(gg_trg_Orc_Gold, EVENT_PLAYER_UNIT_DEATH)
        call TriggerAddCondition(gg_trg_Orc_Gold, Condition(function Trig_Orc_Gold_Conditions))
        call TriggerAddAction(gg_trg_Orc_Gold, function Trig_Orc_Gold_Actions)
    endfunction

    //===========================================================================
    // Trigger: Red
    //===========================================================================
    function Trig_Red_Actions takes nothing returns nothing
        call ShareEverythingWithTeam(Player(0))
    endfunction

    //===========================================================================
    function InitTrig_Red takes nothing returns nothing
        set gg_trg_Red=CreateTrigger()
        call TriggerRegisterPlayerEventLeave(gg_trg_Red, Player(0))
        call TriggerAddAction(gg_trg_Red, function Trig_Red_Actions)
    endfunction

    //===========================================================================
    // Trigger: Blue
    //===========================================================================
    function Trig_Blue_Actions takes nothing returns nothing
        call ShareEverythingWithTeam(Player(1))
    endfunction

    //===========================================================================
    function InitTrig_Blue takes nothing returns nothing
        set gg_trg_Blue=CreateTrigger()
        call TriggerRegisterPlayerEventLeave(gg_trg_Blue, Player(1))
        call TriggerAddAction(gg_trg_Blue, function Trig_Blue_Actions)
    endfunction

    //===========================================================================
    // Trigger: Teal
    //===========================================================================
    function Trig_Teal_Actions takes nothing returns nothing
        call ShareEverythingWithTeam(Player(2))
    endfunction

    //===========================================================================
    function InitTrig_Teal takes nothing returns nothing
        set gg_trg_Teal=CreateTrigger()
        call TriggerRegisterPlayerEventLeave(gg_trg_Teal, Player(2))
        call TriggerAddAction(gg_trg_Teal, function Trig_Teal_Actions)
    endfunction

    //===========================================================================
    // Trigger: Purple
    //===========================================================================
    function Trig_Purple_Actions takes nothing returns nothing
        call KillUnit(gg_unit_HC05_0005)
    endfunction

    //===========================================================================
    function InitTrig_Purple takes nothing returns nothing
        set gg_trg_Purple=CreateTrigger()
        call TriggerRegisterPlayerEventLeave(gg_trg_Purple, Player(3))
        call TriggerAddAction(gg_trg_Purple, function Trig_Purple_Actions)
    endfunction

    //===========================================================================
    // Trigger: Yellow
    //===========================================================================
    function Trig_Yellow_Actions takes nothing returns nothing
        call ShareEverythingWithTeam(Player(4))
    endfunction

    //===========================================================================
    function InitTrig_Yellow takes nothing returns nothing
        set gg_trg_Yellow=CreateTrigger()
        call TriggerRegisterPlayerEventLeave(gg_trg_Yellow, Player(4))
        call TriggerAddAction(gg_trg_Yellow, function Trig_Yellow_Actions)
    endfunction

    //===========================================================================
    // Trigger: Orange
    //===========================================================================
    function Trig_Orange_Actions takes nothing returns nothing
        call ShareEverythingWithTeam(Player(5))
    endfunction

    //===========================================================================
    function InitTrig_Orange takes nothing returns nothing
        set gg_trg_Orange=CreateTrigger()
        call TriggerRegisterPlayerEventLeave(gg_trg_Orange, Player(5))
        call TriggerAddAction(gg_trg_Orange, function Trig_Orange_Actions)
    endfunction

    //===========================================================================
    // Trigger: Green
    //===========================================================================
    function Trig_Green_Actions takes nothing returns nothing
        call ShareEverythingWithTeam(Player(6))
    endfunction

    //===========================================================================
    function InitTrig_Green takes nothing returns nothing
        set gg_trg_Green=CreateTrigger()
        call TriggerRegisterPlayerEventLeave(gg_trg_Green, Player(6))
        call TriggerAddAction(gg_trg_Green, function Trig_Green_Actions)
    endfunction

    //===========================================================================
    // Trigger: Gray
    //===========================================================================
    function Trig_Gray_Actions takes nothing returns nothing
        call ShareEverythingWithTeam(Player(8))
    endfunction

    //===========================================================================
    function InitTrig_Gray takes nothing returns nothing
        set gg_trg_Gray=CreateTrigger()
        call TriggerRegisterPlayerEventLeave(gg_trg_Gray, Player(8))
        call TriggerAddAction(gg_trg_Gray, function Trig_Gray_Actions)
    endfunction

    //===========================================================================
    // Trigger: Light Blue
    //===========================================================================
    function Trig_Light_Blue_Actions takes nothing returns nothing
        call ShareEverythingWithTeam(Player(9))
    endfunction

    //===========================================================================
    function InitTrig_Light_Blue takes nothing returns nothing
        set gg_trg_Light_Blue=CreateTrigger()
        call TriggerRegisterPlayerEventLeave(gg_trg_Light_Blue, Player(9))
        call TriggerAddAction(gg_trg_Light_Blue, function Trig_Light_Blue_Actions)
    endfunction

    //===========================================================================
    function InitCustomTriggers takes nothing returns nothing
        call InitTrig_Item_Cleanup()
        call InitTrig_Solo()
        call InitTrig_Initialize()
        call InitTrig_Easy_Mode()
        call InitTrig_Orc_Leader_Message()
        call InitTrig_Mouth_of_Sauron_Dies()
        call InitTrig_Orthanc_Dies()
        call InitTrig_Shelob_Dies()
        call InitTrig_Ring_Destroyed()
        call InitTrig_Uruk_Hai_Spawn()
        call InitTrig_Halfway_to_Balrog()
        call InitTrig_Enter_Balrogs_Lair()
        call InitTrig_Balrog_Attacked()
        call InitTrig_Grom_Dies()
        call InitTrig_Balrog_Dies()
        call InitTrig_Mountain_Cave()
        call InitTrig_Mountain_Cave_Merry()
        call InitTrig_Gandalf_Dies()
        call InitTrig_Frodo_dies()
        call InitTrig_Cave_Troll_message()
        call InitTrig_Cave_Troll_attacked()
        call InitTrig_Deep_Respawning_Delay()
        call InitTrig_Deep_Respawning()
        call InitTrig_Uruk_Hai_Respawning()
        call InitTrig_Stop_Uruk_Hai_Respawning()
        call InitTrig_Ent_Eaters()
        call InitTrig_first_wave()
        call InitTrig_second_wave()
        call InitTrig_third_wave()
        call InitTrig_fourth_wave()
        call InitTrig_fifth_wave()
        call InitTrig_part_of_fifth_wave()
        call InitTrig_sixth_wave()
        call InitTrig_part_of_sixth_wave()
        call InitTrig_seventh_wave()
        call InitTrig_eigth_wave()
        call InitTrig_part_of_eight_wave()
        call InitTrig_Final_wave()
        call InitTrig_Isengard_Uruk_Hai_Gold()
        call InitTrig_Uruk_Hai_Captain_Gold()
        call InitTrig_Saurons_Chosen_Gold()
        call InitTrig_Ringwraith_Gold()
        call InitTrig_Mordor_Orc_Gold()
        call InitTrig_Savage_Orc_Gold()
        call InitTrig_Warg_Rider_Gold()
        call InitTrig_Saurons_Speaker_Gold()
        call InitTrig_Uruk_Hai_Gold()
        call InitTrig_Deep_Orc_Gold()
        call InitTrig_Deep_Cave_Troll_Gold()
        call InitTrig_Cave_Troll_Gold()
        call InitTrig_Goblin_Commander_Gold()
        call InitTrig_Goblin_Archer_Gold()
        call InitTrig_Goblin_1_Gold()
        call InitTrig_Goblin_2_Gold()
        call InitTrig_Orc_Gold()
        call InitTrig_Red()
        call InitTrig_Blue()
        call InitTrig_Teal()
        call InitTrig_Purple()
        call InitTrig_Yellow()
        call InitTrig_Orange()
        call InitTrig_Green()
        call InitTrig_Gray()
        call InitTrig_Light_Blue()
    endfunction

    //===========================================================================
    function RunInitializationTriggers takes nothing returns nothing
        call ConditionalTriggerExecute(gg_trg_Initialize)
    endfunction

    //***************************************************************************
    //*
    //*  Upgrades
    //*
    //***************************************************************************

    function InitUpgrades_Player10 takes nothing returns nothing
        call SetPlayerTechResearched(Player(10), 'Rhla', 3)
    endfunction

    function InitUpgrades_Player11 takes nothing returns nothing
        call SetPlayerTechResearched(Player(11), 'Rosp', 3)
    endfunction

    function InitUpgrades takes nothing returns nothing
        call SetPlayerTechResearched(Player(10), 'Rhla', 3) // INLINED!!
        call SetPlayerTechResearched(Player(11), 'Rosp', 3) // INLINED!!
    endfunction

    //***************************************************************************
    //*
    //*  Players
    //*
    //***************************************************************************

    function InitCustomPlayerSlots takes nothing returns nothing

        // Player 0
        call SetPlayerStartLocation(Player(0), 0)
        call ForcePlayerStartLocation(Player(0), 0)
        call SetPlayerColor(Player(0), ConvertPlayerColor(0))
        call SetPlayerRacePreference(Player(0), RACE_PREF_HUMAN)
        call SetPlayerRaceSelectable(Player(0), false)
        call SetPlayerController(Player(0), MAP_CONTROL_USER)

        // Player 1
        call SetPlayerStartLocation(Player(1), 1)
        call ForcePlayerStartLocation(Player(1), 1)
        call SetPlayerColor(Player(1), ConvertPlayerColor(1))
        call SetPlayerRacePreference(Player(1), RACE_PREF_HUMAN)
        call SetPlayerRaceSelectable(Player(1), false)
        call SetPlayerController(Player(1), MAP_CONTROL_USER)

        // Player 2
        call SetPlayerStartLocation(Player(2), 2)
        call ForcePlayerStartLocation(Player(2), 2)
        call SetPlayerColor(Player(2), ConvertPlayerColor(2))
        call SetPlayerRacePreference(Player(2), RACE_PREF_HUMAN)
        call SetPlayerRaceSelectable(Player(2), false)
        call SetPlayerController(Player(2), MAP_CONTROL_USER)

        // Player 3
        call SetPlayerStartLocation(Player(3), 3)
        call ForcePlayerStartLocation(Player(3), 3)
        call SetPlayerColor(Player(3), ConvertPlayerColor(3))
        call SetPlayerRacePreference(Player(3), RACE_PREF_HUMAN)
        call SetPlayerRaceSelectable(Player(3), false)
        call SetPlayerController(Player(3), MAP_CONTROL_USER)

        // Player 4
        call SetPlayerStartLocation(Player(4), 4)
        call ForcePlayerStartLocation(Player(4), 4)
        call SetPlayerColor(Player(4), ConvertPlayerColor(4))
        call SetPlayerRacePreference(Player(4), RACE_PREF_HUMAN)
        call SetPlayerRaceSelectable(Player(4), false)
        call SetPlayerController(Player(4), MAP_CONTROL_USER)

        // Player 5
        call SetPlayerStartLocation(Player(5), 5)
        call ForcePlayerStartLocation(Player(5), 5)
        call SetPlayerColor(Player(5), ConvertPlayerColor(5))
        call SetPlayerRacePreference(Player(5), RACE_PREF_HUMAN)
        call SetPlayerRaceSelectable(Player(5), false)
        call SetPlayerController(Player(5), MAP_CONTROL_USER)

        // Player 6
        call SetPlayerStartLocation(Player(6), 6)
        call ForcePlayerStartLocation(Player(6), 6)
        call SetPlayerColor(Player(6), ConvertPlayerColor(6))
        call SetPlayerRacePreference(Player(6), RACE_PREF_NIGHTELF)
        call SetPlayerRaceSelectable(Player(6), false)
        call SetPlayerController(Player(6), MAP_CONTROL_USER)

        // Player 8
        call SetPlayerStartLocation(Player(8), 7)
        call ForcePlayerStartLocation(Player(8), 7)
        call SetPlayerColor(Player(8), ConvertPlayerColor(8))
        call SetPlayerRacePreference(Player(8), RACE_PREF_HUMAN)
        call SetPlayerRaceSelectable(Player(8), false)
        call SetPlayerController(Player(8), MAP_CONTROL_USER)

        // Player 9
        call SetPlayerStartLocation(Player(9), 8)
        call ForcePlayerStartLocation(Player(9), 8)
        call SetPlayerColor(Player(9), ConvertPlayerColor(9))
        call SetPlayerRacePreference(Player(9), RACE_PREF_HUMAN)
        call SetPlayerRaceSelectable(Player(9), false)
        call SetPlayerController(Player(9), MAP_CONTROL_USER)

        // Player 10
        call SetPlayerStartLocation(Player(10), 9)
        call ForcePlayerStartLocation(Player(10), 9)
        call SetPlayerColor(Player(10), ConvertPlayerColor(10))
        call SetPlayerRacePreference(Player(10), RACE_PREF_UNDEAD)
        call SetPlayerRaceSelectable(Player(10), false)
        call SetPlayerController(Player(10), MAP_CONTROL_COMPUTER)

        // Player 11
        call SetPlayerStartLocation(Player(11), 10)
        call ForcePlayerStartLocation(Player(11), 10)
        call SetPlayerColor(Player(11), ConvertPlayerColor(11))
        call SetPlayerRacePreference(Player(11), RACE_PREF_ORC)
        call SetPlayerRaceSelectable(Player(11), false)
        call SetPlayerController(Player(11), MAP_CONTROL_COMPUTER)

    endfunction

    function InitCustomTeams takes nothing returns nothing
        // Force: TRIGSTR_006
        call SetPlayerTeam(Player(0), 0)
        call SetPlayerState(Player(0), PLAYER_STATE_ALLIED_VICTORY, 1)
        call SetPlayerTeam(Player(1), 0)
        call SetPlayerState(Player(1), PLAYER_STATE_ALLIED_VICTORY, 1)
        call SetPlayerTeam(Player(2), 0)
        call SetPlayerState(Player(2), PLAYER_STATE_ALLIED_VICTORY, 1)
        call SetPlayerTeam(Player(3), 0)
        call SetPlayerState(Player(3), PLAYER_STATE_ALLIED_VICTORY, 1)
        call SetPlayerTeam(Player(4), 0)
        call SetPlayerState(Player(4), PLAYER_STATE_ALLIED_VICTORY, 1)
        call SetPlayerTeam(Player(5), 0)
        call SetPlayerState(Player(5), PLAYER_STATE_ALLIED_VICTORY, 1)
        call SetPlayerTeam(Player(6), 0)
        call SetPlayerState(Player(6), PLAYER_STATE_ALLIED_VICTORY, 1)
        call SetPlayerTeam(Player(8), 0)
        call SetPlayerState(Player(8), PLAYER_STATE_ALLIED_VICTORY, 1)
        call SetPlayerTeam(Player(9), 0)
        call SetPlayerState(Player(9), PLAYER_STATE_ALLIED_VICTORY, 1)

        //   Allied
        call SetPlayerAllianceStateAllyBJ(Player(0), Player(1), true)
        call SetPlayerAllianceStateAllyBJ(Player(0), Player(2), true)
        call SetPlayerAllianceStateAllyBJ(Player(0), Player(3), true)
        call SetPlayerAllianceStateAllyBJ(Player(0), Player(4), true)
        call SetPlayerAllianceStateAllyBJ(Player(0), Player(5), true)
        call SetPlayerAllianceStateAllyBJ(Player(0), Player(6), true)
        call SetPlayerAllianceStateAllyBJ(Player(0), Player(8), true)
        call SetPlayerAllianceStateAllyBJ(Player(0), Player(9), true)
        call SetPlayerAllianceStateAllyBJ(Player(1), Player(0), true)
        call SetPlayerAllianceStateAllyBJ(Player(1), Player(2), true)
        call SetPlayerAllianceStateAllyBJ(Player(1), Player(3), true)
        call SetPlayerAllianceStateAllyBJ(Player(1), Player(4), true)
        call SetPlayerAllianceStateAllyBJ(Player(1), Player(5), true)
        call SetPlayerAllianceStateAllyBJ(Player(1), Player(6), true)
        call SetPlayerAllianceStateAllyBJ(Player(1), Player(8), true)
        call SetPlayerAllianceStateAllyBJ(Player(1), Player(9), true)
        call SetPlayerAllianceStateAllyBJ(Player(2), Player(0), true)
        call SetPlayerAllianceStateAllyBJ(Player(2), Player(1), true)
        call SetPlayerAllianceStateAllyBJ(Player(2), Player(3), true)
        call SetPlayerAllianceStateAllyBJ(Player(2), Player(4), true)
        call SetPlayerAllianceStateAllyBJ(Player(2), Player(5), true)
        call SetPlayerAllianceStateAllyBJ(Player(2), Player(6), true)
        call SetPlayerAllianceStateAllyBJ(Player(2), Player(8), true)
        call SetPlayerAllianceStateAllyBJ(Player(2), Player(9), true)
        call SetPlayerAllianceStateAllyBJ(Player(3), Player(0), true)
        call SetPlayerAllianceStateAllyBJ(Player(3), Player(1), true)
        call SetPlayerAllianceStateAllyBJ(Player(3), Player(2), true)
        call SetPlayerAllianceStateAllyBJ(Player(3), Player(4), true)
        call SetPlayerAllianceStateAllyBJ(Player(3), Player(5), true)
        call SetPlayerAllianceStateAllyBJ(Player(3), Player(6), true)
        call SetPlayerAllianceStateAllyBJ(Player(3), Player(8), true)
        call SetPlayerAllianceStateAllyBJ(Player(3), Player(9), true)
        call SetPlayerAllianceStateAllyBJ(Player(4), Player(0), true)
        call SetPlayerAllianceStateAllyBJ(Player(4), Player(1), true)
        call SetPlayerAllianceStateAllyBJ(Player(4), Player(2), true)
        call SetPlayerAllianceStateAllyBJ(Player(4), Player(3), true)
        call SetPlayerAllianceStateAllyBJ(Player(4), Player(5), true)
        call SetPlayerAllianceStateAllyBJ(Player(4), Player(6), true)
        call SetPlayerAllianceStateAllyBJ(Player(4), Player(8), true)
        call SetPlayerAllianceStateAllyBJ(Player(4), Player(9), true)
        call SetPlayerAllianceStateAllyBJ(Player(5), Player(0), true)
        call SetPlayerAllianceStateAllyBJ(Player(5), Player(1), true)
        call SetPlayerAllianceStateAllyBJ(Player(5), Player(2), true)
        call SetPlayerAllianceStateAllyBJ(Player(5), Player(3), true)
        call SetPlayerAllianceStateAllyBJ(Player(5), Player(4), true)
        call SetPlayerAllianceStateAllyBJ(Player(5), Player(6), true)
        call SetPlayerAllianceStateAllyBJ(Player(5), Player(8), true)
        call SetPlayerAllianceStateAllyBJ(Player(5), Player(9), true)
        call SetPlayerAllianceStateAllyBJ(Player(6), Player(0), true)
        call SetPlayerAllianceStateAllyBJ(Player(6), Player(1), true)
        call SetPlayerAllianceStateAllyBJ(Player(6), Player(2), true)
        call SetPlayerAllianceStateAllyBJ(Player(6), Player(3), true)
        call SetPlayerAllianceStateAllyBJ(Player(6), Player(4), true)
        call SetPlayerAllianceStateAllyBJ(Player(6), Player(5), true)
        call SetPlayerAllianceStateAllyBJ(Player(6), Player(8), true)
        call SetPlayerAllianceStateAllyBJ(Player(6), Player(9), true)
        call SetPlayerAllianceStateAllyBJ(Player(8), Player(0), true)
        call SetPlayerAllianceStateAllyBJ(Player(8), Player(1), true)
        call SetPlayerAllianceStateAllyBJ(Player(8), Player(2), true)
        call SetPlayerAllianceStateAllyBJ(Player(8), Player(3), true)
        call SetPlayerAllianceStateAllyBJ(Player(8), Player(4), true)
        call SetPlayerAllianceStateAllyBJ(Player(8), Player(5), true)
        call SetPlayerAllianceStateAllyBJ(Player(8), Player(6), true)
        call SetPlayerAllianceStateAllyBJ(Player(8), Player(9), true)
        call SetPlayerAllianceStateAllyBJ(Player(9), Player(0), true)
        call SetPlayerAllianceStateAllyBJ(Player(9), Player(1), true)
        call SetPlayerAllianceStateAllyBJ(Player(9), Player(2), true)
        call SetPlayerAllianceStateAllyBJ(Player(9), Player(3), true)
        call SetPlayerAllianceStateAllyBJ(Player(9), Player(4), true)
        call SetPlayerAllianceStateAllyBJ(Player(9), Player(5), true)
        call SetPlayerAllianceStateAllyBJ(Player(9), Player(6), true)
        call SetPlayerAllianceStateAllyBJ(Player(9), Player(8), true)

        //   Shared Vision
        call SetPlayerAllianceStateVisionBJ(Player(0), Player(1), true)
        call SetPlayerAllianceStateVisionBJ(Player(0), Player(2), true)
        call SetPlayerAllianceStateVisionBJ(Player(0), Player(3), true)
        call SetPlayerAllianceStateVisionBJ(Player(0), Player(4), true)
        call SetPlayerAllianceStateVisionBJ(Player(0), Player(5), true)
        call SetPlayerAllianceStateVisionBJ(Player(0), Player(6), true)
        call SetPlayerAllianceStateVisionBJ(Player(0), Player(8), true)
        call SetPlayerAllianceStateVisionBJ(Player(0), Player(9), true)
        call SetPlayerAllianceStateVisionBJ(Player(1), Player(0), true)
        call SetPlayerAllianceStateVisionBJ(Player(1), Player(2), true)
        call SetPlayerAllianceStateVisionBJ(Player(1), Player(3), true)
        call SetPlayerAllianceStateVisionBJ(Player(1), Player(4), true)
        call SetPlayerAllianceStateVisionBJ(Player(1), Player(5), true)
        call SetPlayerAllianceStateVisionBJ(Player(1), Player(6), true)
        call SetPlayerAllianceStateVisionBJ(Player(1), Player(8), true)
        call SetPlayerAllianceStateVisionBJ(Player(1), Player(9), true)
        call SetPlayerAllianceStateVisionBJ(Player(2), Player(0), true)
        call SetPlayerAllianceStateVisionBJ(Player(2), Player(1), true)
        call SetPlayerAllianceStateVisionBJ(Player(2), Player(3), true)
        call SetPlayerAllianceStateVisionBJ(Player(2), Player(4), true)
        call SetPlayerAllianceStateVisionBJ(Player(2), Player(5), true)
        call SetPlayerAllianceStateVisionBJ(Player(2), Player(6), true)
        call SetPlayerAllianceStateVisionBJ(Player(2), Player(8), true)
        call SetPlayerAllianceStateVisionBJ(Player(2), Player(9), true)
        call SetPlayerAllianceStateVisionBJ(Player(3), Player(0), true)
        call SetPlayerAllianceStateVisionBJ(Player(3), Player(1), true)
        call SetPlayerAllianceStateVisionBJ(Player(3), Player(2), true)
        call SetPlayerAllianceStateVisionBJ(Player(3), Player(4), true)
        call SetPlayerAllianceStateVisionBJ(Player(3), Player(5), true)
        call SetPlayerAllianceStateVisionBJ(Player(3), Player(6), true)
        call SetPlayerAllianceStateVisionBJ(Player(3), Player(8), true)
        call SetPlayerAllianceStateVisionBJ(Player(3), Player(9), true)
        call SetPlayerAllianceStateVisionBJ(Player(4), Player(0), true)
        call SetPlayerAllianceStateVisionBJ(Player(4), Player(1), true)
        call SetPlayerAllianceStateVisionBJ(Player(4), Player(2), true)
        call SetPlayerAllianceStateVisionBJ(Player(4), Player(3), true)
        call SetPlayerAllianceStateVisionBJ(Player(4), Player(5), true)
        call SetPlayerAllianceStateVisionBJ(Player(4), Player(6), true)
        call SetPlayerAllianceStateVisionBJ(Player(4), Player(8), true)
        call SetPlayerAllianceStateVisionBJ(Player(4), Player(9), true)
        call SetPlayerAllianceStateVisionBJ(Player(5), Player(0), true)
        call SetPlayerAllianceStateVisionBJ(Player(5), Player(1), true)
        call SetPlayerAllianceStateVisionBJ(Player(5), Player(2), true)
        call SetPlayerAllianceStateVisionBJ(Player(5), Player(3), true)
        call SetPlayerAllianceStateVisionBJ(Player(5), Player(4), true)
        call SetPlayerAllianceStateVisionBJ(Player(5), Player(6), true)
        call SetPlayerAllianceStateVisionBJ(Player(5), Player(8), true)
        call SetPlayerAllianceStateVisionBJ(Player(5), Player(9), true)
        call SetPlayerAllianceStateVisionBJ(Player(6), Player(0), true)
        call SetPlayerAllianceStateVisionBJ(Player(6), Player(1), true)
        call SetPlayerAllianceStateVisionBJ(Player(6), Player(2), true)
        call SetPlayerAllianceStateVisionBJ(Player(6), Player(3), true)
        call SetPlayerAllianceStateVisionBJ(Player(6), Player(4), true)
        call SetPlayerAllianceStateVisionBJ(Player(6), Player(5), true)
        call SetPlayerAllianceStateVisionBJ(Player(6), Player(8), true)
        call SetPlayerAllianceStateVisionBJ(Player(6), Player(9), true)
        call SetPlayerAllianceStateVisionBJ(Player(8), Player(0), true)
        call SetPlayerAllianceStateVisionBJ(Player(8), Player(1), true)
        call SetPlayerAllianceStateVisionBJ(Player(8), Player(2), true)
        call SetPlayerAllianceStateVisionBJ(Player(8), Player(3), true)
        call SetPlayerAllianceStateVisionBJ(Player(8), Player(4), true)
        call SetPlayerAllianceStateVisionBJ(Player(8), Player(5), true)
        call SetPlayerAllianceStateVisionBJ(Player(8), Player(6), true)
        call SetPlayerAllianceStateVisionBJ(Player(8), Player(9), true)
        call SetPlayerAllianceStateVisionBJ(Player(9), Player(0), true)
        call SetPlayerAllianceStateVisionBJ(Player(9), Player(1), true)
        call SetPlayerAllianceStateVisionBJ(Player(9), Player(2), true)
        call SetPlayerAllianceStateVisionBJ(Player(9), Player(3), true)
        call SetPlayerAllianceStateVisionBJ(Player(9), Player(4), true)
        call SetPlayerAllianceStateVisionBJ(Player(9), Player(5), true)
        call SetPlayerAllianceStateVisionBJ(Player(9), Player(6), true)
        call SetPlayerAllianceStateVisionBJ(Player(9), Player(8), true)

        // Force: TRIGSTR_031
        call SetPlayerTeam(Player(10), 1)
        call SetPlayerState(Player(10), PLAYER_STATE_ALLIED_VICTORY, 1)
        call SetPlayerTeam(Player(11), 1)
        call SetPlayerState(Player(11), PLAYER_STATE_ALLIED_VICTORY, 1)

        //   Allied
        call SetPlayerAllianceStateAllyBJ(Player(10), Player(11), true)
        call SetPlayerAllianceStateAllyBJ(Player(11), Player(10), true)

        //   Shared Vision
        call SetPlayerAllianceStateVisionBJ(Player(10), Player(11), true)
        call SetPlayerAllianceStateVisionBJ(Player(11), Player(10), true)

    endfunction

    function InitAllyPriorities takes nothing returns nothing

        call SetStartLocPrioCount(0, 3)
        call SetStartLocPrio(0, 0, 1, MAP_LOC_PRIO_LOW)
        call SetStartLocPrio(0, 1, 2, MAP_LOC_PRIO_LOW)
        call SetStartLocPrio(0, 2, 5, MAP_LOC_PRIO_HIGH)

        call SetStartLocPrioCount(1, 2)
        call SetStartLocPrio(1, 0, 5, MAP_LOC_PRIO_LOW)
        call SetStartLocPrio(1, 1, 6, MAP_LOC_PRIO_HIGH)

        call SetStartLocPrioCount(2, 2)
        call SetStartLocPrio(2, 0, 4, MAP_LOC_PRIO_HIGH)
        call SetStartLocPrio(2, 1, 7, MAP_LOC_PRIO_HIGH)

        call SetStartLocPrioCount(3, 2)
        call SetStartLocPrio(3, 0, 4, MAP_LOC_PRIO_HIGH)
        call SetStartLocPrio(3, 1, 8, MAP_LOC_PRIO_HIGH)

        call SetStartLocPrioCount(4, 4)
        call SetStartLocPrio(4, 0, 2, MAP_LOC_PRIO_LOW)
        call SetStartLocPrio(4, 1, 3, MAP_LOC_PRIO_HIGH)
        call SetStartLocPrio(4, 2, 7, MAP_LOC_PRIO_HIGH)
        call SetStartLocPrio(4, 3, 8, MAP_LOC_PRIO_HIGH)

        call SetStartLocPrioCount(5, 3)
        call SetStartLocPrio(5, 0, 0, MAP_LOC_PRIO_HIGH)
        call SetStartLocPrio(5, 1, 1, MAP_LOC_PRIO_HIGH)
        call SetStartLocPrio(5, 2, 6, MAP_LOC_PRIO_LOW)

        call SetStartLocPrioCount(6, 1)
        call SetStartLocPrio(6, 0, 1, MAP_LOC_PRIO_HIGH)

        call SetStartLocPrioCount(7, 2)
        call SetStartLocPrio(7, 0, 2, MAP_LOC_PRIO_LOW)
        call SetStartLocPrio(7, 1, 4, MAP_LOC_PRIO_HIGH)

        call SetStartLocPrioCount(8, 2)
        call SetStartLocPrio(8, 0, 3, MAP_LOC_PRIO_HIGH)
        call SetStartLocPrio(8, 1, 4, MAP_LOC_PRIO_HIGH)
    endfunction

    //***************************************************************************
    //*
    //*  Main Initialization
    //*
    //***************************************************************************

    //===========================================================================
    function main takes nothing returns nothing
        call SetCameraBounds(- 5376.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), - 5632.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM), 5376.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), 5120.0 - GetCameraMargin(CAMERA_MARGIN_TOP), - 5376.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), 5120.0 - GetCameraMargin(CAMERA_MARGIN_TOP), 5376.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), - 5632.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM))
        call SetDayNightModels("Environment\\DNC\\DNCDungeon\\DNCDungeonTerrain\\DNCDungeonTerrain.mdl", "Environment\\DNC\\DNCDungeon\\DNCDungeonUnit\\DNCDungeonUnit.mdl")
        call NewSoundEnvironment("Default")
        call SetAmbientDaySound("DungeonDay")
        call SetAmbientNightSound("DungeonNight")
        call SetMapMusic("Music", true, 0)
        call InitSounds()
        call CreateRegions()
        call InitUpgrades()
        call CreateAllDestructables()
        call CreateAllUnits()
        call InitBlizzard()


        call InitGlobals()
        call InitCustomTriggers()
        call ConditionalTriggerExecute(gg_trg_Initialize) // INLINED!!

    endfunction

    //***************************************************************************
    //*
    //*  Map Configuration
    //*
    //***************************************************************************

    function config takes nothing returns nothing
        call SetMapName("TRIGSTR_001")
        call SetMapDescription("TRIGSTR_003")
        call SetPlayers(11)
        call SetTeams(11)
        call SetGamePlacement(MAP_PLACEMENT_TEAMS_TOGETHER)

        call DefineStartLocation(0, - 3968.0, - 1472.0)
        call DefineStartLocation(1, - 3968.0, - 1088.0)
        call DefineStartLocation(2, - 4032.0, - 1856.0)
        call DefineStartLocation(3, - 4288.0, - 1728.0)
        call DefineStartLocation(4, - 4224.0, - 1856.0)
        call DefineStartLocation(5, - 4160.0, - 1280.0)
        call DefineStartLocation(6, - 4032.0, - 896.0)
        call DefineStartLocation(7, - 4160.0, - 1984.0)
        call DefineStartLocation(8, - 4352.0, - 1856.0)
        call DefineStartLocation(9, 3136.0, 2176.0)
        call DefineStartLocation(10, - 1600.0, - 3264.0)

        // Player setup
        call InitCustomPlayerSlots()
        call InitCustomTeams()
        call InitAllyPriorities()
    endfunction




    //Struct method generated initializers/callers:


     
     
    Last edited: Aug 9, 2019
  4. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    2,901
    Resources:
    1
    Spells:
    1
    Resources:
    1
    What triggers in your map use the “unit is attacked” event or are dependent on a “unit takes damage” event (possibly from a damage detection system)? I think the next step would be to look for usage of GetLocalPlayer() in Blizzard.j functions, then see if any of THOSE funcs are present in war3map.j. Failing that start disabling triggers (or parts of triggers until you can no longer reliably cause the desync to occur by attacking the Balrog. Then one of those triggers might be to blame.
     
  5. Bennoloth

    Bennoloth

    Joined:
    Apr 29, 2019
    Messages:
    17
    Resources:
    0
    Resources:
    0
    Hi, thanks for the quick reply after my months delay. I'm sorry but I don't see Blizzard.j in the MPQ editor for the map.

    This is the only trigger that triggers off taking damage/being attacked - it's an event that happens well before the players get to the Balrog:

    • Cave Troll attacked
      • Events
        • Unit - Cave Troll 0022 <gen> Takes damage
      • Conditions
      • Actions
        • Sound - Play TheHornOfCenarius <gen>
        • Player Group - Pick every player in Heroes and do (Camera - Pan camera for (Picked player) to (Center of Region 000 <gen>) over 0.50 seconds)
        • Player Group - Pick every player in Heroes and do (Unit Group - Pick every unit in (Units owned by (Picked player)) and do (Unit - Move (Picked unit) instantly to (Center of Region 000 <gen>)))
        • Unit Group - Pick every unit in (Units owned by Player 12 (Brown) of type Cave Troll) and do (Unit - Move (Picked unit) instantly to (Center of Region 004 <gen>))
        • Unit Group - Pick every unit in (Units owned by Player 12 (Brown) of type Cave Troll) and do (Unit - Order (Picked unit) to Attack-Move To (Random point in Region 001 <gen>))
        • Unit - Create 25 Orc for Player 12 (Brown) at (Center of Region 007 <gen>) facing (Position of (Triggering unit))
        • Unit Group - Pick every unit in (Units in Region 007 <gen> owned by Player 12 (Brown)) and do (Unit - Order (Picked unit) to Attack-Move To (Random point in Region 004 <gen>))
        • Unit - Create 25 Orc for Player 12 (Brown) at (Center of Region 013 <gen>) facing (Position of (Triggering unit))
        • Unit Group - Pick every unit in (Units in Region 013 <gen> owned by Player 12 (Brown)) and do (Unit - Order (Picked unit) to Attack-Move To (Random point in Region 000 <gen>))
        • Destructible - Create a Rock Chunks at (Center of Region 015 <gen>) facing (Random angle) with scale 3.00 and variation 0
        • Destructible - Make (Last created destructible) Invulnerable
        • Destructible - Create a Rock Chunks at (Center of Region 015 Copy <gen>) facing (Random angle) with scale 3.00 and variation 0
        • Destructible - Make (Last created destructible) Invulnerable
        • Destructible - Create a Rock Chunks at (Center of Region 015 Copy 2 <gen>) facing (Random angle) with scale 3.00 and variation 0
        • Destructible - Make (Last created destructible) Invulnerable
        • Destructible - Create a Rock Chunks at (Center of Region 015 Copy 3 <gen>) facing (Random angle) with scale 3.00 and variation 0
        • Destructible - Make (Last created destructible) Invulnerable
        • Destructible - Create a Rock Chunks at (Center of Region 015 Copy 4 <gen>) facing (Random angle) with scale 3.00 and variation 0
        • Destructible - Make (Last created destructible) Invulnerable
        • Destructible - Create a Rock Chunks at (Center of Region 015 Copy 6 <gen>) facing (Random angle) with scale 3.00 and variation 0
        • Destructible - Make (Last created destructible) Invulnerable
        • Destructible - Create a Rock Chunks at (Center of Region 015 Copy 5 <gen>) facing (Random angle) with scale 3.00 and variation 0
        • Destructible - Make (Last created destructible) Invulnerable
        • Unit - Create 1 Dwarven Altar for Neutral Passive at (Center of Region 022 <gen>) facing Default building facing degrees
        • Trigger - Turn on Deep Respawning Delay <gen>
        • Trigger - Turn off first wave <gen>
        • Trigger - Turn off second wave <gen>
        • Trigger - Turn off third wave <gen>
        • Trigger - Turn off fourth wave <gen>
        • Trigger - Turn off fifth wave <gen>
        • Trigger - Turn off part of fifth wave <gen>
        • Trigger - Turn off sixth wave <gen>
        • Trigger - Turn off part of sixth wave <gen>
        • Trigger - Turn off seventh wave <gen>
        • Trigger - Turn off eigth wave <gen>
        • Trigger - Turn off part of eight wave <gen>
        • Trigger - Turn off Final wave <gen>
        • Trigger - Turn off Cave Troll attacked <gen>


    I turned off "Gandalf Threatens Balrog". Hopefully that does it. It's just such a hard thing to test because it happens after playing for like 15 minutes and only on Battle.net. A lot of the time the game doesn't even get that far because it's a hard game.
     
  6. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    2,901
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Can you make a test build of the map where gameplay is accelerated up until the point where the Balrog is involved? Say, giving heroes a super powerful item that allows them to progress quickly, setting their starting level to be higher, giving them many bonus units, etc.. Then you can trigger the Balrog sequence repeatedly with only minor setup time. Get some friends to test the map and you can maybe run it a few times in 30 minutes, checking to see who desyncs where.

    Edit: I just checked through all of your war3map.j and didn't find any functions that use GLP() other than the DisplayTextToForce so it's probably not that. I notice that you are leaking a ton of objects (mostly locations and groups), and I'm wondering if simply the sheer number of allocated objects is causing some sort of a problem. I would suggest learning how to clean leaks yourself (Things That Leak) or implementing this leak cleaner script by Dr Super Good: [Lua]Obliterate all GUI leaks with 1 trigger!
     
    Last edited: Aug 9, 2019
  7. Cespie

    Cespie

    Joined:
    May 21, 2019
    Messages:
    344
    Resources:
    0
    Resources:
    0
    In this trigger alone, you're leaking a ton of groups and locations. Seeing how the Balrog event is likely at the end of this map (IIRC the movie's plot), it's quite possible that you've simply built up so many leaks at this point, that it is bound to cause issues.
    I tried to mark them, and found 25 leaks in this trigger alone (I may even have missed one). I marked them with "||| LEAK |||" in the above trigger block for you to see. That's a lot.
     
    Last edited: Aug 9, 2019
  8. Bennoloth

    Bennoloth

    Joined:
    Apr 29, 2019
    Messages:
    17
    Resources:
    0
    Resources:
    0
    I really hope that Lua script works. It could push my map into "ready for publishing" territory! Thanks again.

    Edit: Unfortunately it did not work. Well, I don't know if it did, but it stopped all my unit spawns from happening. I'll have to try again the hard way.
     
    Last edited: Aug 10, 2019