1. Are you planning to upload your awesome map to Hive? Please review the rules here.
    Dismiss Notice
  2. 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
  3. 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
  4. 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
  5. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  6. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  7. The results are out! Check them out.
    Dismiss Notice
  8. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  9. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  10. 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.

Trigger Viewer

Taylor's Hero Siege V3.4.w3x
Variables
Main Trigger
Text
Initialization
Undead Move 3
Undead Move 2
Undead Move
Spawn Creeps
Unit Work
Main Initialization
Change Owner Unit
Cinematic
Secret Tome
Defense
Dagren Leave
Edmunson Leave
Muradin Leave
Arthas Leave
Jaina Leave
Uther Leave
Halakh Leave
----- Hero -----
Select Hero
Select Darkness Lord
Select Guardian Of Nature
Select Pandaren Thunderstorm
Select Human Healer
Select Crystal King
Select Legion Minotaur
Give Item
Elapsed 60
Floating Text
Move 1
Move 2
Move 3
Move 4
Move 5
Move 6
Resource
Player 1
Player 2
Player 3
Player 4
Player 5
Player 6
Player 7
Player 8
Player 9
Player 10
Repick
Repick Hero
------ Hard Mode -----
Spawn Ultimate Creeps
Hard Mode On
Lane 4
Lane 3
Ultimate Lane
Lane 2
Lane 1
====>Moving<====
Lane 4 Moving
Lane 3 Moving
Ultimate Lane Moving
Lane 2 Moving
Lane 1 Moving
Stop Expert Mode
Portal 1 Die
Portal 2 Die
Ultimate Portal Die
Portal 3 Die
Portal 4 Die
Random Hero
Wait
-------- Items -------
Combination
Crown of The Lich King
Blade of olympus
Essence of Kiljaeden
------- Ability ------
Lightning Down Hatred
Victory
Import Instruction
LDH Helpful Files
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Lightning Down Hatred Configuration
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
LDH Execute
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
LDH Loop
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Wrath Of Minotaur
Wrath Of Minotaur
Lightning Strike
Lightning Strike
// Map deprotected by X-deprotect (version 2006-10-02) by zibada
// http://dimon.xgm.ru/xdep/
// Visit our modmaking community at http://xgm.ru/

Name Type Is Array Initial Value
boolean01 boolean No
boolean02 boolean No
boolean03 boolean No
booleans01 boolean Yes
buttons01 button Yes
buttons02 button Yes
dialog01 dialog No
dialog02 dialog No
force01 force No
force02 force No
group01 group No
integer01 integer No
integer02 integer No
integer03 integer No
integer04 integer No
integer05 integer No
integer06 integer No
integer07 integer No
integer08 integer No
integer09 integer No
integer10 integer No
integer11 integer No
integers01 integer Yes
integers02 integer Yes
integers03 integer Yes
integers04 integer Yes
integers05 integer Yes
integers06 integer Yes
integers07 integer Yes
integers08 integer Yes
integers09 integer Yes
integers10 integer Yes
integers11 integer Yes
integers12 integer Yes
integers13 integer Yes
integers14 integer Yes
integers15 integer Yes
integers16 integer Yes
integers17 integer Yes
integers18 integer Yes
integers19 integer Yes
integers20 integer Yes
item01 item No
LDG_ImpactGroup group No
LDH_Ability abilcode No
LDH_AirDamage real Yes
LDH_AirDamage_Chance real Yes
LDH_AirDamageChance real Yes
LDH_AirEffect string No
LDH_AirEffectPoint string No
LDH_AirEffects string No
LDH_AirUnitPosition location No
LDH_Angle real No
LDH_Angle2 real No
LDH_AttackType attacktype No
LDH_BlastArea real Yes
LDH_BlastedArea real Yes
LDH_Caster unit No
LDH_CasterPosition location No
LDH_Cos real No
LDH_CurrentDistanceRange real No
LDH_DamageType damagetype No
LDH_DestroyTreesAreaLoop real Yes
LDH_DestroyTreesAreaStart real Yes
LDH_Destructible destructable No
LDH_DistanceRange real No
LDH_Dummy unit No
LDH_Dummy2 unit No
LDH_DummyAbility abilcode No
LDH_DummyAbility2 abilcode No
LDH_DummyAbility_2 abilcode No
LDH_DummyType unitcode No
LDH_Effects string No
LDH_Effects2 string No
LDH_FinalParabola real No
LDH_GroupLoop group No
LDH_GroupStart group No
LDH_Hash hashtable No
LDH_ID integer No
LDH_ImpactArea real Yes
LDH_ImpactDamage real Yes
LDH_ImpactEffect string No
LDH_ImpactPickedUnitEffect string No
LDH_ImpactUnit unit No
LDH_Int integer No
LDH_Level integer No
LDH_MaxHeight real Yes
LDH_MX real No
LDH_MY real No
LDH_NumberOfEffects integer Yes
LDH_PickedTrees destructable No
LDH_PW real No
LDH_Sin real No
LDH_Speed real Yes
LDH_StartPointEffect location No
LDH_Target unit No
LDH_TargetLoopPosition location No
LDH_TargetPosition location No
LDH_TreePos location No
LDH_TreePosition location No
LDH_UnitHarvester unit No
LDH_X real No
LDH_Y real No
LS_Caster unit No
LS_Effect effect Yes
LS_Target unit No
rect01 rect No
rect02 rect No
rect03 rect No
rect04 rect No
rect05 rect No
rect06 rect No
rect07 rect No
rect08 rect No
rect09 rect No
rect10 rect No
rect11 rect No
rect12 rect No
rect13 rect No
rect14 rect No
rect15 rect No
rect16 rect No
rect17 rect No
rect18 rect No
rect19 rect No
rect20 rect No
rect21 rect No
rect22 rect No
rect23 rect No
rect24 rect No
rect25 rect No
rect26 rect No
rect27 rect No
rect28 rect No
rect29 rect No
rect30 rect No
rect31 rect No
rect32 rect No
rect33 rect No
rect34 rect No
rect35 rect No
rect36 rect No
rect37 rect No
rects01 rect Yes
rects02 rect Yes
rects03 rect Yes
rects04 rect Yes
SB_Caster unit No
SB_Effect effect Yes
SB_Target unit No
strings01 string Yes
strings02 string Yes
Swift_Blade_Integer integervar No
texttag01 texttag No
timer01 timer No
timer02 timer No
timer03 timer No
trigger01 trigger No
trigger02 trigger No
trigger03 trigger No
trigger04 trigger No
trigger05 trigger No
trigger06 trigger No
trigger07 trigger No
trigger08 trigger No
trigger09 trigger No
trigger10 trigger No
trigger11 trigger No
trigger12 trigger No
trigger13 trigger No
trigger14 trigger No
trigger15 trigger No
trigger16 trigger No
trigger17 trigger No
trigger18 trigger No
trigger19 trigger No
trigger20 trigger No
trigger21 trigger No
trigger22 trigger No
trigger23 trigger No
trigger24 trigger No
trigger25 trigger No
trigger26 trigger No
trigger27 trigger No
trigger28 trigger No
trigger29 trigger No
trigger30 trigger No
trigger31 trigger No
trigger32 trigger No
trigger33 trigger No
trigger34 trigger No
trigger35 trigger No
trigger36 trigger No
trigger37 trigger No
trigger38 trigger No
trigger39 trigger No
trigger40 trigger No
trigger41 trigger No
trigger42 trigger No
trigger43 trigger No
trigger44 trigger No
trigger45 trigger No
trigger46 trigger No
trigger47 trigger No
trigger48 trigger No
trigger49 trigger No
trigger50 trigger No
trigger51 trigger No
trigger52 trigger No
trigger53 trigger No
trigger54 trigger No
trigger55 trigger No
trigger56 trigger No
trigger57 trigger No
trigger58 trigger No
trigger59 trigger No
trigger60 trigger No
trigger61 trigger No
trigger62 trigger No
trigger63 trigger No
trigger64 trigger No
trigger65 trigger No
unit01 unit No
unit02 unit No
unit03 unit No
unit04 unit No
unit05 unit No
unit06 unit No
unit07 unit No
unit08 unit No
unit09 unit No
units01 unit Yes
units02 unit Yes
units03 unit Yes
units\demon\EredarWarlockPurple\EredarPurple.blp
Undead Move 3
  Events
    Time - Elapsed game time is 1650.00 seconds
  Conditions
  Actions
    Game - Display to (All players) the text: [Warning] - Undead Heroes has begin attacked to your baseMiddle Lane...!! Get Ready For Fight...!!
    Unit - Order Death Knight 0036 <gen> to Attack-Move To (Center of Mannoroth_Target <gen>)
    Unit - Order Lich 0035 <gen> to Attack-Move To (Center of Mannoroth_Target <gen>)
    Wait 2.00 seconds
    Unit - Order Pit Lord 0034 <gen> to Attack-Move To (Center of Mannoroth_Target <gen>)
Undead Move 2
  Events
    Time - Elapsed game time is 1400.00 seconds
  Conditions
  Actions
    Game - Display to (All players) the text: [Warning] - Undead Heroes has begin attacked to your baseLane 2 and 3
    Unit - Order Crypt Lord 0032 <gen> to Attack-Move To (Center of Undead_Hero_2 <gen>)
    Unit - Order Pit Lord 0033 <gen> to Attack-Move To (Center of Undead_Hero_2 <gen>)
    Unit - Order Crypt Lord 0037 <gen> to Attack-Move To (Center of Undead_Hero_3 <gen>)
    Unit - Order Pit Lord 0040 <gen> to Attack-Move To (Center of Undead_Hero_3 <gen>)
Undead Move
  Events
    Time - Elapsed game time is 900.00 seconds
  Conditions
  Actions
    Game - Display to (All players) the text: [Warning] - Undead Heroes has begin attacked to your baseLane 1 and 4
    Unit - Order Dreadlord 0030 <gen> to Attack-Move To (Center of Undead_Hero_1 <gen>)
    Unit - Order Lich 0031 <gen> to Attack-Move To (Center of Undead_Hero_1 <gen>)
    Unit - Order Dreadlord 0038 <gen> to Attack-Move To (Center of Undead_Hero_4 <gen>)
    Unit - Order Lich 0039 <gen> to Attack-Move To (Center of Undead_Hero_4 <gen>)
Spawn Creeps
  Events
    Time - Every 30.00 seconds of game time
  Conditions
    (Number of units in (Units in Creeps_Spawn_1 <gen>)) Equal to 0
  Actions
    Unit - Create 3 Blue Dragon for Neutral Hostile at (Center of Creeps_Spawn_1 <gen>) facing 45.00 degrees
Unit Work
  Events
    Time - Elapsed game time is 0.01 seconds
  Conditions
  Actions
    Unit - Order Peasant 0085 <gen> to Harvest Gold Mine 0084 <gen>
    Unit - Order Peasant 0086 <gen> to Harvest Gold Mine 0084 <gen>
    Unit - Order Peasant 0087 <gen> to Harvest Gold Mine 0084 <gen>
    Unit - Order Peasant 0088 <gen> to Harvest Cityscape Snowy Tree Wall 1654 <gen>
    Unit - Order Peasant 0089 <gen> to Harvest Cityscape Snowy Tree Wall 1653 <gen>
    Unit - Order Peasant 0090 <gen> to Harvest Cityscape Snowy Tree Wall 1653 <gen>
//TESH.scrollpos=766
//TESH.alwaysfold=0
// Map deprotected by X-deprotect (version 2006-10-02) by zibada
// http://dimon.xgm.ru/xdep/
// Visit our modmaking community at http://xgm.ru/


function InitGlobals2 takes nothing returns nothing
    local integer i=0
    set udg_force01=CreateForce()
    set udg_integer01=0
    set udg_integer02=0
    set udg_integer03=0
    set udg_integer04=0
    set udg_integer05=0
    set udg_dialog01=DialogCreate()
    set udg_boolean01=false
    set udg_boolean02=false
    set i=0
    loop
        exitwhen(i>20)
        set udg_strings01[i]=""
        set i=i+1
    endloop
    set udg_boolean03=false
    set udg_integer06=0
    set udg_timer01=CreateTimer()
    set i=0
    loop
        exitwhen(i>10)
        set udg_strings02[i]=""
        set i=i+1
    endloop
    set i=0
    loop
        exitwhen(i>10)
        set udg_integers08[i]=0
        set i=i+1
    endloop
    set udg_force02=CreateForce()
    set udg_dialog02=DialogCreate()
    set udg_group01=CreateGroup()
    set udg_integer08=0
    set i=0
    loop
        exitwhen(i>10)
        set udg_integers14[i]=0
        set i=i+1
    endloop
    set udg_integer09=0
    set i=0
    loop
        exitwhen(i>10)
        set udg_integers15[i]=0
        set i=i+1
    endloop
    set i=0
    loop
        exitwhen(i>10)
        set udg_integers16[i]=0
        set i=i+1
    endloop
    set i=0
    loop
        exitwhen(i>10)
        set udg_integers17[i]=0
        set i=i+1
    endloop
    set i=0
    loop
        exitwhen(i>10)
        set udg_booleans01[i]=false
        set i=i+1
    endloop
    set i=0
    loop
        exitwhen(i>10)
        set udg_integers18[i]=0
        set i=i+1
    endloop
    set i=0
    loop
        exitwhen(i>10)
        set udg_integers19[i]=0
        set i=i+1
    endloop
    set i=0
    loop
        exitwhen(i>10)
        set udg_integers20[i]=0
        set i=i+1
    endloop
    set udg_integer10=0
    set udg_integer11=0
    set udg_timer02=CreateTimer()
    set udg_timer03=CreateTimer()
endfunction

function CreateAllItems takes nothing returns nothing
    local integer itemID
    call CreateItem('I00M',-2333.4,5716.6)
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,'hgtw',5888.0,-7424.0,270.000)
    set u=CreateUnit(p,'hgtw',5248.0,-7424.0,270.000)
    set u=CreateUnit(p,'hgtw',3072.0,-7744.0,270.000)
    set u=CreateUnit(p,'hgtw',2432.0,-7744.0,270.000)
    set u=CreateUnit(p,'hcas',-320.0,-8768.0,270.000)
    set u=CreateUnit(p,'hgtw',-64.0,-8448.0,270.000)
    set u=CreateUnit(p,'hgtw',-2944.0,-7872.0,270.000)
    set u=CreateUnit(p,'htow',5568.0,-7744.0,270.000)
    set u=CreateUnit(p,'hkee',2752.0,-8064.0,270.000)
    set u=CreateUnit(p,'hgtw',-704.0,-8576.0,270.000)
    set u=CreateUnit(p,'hgtw',64.0,-8576.0,270.000)
    set u=CreateUnit(p,'hgtw',-3584.0,-7872.0,270.000)
    set u=CreateUnit(p,'hkee',-3264.0,-8192.0,270.000)
    set u=CreateUnit(p,'hgtw',-5632.0,-7232.0,270.000)
    set u=CreateUnit(p,'hgtw',-6272.0,-7232.0,270.000)
    set u=CreateUnit(p,'htow',-5952.0,-7552.0,270.000)
    set u=CreateUnit(p,'hgtw',-576.0,-8448.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 u=CreateUnit(p,'n002',3514.3,-8376.0,250.979)
    set u=CreateUnit(p,'hrif',-6321.0,-7102.3,90.000)
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 u=CreateUnit(p,'u002',3360.0,7200.0,270.000)
    set u=CreateUnit(p,'usep',-6208.0,6592.0,270.000)
    set u=CreateUnit(p,'u001',-352.0,1376.0,270.000)
    set u=CreateUnit(p,'u003',-5728.0,6368.0,270.000)
    set u=CreateUnit(p,'u000',1888.0,-4448.0,270.000)
    set u=CreateUnit(p,'u000',4320.0,-4320.0,270.000)
    set u=CreateUnit(p,'u000',-1376.0,-4384.0,270.000)
    set u=CreateUnit(p,'u000',-4384.0,-4640.0,270.000)
    set u=CreateUnit(p,'u000',-7008.0,-4192.0,270.000)
    set u=CreateUnit(p,'u003',-6624.0,6368.0,270.000)
    set udg_unit04=CreateUnit(p,'unp2',-320.0,16384.0,270.000)
    set u=CreateUnit(p,'u001',-5792.0,-672.0,270.000)
    set u=CreateUnit(p,'u001',-6688.0,-672.0,270.000)
    set u=CreateUnit(p,'u001',-4320.0,928.0,270.000)
    set u=CreateUnit(p,'u001',-3360.0,928.0,270.000)
    set u=CreateUnit(p,'usep',-3328.0,5824.0,270.000)
    set u=CreateUnit(p,'usep',-704.0,6272.0,270.000)
    set u=CreateUnit(p,'usep',2176.0,6272.0,270.000)
    set u=CreateUnit(p,'usep',4992.0,6080.0,270.000)
    set u=CreateUnit(p,'u001',5024.0,1760.0,270.000)
    set u=CreateUnit(p,'u001',4128.0,1824.0,270.000)
    set u=CreateUnit(p,'u001',1312.0,1248.0,270.000)
    set u=CreateUnit(p,'u001',2336.0,1120.0,270.000)
    set u=CreateUnit(p,'u001',-1184.0,928.0,270.000)
    set u=CreateUnit(p,'u003',-3616.0,5664.0,270.000)
    set u=CreateUnit(p,'usep',-5824.0,16512.0,270.000)
    set u=CreateUnit(p,'u003',-352.0,6112.0,270.000)
    set u=CreateUnit(p,'u003',-1120.0,6112.0,270.000)
    set u=CreateUnit(p,'u003',1888.0,6048.0,270.000)
    set u=CreateUnit(p,'u003',-2912.0,5728.0,270.000)
    set u=CreateUnit(p,'u003',4576.0,5920.0,270.000)
    set u=CreateUnit(p,'u003',5408.0,5856.0,270.000)
    set u=CreateUnit(p,'u002',6880.0,7008.0,270.000)
    set u=CreateUnit(p,'u002',-672.0,7264.0,270.000)
    set u=CreateUnit(p,'u001',-224.0,928.0,270.000)
    set u=CreateUnit(p,'u002',-7264.0,7200.0,270.000)
    set u=CreateUnit(p,'u003',2528.0,5920.0,270.000)
    set u=CreateUnit(p,'u002',-2848.0,7136.0,270.000)
    set u=CreateUnit(p,'u00B',-5344.0,16224.0,270.000)
    set u=CreateUnit(p,'u00B',-6304.0,16096.0,270.000)
    set u=CreateUnit(p,'u00B',-6432.0,15712.0,270.000)
    set u=CreateUnit(p,'usep',-3392.0,16064.0,270.000)
    set u=CreateUnit(p,'usep',-1024.0,15040.0,270.000)
    set u=CreateUnit(p,'usep',2624.0,15424.0,270.000)
    set u=CreateUnit(p,'usep',5760.0,15104.0,270.000)
    set u=CreateUnit(p,'u00B',-5216.0,15648.0,270.000)
    set u=CreateUnit(p,'usep',-128.0,15040.0,270.000)
    set u=CreateUnit(p,'u00B',-3744.0,15904.0,270.000)
    set u=CreateUnit(p,'u00B',-3872.0,15392.0,270.000)
    set u=CreateUnit(p,'u00B',-2912.0,15840.0,270.000)
    set u=CreateUnit(p,'u00B',-2784.0,15264.0,270.000)
    set u=CreateUnit(p,'u00B',-1504.0,14752.0,270.000)
    set u=CreateUnit(p,'u00B',-1504.0,14112.0,270.000)
    set u=CreateUnit(p,'u00B',288.0,14752.0,270.000)
    set u=CreateUnit(p,'u00B',416.0,14112.0,270.000)
    set u=CreateUnit(p,'u00B',3168.0,14560.0,270.000)
    set u=CreateUnit(p,'u00B',2144.0,15264.0,270.000)
    set u=CreateUnit(p,'u00B',2016.0,14688.0,270.000)
    set u=CreateUnit(p,'u00B',3040.0,15136.0,270.000)
    set u=CreateUnit(p,'u00B',4960.0,14752.0,270.000)
    set u=CreateUnit(p,'u00B',5280.0,15200.0,270.000)
    set u=CreateUnit(p,'u00B',5920.0,14688.0,270.000)
    set u=CreateUnit(p,'u00B',5856.0,14176.0,270.000)
    set u=CreateUnit(p,'u00B',-544.0,14176.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 u=CreateUnit(p,'U004',-1071.2,3356.5,310.250)
    call SetHeroLevel(u,33,false)
    call SetUnitAcquireRange(u,200.0)
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AUan')
    call UnitAddItemToSlotById(u,'ocor',0)
    set u=CreateUnit(p,'uske',2799.0,-5266.3,270.000)
    set u=CreateUnit(p,'uske',2612.3,-5266.0,270.000)
    set u=CreateUnit(p,'U004',2701.0,-3474.3,277.580)
    call SetHeroLevel(u,7,false)
    call SetUnitAcquireRange(u,200.0)
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AUan')
    call UnitAddItemToSlotById(u,'ocor',0)
    set u=CreateUnit(p,'N006',-5545.7,15717.2,238.890)
    call SetHeroLevel(u,90,false)
    call SetUnitState(u,UNIT_STATE_MANA,0)
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANdo')
    set u=CreateUnit(p,'u008',6350.3,8133.5,265.117)
    set u=CreateUnit(p,'u008',2454.5,8658.2,255.253)
    set u=CreateUnit(p,'u008',-649.0,8797.5,215.361)
    set u=CreateUnit(p,'U004',4462.8,3410.1,310.253)
    call SetHeroLevel(u,30,false)
    call SetUnitAcquireRange(u,200.0)
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AUan')
    call UnitAddItemToSlotById(u,'ocor',0)
    set u=CreateUnit(p,'u008',-4288.0,8237.1,305.955)
    set u=CreateUnit(p,'uske',-6268.7,-5767.7,270.000)
    set u=CreateUnit(p,'uske',-6071.1,-5779.0,270.000)
    set u=CreateUnit(p,'uske',-5884.4,-5779.2,270.000)
    set u=CreateUnit(p,'uske',-5671.8,-5780.8,270.000)
    set u=CreateUnit(p,'uskm',-6150.1,-5538.8,270.000)
    set u=CreateUnit(p,'uskm',-5983.1,-5534.2,270.000)
    set u=CreateUnit(p,'uskm',-5801.7,-5557.5,270.000)
    set u=CreateUnit(p,'u008',-6736.4,8647.2,255.253)
    set u=CreateUnit(p,'u005',-646.4,5232.6,269.500)
    set u=CreateUnit(p,'U004',1919.7,3653.3,310.253)
    call SetHeroLevel(u,30,false)
    call SetUnitAcquireRange(u,200.0)
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AUan')
    call UnitAddItemToSlotById(u,'ocor',0)
    set u=CreateUnit(p,'U004',-6689.4,2441.3,310.253)
    call SetHeroLevel(u,30,false)
    call SetUnitAcquireRange(u,200.0)
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AUan')
    call UnitAddItemToSlotById(u,'ocor',0)
    set u=CreateUnit(p,'U004',-5940.7,-3906.9,277.580)
    call SetHeroLevel(u,7,false)
    call SetUnitAcquireRange(u,200.0)
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AUan')
    call UnitAddItemToSlotById(u,'ocor',0)
    set u=CreateUnit(p,'U004',-3200.7,-3484.9,277.580)
    call SetHeroLevel(u,7,false)
    call SetUnitAcquireRange(u,200.0)
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AUan')
    call UnitAddItemToSlotById(u,'ocor',0)
    set u=CreateUnit(p,'U004',-438.5,-3524.0,277.580)
    call SetHeroLevel(u,12,false)
    call SetUnitAcquireRange(u,200.0)
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AUan')
    call UnitAddItemToSlotById(u,'ocor',0)
    set u=CreateUnit(p,'U004',5216.3,-3531.2,277.580)
    call SetHeroLevel(u,7,false)
    call SetUnitAcquireRange(u,200.0)
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AUan')
    call UnitAddItemToSlotById(u,'ocor',0)
    set u=CreateUnit(p,'u005',2295.8,5312.5,273.094)
    set u=CreateUnit(p,'N006',-5827.9,2333.3,238.890)
    call SetHeroLevel(u,25,false)
    call SetUnitAcquireRange(u,200.0)
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANdo')
    set u=CreateUnit(p,'N006',-3232.0,3063.6,238.890)
    call SetHeroLevel(u,25,false)
    call SetUnitAcquireRange(u,200.0)
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANdo')
    set u=CreateUnit(p,'u005',5019.2,5109.2,277.040)
    set u=CreateUnit(p,'u005',-3241.3,4793.0,252.650)
    set u=CreateUnit(p,'U004',-3917.0,3070.8,310.253)
    call SetHeroLevel(u,30,false)
    call SetUnitAcquireRange(u,200.0)
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AUan')
    call UnitAddItemToSlotById(u,'ocor',0)
    set u=CreateUnit(p,'N006',-386.1,3349.3,238.890)
    call SetHeroLevel(u,28,false)
    call SetUnitAcquireRange(u,200.0)
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANdo')
    set u=CreateUnit(p,'N006',2604.8,3646.1,238.890)
    call SetHeroLevel(u,25,false)
    call SetUnitAcquireRange(u,200.0)
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANdo')
    set u=CreateUnit(p,'uske',-6262.3,-4907.6,270.000)
    set u=CreateUnit(p,'uske',-6064.7,-4918.8,270.000)
    set u=CreateUnit(p,'uske',-5878.0,-4919.1,270.000)
    set u=CreateUnit(p,'uske',-5665.5,-4920.7,270.000)
    set u=CreateUnit(p,'uskm',-6143.7,-4678.7,270.000)
    set u=CreateUnit(p,'uskm',-5976.7,-4674.0,270.000)
    set u=CreateUnit(p,'uskm',-5795.3,-4697.3,270.000)
    set u=CreateUnit(p,'uske',-3562.6,-6058.2,270.000)
    set u=CreateUnit(p,'uske',-3365.0,-6069.4,270.000)
    set u=CreateUnit(p,'uske',-3178.3,-6069.7,270.000)
    set u=CreateUnit(p,'uske',-2965.7,-6071.3,270.000)
    set u=CreateUnit(p,'uskm',-3444.0,-5829.3,270.000)
    set u=CreateUnit(p,'uskm',-3277.0,-5824.6,270.000)
    set u=CreateUnit(p,'uskm',-3095.6,-5848.0,270.000)
    set u=CreateUnit(p,'uske',-583.0,-6081.5,270.000)
    set u=CreateUnit(p,'uske',-385.4,-6092.8,270.000)
    set u=CreateUnit(p,'uske',-198.7,-6093.1,270.000)
    set u=CreateUnit(p,'uske',13.9,-6094.7,270.000)
    set u=CreateUnit(p,'uskm',-464.4,-5852.6,270.000)
    set u=CreateUnit(p,'uskm',-297.4,-5848.0,270.000)
    set u=CreateUnit(p,'uskm',-116.0,-5871.3,270.000)
    set u=CreateUnit(p,'uske',2447.2,-5970.1,270.000)
    set u=CreateUnit(p,'uske',2644.9,-5981.4,270.000)
    set u=CreateUnit(p,'uske',2831.5,-5981.7,270.000)
    set u=CreateUnit(p,'uske',3044.1,-5983.3,270.000)
    set u=CreateUnit(p,'uskm',2565.8,-5741.3,270.000)
    set u=CreateUnit(p,'uskm',2732.8,-5736.6,270.000)
    set u=CreateUnit(p,'uskm',2914.2,-5759.9,270.000)
    set u=CreateUnit(p,'uske',5357.1,-5871.6,270.000)
    set u=CreateUnit(p,'uske',5554.7,-5882.9,270.000)
    set u=CreateUnit(p,'uske',5741.4,-5883.2,270.000)
    set u=CreateUnit(p,'uske',5954.0,-5884.8,270.000)
    set u=CreateUnit(p,'uskm',5475.7,-5642.8,270.000)
    set u=CreateUnit(p,'uskm',5642.7,-5638.1,270.000)
    set u=CreateUnit(p,'uskm',5824.1,-5661.4,270.000)
    set u=CreateUnit(p,'uske',-3535.4,-4690.9,270.000)
    set u=CreateUnit(p,'uske',-3337.7,-4702.2,270.000)
    set u=CreateUnit(p,'uske',-3151.1,-4702.5,270.000)
    set u=CreateUnit(p,'uske',-2938.5,-4704.1,270.000)
    set u=CreateUnit(p,'uskm',-3416.8,-4462.1,270.000)
    set u=CreateUnit(p,'uskm',-3249.8,-4457.4,270.000)
    set u=CreateUnit(p,'uskm',-3068.4,-4480.7,270.000)
    set u=CreateUnit(p,'uske',-512.5,-5200.2,270.000)
    set u=CreateUnit(p,'uske',-314.9,-5211.4,270.000)
    set u=CreateUnit(p,'uske',-128.2,-5211.7,270.000)
    set u=CreateUnit(p,'uske',84.4,-5213.3,270.000)
    set u=CreateUnit(p,'uskm',-393.9,-4971.3,270.000)
    set u=CreateUnit(p,'uskm',-226.9,-4966.6,270.000)
    set u=CreateUnit(p,'uskm',-45.5,-4990.0,270.000)
    set u=CreateUnit(p,'uske',2407.6,-5070.3,270.000)
    set u=CreateUnit(p,'uske',2605.3,-5081.6,270.000)
    set u=CreateUnit(p,'uske',2792.0,-5081.9,270.000)
    set u=CreateUnit(p,'uske',3004.5,-5083.5,270.000)
    set u=CreateUnit(p,'uskm',2526.3,-4841.5,270.000)
    set u=CreateUnit(p,'uskm',2693.3,-4836.8,270.000)
    set u=CreateUnit(p,'uskm',2874.7,-4860.1,270.000)
    set u=CreateUnit(p,'uske',5199.8,-4969.1,270.000)
    set u=CreateUnit(p,'uske',5397.4,-4980.4,270.000)
    set u=CreateUnit(p,'uske',5584.1,-4980.7,270.000)
    set u=CreateUnit(p,'uske',5796.7,-4982.3,270.000)
    set u=CreateUnit(p,'uskm',5318.4,-4740.3,270.000)
    set u=CreateUnit(p,'uskm',5485.4,-4735.6,270.000)
    set u=CreateUnit(p,'uskm',5666.8,-4758.9,270.000)
    set u=CreateUnit(p,'N009',-546.5,13773.8,260.590)
    call SetHeroLevel(u,100,false)
    call SetHeroStr(u,595,true)
    call SetHeroAgi(u,595,true)
    call SetHeroInt(u,545,true)
    call SetUnitState(u,UNIT_STATE_MANA,8175)
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call SelectHeroSkill(u,'A00U')
    call IssueImmediateOrder(u,"")
    call SelectHeroSkill(u,'ANms')
    call SelectHeroSkill(u,'ANms')
    call SelectHeroSkill(u,'ANms')
    call IssueImmediateOrder(u,"manashieldoff")
    call SelectHeroSkill(u,'A00V')
    call SelectHeroSkill(u,'A00V')
    call SelectHeroSkill(u,'A00V')
    call SelectHeroSkill(u,'A00V')
    call SelectHeroSkill(u,'A00V')
    call SelectHeroSkill(u,'A00V')
    call SelectHeroSkill(u,'A00V')
    call SelectHeroSkill(u,'A00V')
    call SelectHeroSkill(u,'A00V')
    call SelectHeroSkill(u,'A00V')
    call SelectHeroSkill(u,'A00V')
    call SelectHeroSkill(u,'A00V')
    call SelectHeroSkill(u,'A00V')
    call SelectHeroSkill(u,'A00V')
    call SelectHeroSkill(u,'A00V')
    call IssueImmediateOrder(u,"")
    call IssueImmediateOrder(u,"")
    set u=CreateUnit(p,'N006',-6306.6,-1869.4,270.000)
    call SetHeroLevel(u,17,false)
    call SetUnitAcquireRange(u,200.0)
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANdo')
    set u=CreateUnit(p,'N006',-3825.1,-428.3,270.000)
    call SetHeroLevel(u,17,false)
    call SetUnitAcquireRange(u,200.0)
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANdo')
    set u=CreateUnit(p,'N006',-797.6,-328.5,270.000)
    call SetHeroLevel(u,20,false)
    call SetUnitAcquireRange(u,200.0)
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANdo')
    set u=CreateUnit(p,'N006',2077.8,-68.3,270.000)
    call SetHeroLevel(u,17,false)
    call SetUnitAcquireRange(u,200.0)
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANdo')
    set u=CreateUnit(p,'N006',5124.4,-106.0,270.000)
    call SetHeroLevel(u,17,false)
    call SetUnitAcquireRange(u,200.0)
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANdo')
    set u=CreateUnit(p,'N006',5147.9,3402.9,238.890)
    call SetHeroLevel(u,25,false)
    call SetUnitAcquireRange(u,200.0)
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANdo')
    set u=CreateUnit(p,'n007',-3861.6,978.3,267.040)
    set u=CreateUnit(p,'n007',-6177.5,-417.8,267.040)
    set u=CreateUnit(p,'n007',-745.4,1133.7,267.040)
    set u=CreateUnit(p,'n007',1893.3,1361.7,267.040)
    set u=CreateUnit(p,'n007',4622.0,2071.7,267.040)
    set u=CreateUnit(p,'u005',-6050.9,5082.2,271.568)
    set u=CreateUnit(p,'U00G',-5794.2,16015.8,266.660)
    call SetHeroLevel(u,90,false)
    call SetUnitState(u,UNIT_STATE_MANA,0)
    call SelectHeroSkill(u,'AUfu')
    call SelectHeroSkill(u,'AUfu')
    call SelectHeroSkill(u,'AUfu')
    call IssueImmediateOrder(u,"frostarmoroff")
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call IssueImmediateOrder(u,"")
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call IssueImmediateOrder(u,"raisedeadoff")
    set u=CreateUnit(p,'U00G',-3365.2,15614.5,266.660)
    call SetHeroLevel(u,95,false)
    call SetUnitState(u,UNIT_STATE_MANA,0)
    call SelectHeroSkill(u,'AUfu')
    call SelectHeroSkill(u,'AUfu')
    call SelectHeroSkill(u,'AUfu')
    call IssueImmediateOrder(u,"frostarmoroff")
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call IssueImmediateOrder(u,"")
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call IssueImmediateOrder(u,"raisedeadoff")
    set u=CreateUnit(p,'U00G',-643.5,14913.5,266.660)
    call SetHeroLevel(u,100,false)
    call SetUnitState(u,UNIT_STATE_MANA,0)
    call SelectHeroSkill(u,'AUfu')
    call SelectHeroSkill(u,'AUfu')
    call SelectHeroSkill(u,'AUfu')
    call IssueImmediateOrder(u,"frostarmoroff")
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call IssueImmediateOrder(u,"")
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call IssueImmediateOrder(u,"raisedeadoff")
    set u=CreateUnit(p,'U00G',2586.7,14982.9,266.660)
    call SetHeroLevel(u,95,false)
    call SetUnitState(u,UNIT_STATE_MANA,0)
    call SelectHeroSkill(u,'AUfu')
    call SelectHeroSkill(u,'AUfu')
    call SelectHeroSkill(u,'AUfu')
    call IssueImmediateOrder(u,"frostarmoroff")
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call IssueImmediateOrder(u,"")
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call IssueImmediateOrder(u,"raisedeadoff")
    set u=CreateUnit(p,'U00G',5405.9,14800.5,266.660)
    call SetHeroLevel(u,90,false)
    call SetUnitState(u,UNIT_STATE_MANA,0)
    call SelectHeroSkill(u,'AUfu')
    call SelectHeroSkill(u,'AUfu')
    call SelectHeroSkill(u,'AUfu')
    call IssueImmediateOrder(u,"frostarmoroff")
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call SelectHeroSkill(u,'A00X')
    call IssueImmediateOrder(u,"")
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call SelectHeroSkill(u,'A018')
    call IssueImmediateOrder(u,"raisedeadoff")
    set u=CreateUnit(p,'U004',-6023.5,15719.8,310.250)
    call SetHeroLevel(u,90,false)
    call SetUnitState(u,UNIT_STATE_MANA,0)
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AUan')
    call UnitAddItemToSlotById(u,'ocor',0)
    set u=CreateUnit(p,'N006',-3116.7,15315.8,238.890)
    call SetHeroLevel(u,95,false)
    call SetUnitState(u,UNIT_STATE_MANA,0)
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANdo')
    set u=CreateUnit(p,'U004',-3594.5,15318.4,310.250)
    call SetHeroLevel(u,95,false)
    call SetUnitState(u,UNIT_STATE_MANA,0)
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AUan')
    call UnitAddItemToSlotById(u,'ocor',0)
    set u=CreateUnit(p,'N006',-395.0,14614.9,238.890)
    call SetHeroLevel(u,100,false)
    call SetUnitState(u,UNIT_STATE_MANA,0)
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANdo')
    set u=CreateUnit(p,'U004',-872.8,14617.5,310.250)
    call SetHeroLevel(u,100,false)
    call SetUnitState(u,UNIT_STATE_MANA,0)
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AUan')
    call UnitAddItemToSlotById(u,'ocor',0)
    set u=CreateUnit(p,'N006',2835.3,14684.3,238.890)
    call SetHeroLevel(u,95,false)
    call SetUnitState(u,UNIT_STATE_MANA,0)
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANdo')
    set u=CreateUnit(p,'U004',2357.4,14686.9,310.250)
    call SetHeroLevel(u,95,false)
    call SetUnitState(u,UNIT_STATE_MANA,0)
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AUan')
    call UnitAddItemToSlotById(u,'ocor',0)
    set u=CreateUnit(p,'N006',5654.4,14501.9,238.890)
    call SetHeroLevel(u,90,false)
    call SetUnitState(u,UNIT_STATE_MANA,0)
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'ANht')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'AOws')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANca')
    call SelectHeroSkill(u,'ANdo')
    set u=CreateUnit(p,'U004',5176.6,14504.5,310.250)
    call SetHeroLevel(u,90,false)
    call SetUnitState(u,UNIT_STATE_MANA,0)
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AOsh')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AEim')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AOcr')
    call SelectHeroSkill(u,'AUan')
    call UnitAddItemToSlotById(u,'ocor',0)
endfunction

function CreateNeutralPassiveBuildings2 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,'hvlt',-7744.0,-2304.0,270.000)
    set u=CreateUnit(p,'hvlt',-5056.0,-2112.0,270.000)
    set u=CreateUnit(p,'hvlt',-1792.0,-2240.0,270.000)
    set u=CreateUnit(p,'hvlt',3520.0,64.0,270.000)
    set u=CreateUnit(p,'ngnh',5920.0,-12448.0,270.000)
    set u=CreateUnit(p,'ngt2',5408.0,-12576.0,270.000)
    set u=CreateUnit(p,'ncop',-6208.0,-11776.0,270.000)
    set u=CreateUnit(p,'ncop',-5824.0,-12672.0,270.000)
    set u=CreateUnit(p,'ncop',-6592.0,-11776.0,270.000)
    set u=CreateUnit(p,'ncop',-6592.0,-12672.0,270.000)
    set u=CreateUnit(p,'hvlt',960.0,-1344.0,270.000)
    set u=CreateUnit(p,'ncop',-6208.0,-12672.0,270.000)
    set u=CreateUnit(p,'n000',-4864.0,-8576.0,270.000)
    set u=CreateUnit(p,'n000',4608.0,-8576.0,270.000)
    set u=CreateUnit(p,'n000',-512.0,-9856.0,270.000)
    set u=CreateUnit(p,'ncop',-5824.0,-11776.0,270.000)
    set u=CreateUnit(p,'hvlt',-6912.0,11840.0,270.000)
    set u=CreateUnit(p,'hvlt',-2176.0,11904.0,270.000)
    set u=CreateUnit(p,'hvlt',1856.0,11264.0,270.000)
    set u=CreateUnit(p,'hvlt',6912.0,11904.0,270.000)
endfunction

function CreateNeutralPassive2 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,'n002',497.4,-9792.2,273.893)
    set u=CreateUnit(p,'n004',591.5,-9901.9,180.060)
    set u=CreateUnit(p,'n004',3610.5,-8435.7,239.146)
    set u=CreateUnit(p,'n002',-4241.7,-8256.0,266.403)
    set u=CreateUnit(p,'nsha',-1045.8,-7984.7,240.762)
    set u=CreateUnit(p,'n003',-4015.0,-8400.9,209.840)
    set u=CreateUnit(p,'H000',-5826.1,-12799.8,270.000)
    set u=CreateUnit(p,'H001',-6591.1,-11671.2,270.000)
    call IssueImmediateOrder(u,"")
    call SelectHeroSkill(u,'A002')
    call IssueImmediateOrder(u,"")
    set u=CreateUnit(p,'n004',-4141.3,-8327.4,216.447)
    set u=CreateUnit(p,'E001',-6211.1,-11670.0,270.000)
    set u=CreateUnit(p,'U00D',-6584.5,-12803.6,275.590)
    call SetUnitState(u,UNIT_STATE_MANA,0)
    set u=CreateUnit(p,'H002',-5817.3,-11659.3,266.780)
    set u=CreateUnit(p,'n002',-7942.3,-1959.4,37.233)
    set u=CreateUnit(p,'n003',720.9,-9995.9,209.840)
    set u=CreateUnit(p,'n004',-7795.0,-2042.4,80.344)
    set u=CreateUnit(p,'n002',-4971.0,-1828.3,27.563)
    set u=CreateUnit(p,'n004',-4872.4,-1927.4,80.344)
    set u=CreateUnit(p,'n002',-1909.9,-1898.7,27.563)
    set u=CreateUnit(p,'n004',-1811.2,-1997.9,80.344)
    set u=CreateUnit(p,'n002',727.7,-940.5,352.897)
    set u=CreateUnit(p,'n004',767.3,-1052.9,36.214)
    set u=CreateUnit(p,'n002',3727.4,53.9,311.514)
    set u=CreateUnit(p,'n004',3695.6,-57.7,318.138)
    set u=CreateUnit(p,'U00E',-6210.2,-12811.9,267.380)
    set u=CreateUnit(p,'n003',3731.6,-8528.2,209.840)
    set u=CreateUnit(p,'n003',-7665.7,-1949.5,149.806)
    set u=CreateUnit(p,'n003',-4745.8,-1910.5,107.520)
    set u=CreateUnit(p,'n003',-1680.6,-1900.2,114.517)
    set u=CreateUnit(p,'n003',835.6,-1134.5,77.203)
    set u=CreateUnit(p,'n003',3575.8,-130.9,296.923)
    set u=CreateUnit(p,'n002',6670.8,11813.7,273.893)
    set u=CreateUnit(p,'n004',6764.9,11703.9,180.060)
    set u=CreateUnit(p,'n003',6894.3,11609.9,209.840)
    set u=CreateUnit(p,'n002',1976.1,11092.6,233.668)
    set u=CreateUnit(p,'n004',1885.7,11071.5,286.113)
    set u=CreateUnit(p,'n003',1767.6,11037.8,344.225)
    set u=CreateUnit(p,'n002',-6742.5,11679.2,233.668)
    set u=CreateUnit(p,'n004',-6832.8,11658.1,286.113)
    set u=CreateUnit(p,'n003',-6950.9,11624.4,344.225)
    set u=CreateUnit(p,'n002',-2042.7,11727.7,233.668)
    set u=CreateUnit(p,'n004',-2133.0,11706.6,286.113)
    set u=CreateUnit(p,'n003',-2251.2,11672.8,344.225)
endfunction

function CreateRegions2 takes nothing returns nothing
    local weathereffect we
    set udg_rect02=Rect(-6688.0,14528.0,7168.0,16704.0)
    set udg_rect03=Rect(-768.0,-10080.0,-224.0,-9600.0)
    set udg_rect04=Rect(-6304.0,-11872.0,-6112.0,-11712.0)
    set udg_rect05=Rect(-6688.0,-12736.0,-6496.0,-12576.0)
    set udg_rect06=Rect(-6464.0,-12224.0,-5952.0,-12128.0)
    set udg_rect07=Rect(-6304.0,-12736.0,-6112.0,-12576.0)
    set udg_rect08=Rect(-6688.0,-11872.0,-6496.0,-11712.0)
    set udg_rect09=Rect(-5920.0,-12736.0,-5728.0,-12576.0)
    set udg_rect10=Rect(-5920.0,-11872.0,-5728.0,-11712.0)
    set udg_rect11=Rect(-480.0,-10752.0,352.0,-10112.0)
    set udg_rect12=Rect(-7776.0,-14336.0,9056.0,-6688.0)
    set udg_rect13=Rect(-6432.0,-7840.0,-5504.0,-6912.0)
    set udg_rect14=Rect(5024.0,-8128.0,6080.0,-7072.0)
    set udg_rect15=Rect(-864.0,-9024.0,224.0,-7936.0)
    set udg_rect16=Rect(-3744.0,-8480.0,-2752.0,-7456.0)
    set udg_rect17=Rect(2272.0,-8352.0,3232.0,-7296.0)
    set udg_rect18=Rect(-6112.0,16544.0,-5472.0,16928.0)
    set udg_rect19=Rect(5408.0,15392.0,6048.0,15776.0)
    set udg_rect20=Rect(-1088.0,15584.0,-448.0,15968.0)
    set udg_rect21=Rect(-3680.0,16128.0,-3040.0,16512.0)
    set udg_rect22=Rect(2272.0,15520.0,2912.0,15904.0)
    set udg_rect23=Rect(320.0,-10048.0,736.0,-9696.0)
    set udg_rect24=Rect(5344.0,14688.0,6176.0,15520.0)
    set udg_rect25=Rect(-640.0,14816.0,192.0,15648.0)
    set udg_rect26=Rect(-6240.0,15968.0,-5408.0,16800.0)
    set udg_rect27=Rect(-3744.0,15520.0,-2912.0,16352.0)
    set udg_rect28=Rect(-1568.0,14816.0,-736.0,15648.0)
    set udg_rect29=Rect(2208.0,14816.0,3040.0,15648.0)
    set udg_rect30=Rect(-6656.0,5824.0,-5728.0,6752.0)
    set udg_rect31=Rect(4512.0,5440.0,5440.0,6304.0)
    set udg_rect32=Rect(-1184.0,5568.0,-256.0,6432.0)
    set udg_rect33=Rect(-3744.0,5152.0,-2848.0,6048.0)
    set udg_rect34=Rect(1760.0,5600.0,2688.0,6464.0)
    set udg_rect35=Rect(-8928.0,1728.0,8544.0,8160.0)
    set we=AddWeatherEffect(udg_rect35,'SNbs')
    call EnableWeatherEffect(we,true)
    set udg_rect36=Rect(-416.0,-9376.0,-224.0,-9184.0)
    set udg_rect37=Rect(-704.0,15744.0,192.0,16256.0)
endfunction

function Trig_Initialization_Func012002 takes nothing returns nothing
    call ForceAddPlayerSimple(GetEnumPlayer(),udg_force01)
endfunction

function Trig_Initialization_Func022C takes nothing returns boolean
    if(not(GetPlayerSlotState(Player(0))==PLAYER_SLOT_STATE_PLAYING))then
        return false
    endif
    if(not(GetPlayerController(Player(0))==MAP_CONTROL_USER))then
        return false
    endif
    return true
endfunction

function Trig_Initialization_Actions takes nothing returns nothing
    call SetTimeOfDay(6.00)
    call UseTimeOfDayBJ(false)
    set udg_group01=GetUnitsInRectAll(GetPlayableMapRect())
    call CreateFogModifierRectBJ(true,Player(10),FOG_OF_WAR_VISIBLE,udg_rect12)
   
    call ConditionalTriggerExecute(udg_trigger43)
   
    set udg_force01=GetPlayersByMapControl(MAP_CONTROL_USER)
    set udg_force02=GetPlayersByMapControl(MAP_CONTROL_COMPUTER)
    call ForceRemovePlayerSimple(Player(10),udg_force02)
    call ForceRemovePlayerSimple(Player(11),udg_force02)
    call ForForce(udg_force02,function Trig_Initialization_Func012002)
    call SetPlayerFlagBJ(PLAYER_STATE_GIVES_BOUNTY,true,Player(11))
   
    call ConditionalTriggerExecute(udg_trigger03)
    call ConditionalTriggerExecute(udg_trigger13)
    call ConditionalTriggerExecute(udg_trigger14)
    call ConditionalTriggerExecute(udg_trigger15)
    call ConditionalTriggerExecute(udg_trigger16)
   
    if(Trig_Initialization_Func022C())then
        call ConditionalTriggerExecute(udg_trigger04)
    else
        call DisplayTextToForce(GetPlayersAll(),"TRIGSTR_1100")
        call ConditionalTriggerExecute(udg_trigger06)
    endif
endfunction

function Trig_Main_Initialization_Func004A takes nothing returns nothing
    call CreateNUnitsAtLoc(1,'e000',GetEnumPlayer(),GetRandomLocInRect(udg_rect06),bj_UNIT_FACING)
endfunction

function Trig_Main_Initialization_Actions takes nothing returns nothing
   
    call QuestMessageBJ(GetPlayersAll(),bj_QUESTMESSAGE_DISCOVERED,"TRIGSTR_1560")
   
    call ForForce(udg_force01,function Trig_Main_Initialization_Func004A)
   
    call SetTimeOfDay(7.00)
    call SetTimeOfDayScalePercentBJ(135.00)
    call UseTimeOfDayBJ(true)
    set udg_boolean01=true
    call ConditionalTriggerExecute(udg_trigger11)
    call ConditionalTriggerExecute(udg_trigger12)
   
    call ConditionalTriggerExecute(udg_trigger47)
    call ConditionalTriggerExecute(udg_trigger48)
endfunction

function Trig_Champion_Setup_Actions takes nothing returns nothing
   
    set udg_integer04=7
    set udg_integers04[0]='ACav'
    set udg_integers04[1]='ACac'
    set udg_integers04[2]='SCae'
    set udg_integers04[3]='ACah'
    set udg_integers04[4]='ACua'
    set udg_integers04[5]='ACvp'
    set udg_integers04[6]='ACat'
    set udg_integers04[7]='ACba'
endfunction

function Trig_Create_Difficulty_Dialog_Actions takes nothing returns nothing
    call TriggerSleepAction(1.00)
    call DialogSetMessageBJ(udg_dialog01,"TRIGSTR_476")
    call DialogAddButtonBJ(udg_dialog01,"TRIGSTR_478")
    set udg_buttons01[0]=GetLastCreatedButtonBJ()
    call DialogAddButtonBJ(udg_dialog01,"TRIGSTR_479")
    set udg_buttons01[1]=GetLastCreatedButtonBJ()
    call DialogAddButtonBJ(udg_dialog01,"TRIGSTR_480")
    set udg_buttons01[2]=GetLastCreatedButtonBJ()
    call DialogAddButtonBJ(udg_dialog01,"TRIGSTR_486")
    set udg_buttons01[3]=GetLastCreatedButtonBJ()
    call DialogAddButtonBJ(udg_dialog01,"TRIGSTR_129")
    set udg_buttons01[4]=GetLastCreatedButtonBJ()
    call DialogDisplayBJ(true,udg_dialog01,Player(0))
    call DisplayTextToForce(GetPlayersAll(),"TRIGSTR_191")
endfunction

function Trig_Easy_Difficulty_Setup_Conditions takes nothing returns boolean
    if(not(GetClickedButtonBJ()==udg_buttons01[0]))then
        return false
    endif
    return true
endfunction

function Trig_Easy_Difficulty_Setup_Func012001002001 takes nothing returns boolean
    return(GetOwningPlayer(GetFilterUnit())==Player(11))
endfunction

function Trig_Easy_Difficulty_Setup_Func012001002002 takes nothing returns boolean
    return(IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO)==true)
endfunction

function Trig_Easy_Difficulty_Setup_Func012001002 takes nothing returns boolean
    return GetBooleanAnd(Trig_Easy_Difficulty_Setup_Func012001002001(),Trig_Easy_Difficulty_Setup_Func012001002002())
endfunction

function Trig_Easy_Difficulty_Setup_Func012A takes nothing returns nothing
    call SuspendHeroXPBJ(false,GetEnumUnit())
    call SetHeroLevelBJ(GetEnumUnit(),(GetHeroLevel(GetEnumUnit())-3),false)
endfunction

function Trig_Easy_Difficulty_Setup_Actions takes nothing returns nothing
    set udg_integer06=1
    set udg_integer11=3
    call DisplayTextToForce(GetPlayersAll(),"TRIGSTR_481")
   
    set udg_integer01=1
   
    call SetPlayerHandicapBJ(Player(10),150.00)
    call SetPlayerHandicapBJ(Player(11),50.00)
   
    call ForGroupBJ(GetUnitsInRectMatching(GetPlayableMapRect(),Condition(function Trig_Easy_Difficulty_Setup_Func012001002)),function Trig_Easy_Difficulty_Setup_Func012A)
   
    call TriggerExecute(udg_trigger02)
endfunction

function Trig_Normal_Difficulty_Setup_Conditions takes nothing returns boolean
    if(not(GetClickedButtonBJ()==udg_buttons01[1]))then
        return false
    endif
    return true
endfunction

function Trig_Normal_Difficulty_Setup_Func012001002001 takes nothing returns boolean
    return(GetOwningPlayer(GetFilterUnit())==Player(11))
endfunction

function Trig_Normal_Difficulty_Setup_Func012001002002 takes nothing returns boolean
    return(IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO)==true)
endfunction

function Trig_Normal_Difficulty_Setup_Func012001002 takes nothing returns boolean
    return GetBooleanAnd(Trig_Normal_Difficulty_Setup_Func012001002001(),Trig_Normal_Difficulty_Setup_Func012001002002())
endfunction

function Trig_Normal_Difficulty_Setup_Func012A takes nothing returns nothing
    call SuspendHeroXPBJ(false,GetEnumUnit())
    call UnitAddAbilityBJ(udg_integers04[GetRandomInt(0,udg_integer04)],GetEnumUnit())
endfunction

function Trig_Normal_Difficulty_Setup_Actions takes nothing returns nothing
    set udg_integer06=2
    set udg_integer11=9
    call DisplayTextToForce(GetPlayersAll(),"TRIGSTR_482")
   
    set udg_integer01=3
   
    call SetPlayerHandicapBJ(Player(10),80.00)
    call SetPlayerHandicapBJ(Player(11),100.00)
   
    call ForGroupBJ(GetUnitsInRectMatching(GetPlayableMapRect(),Condition(function Trig_Normal_Difficulty_Setup_Func012001002)),function Trig_Normal_Difficulty_Setup_Func012A)
   
    call TriggerExecute(udg_trigger02)
endfunction

function Trig_Hard_Difficulty_Setup_Conditions takes nothing returns boolean
    if(not(GetClickedButtonBJ()==udg_buttons01[2]))then
        return false
    endif
    return true
endfunction

function Trig_Hard_Difficulty_Setup_Func013001002001 takes nothing returns boolean
    return(GetOwningPlayer(GetFilterUnit())==Player(11))
endfunction

function Trig_Hard_Difficulty_Setup_Func013001002002 takes nothing returns boolean
    return(IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO)==true)
endfunction

function Trig_Hard_Difficulty_Setup_Func013001002 takes nothing returns boolean
    return GetBooleanAnd(Trig_Hard_Difficulty_Setup_Func013001002001(),Trig_Hard_Difficulty_Setup_Func013001002002())
endfunction

function Trig_Hard_Difficulty_Setup_Func013A takes nothing returns nothing
    call UnitAddAbilityBJ(udg_integers04[GetRandomInt(0,udg_integer04)],GetEnumUnit())
    call UnitAddAbilityBJ('A00P',GetEnumUnit())
    call SetHeroLevelBJ(GetEnumUnit(),(GetHeroLevel(GetEnumUnit())+5),false)
    call UnitAddItemByIdSwapped('srrc',GetEnumUnit())
endfunction

function Trig_Hard_Difficulty_Setup_Actions takes nothing returns nothing
    set udg_integer06=3
    set udg_integer11=20
    call DisplayTextToForce(GetPlayersAll(),"TRIGSTR_483")
   
    set udg_integer01=4
   
    call SetPlayerHandicapBJ(Player(10),75.00)
    call SetPlayerHandicapBJ(Player(11),120.00)
   
    call SetPlayerHandicapXPBJ(Player(11),50.00)
    call ForGroupBJ(GetUnitsInRectMatching(GetPlayableMapRect(),Condition(function Trig_Hard_Difficulty_Setup_Func013001002)),function Trig_Hard_Difficulty_Setup_Func013A)
   
    call TriggerExecute(udg_trigger02)
endfunction

function Trig_Insane_Difficulty_Setup_Conditions takes nothing returns boolean
    if(not(GetClickedButtonBJ()==udg_buttons01[3]))then
        return false
    endif
    return true
endfunction

function Trig_Insane_Difficulty_Setup_Func013001002001 takes nothing returns boolean
    return(GetOwningPlayer(GetFilterUnit())==Player(11))
endfunction

function Trig_Insane_Difficulty_Setup_Func013001002002 takes nothing returns boolean
    return(IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO)==true)
endfunction

function Trig_Insane_Difficulty_Setup_Func013001002 takes nothing returns boolean
    return GetBooleanAnd(Trig_Insane_Difficulty_Setup_Func013001002001(),Trig_Insane_Difficulty_Setup_Func013001002002())
endfunction

function Trig_Insane_Difficulty_Setup_Func013A takes nothing returns nothing
    call UnitAddAbilityBJ(udg_integers04[GetRandomInt(0,udg_integer04)],GetEnumUnit())
    call UnitAddAbilityBJ('A00P',GetEnumUnit())
    call SetHeroLevelBJ(GetEnumUnit(),(GetHeroLevel(GetEnumUnit())+5),false)
    call UnitAddItemByIdSwapped('ankh',GetEnumUnit())
endfunction

function Trig_Insane_Difficulty_Setup_Actions takes nothing returns nothing
    set udg_integer06=4
    set udg_integer11=30
    call DisplayTextToForce(GetPlayersAll(),"TRIGSTR_485")
   
    set udg_integer01=4
   
    call SetPlayerHandicapBJ(Player(10),75.00)
    call SetPlayerHandicapBJ(Player(11),150.00)
   
    call SetPlayerHandicapXPBJ(Player(11),120.00)
    call ForGroupBJ(GetUnitsInRectMatching(GetPlayableMapRect(),Condition(function Trig_Insane_Difficulty_Setup_Func013001002)),function Trig_Insane_Difficulty_Setup_Func013A)
   
    call TriggerExecute(udg_trigger02)
endfunction

function Trig_Impossible_Difficulty_Setup_Conditions takes nothing returns boolean
    if(not(GetClickedButtonBJ()==udg_buttons01[4]))then
        return false
    endif
    return true
endfunction

function Trig_Impossible_Difficulty_Setup_Func014001002001 takes nothing returns boolean
    return(GetOwningPlayer(GetFilterUnit())==Player(11))
endfunction

function Trig_Impossible_Difficulty_Setup_Func014001002002 takes nothing returns boolean
    return(IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO)==true)
endfunction

function Trig_Impossible_Difficulty_Setup_Func014001002 takes nothing returns boolean
    return GetBooleanAnd(Trig_Impossible_Difficulty_Setup_Func014001002001(),Trig_Impossible_Difficulty_Setup_Func014001002002())
endfunction

function Trig_Impossible_Difficulty_Setup_Func014A takes nothing returns nothing
    call UnitAddAbilityBJ(udg_integers04[GetRandomInt(0,udg_integer04)],GetEnumUnit())
    call UnitAddAbilityBJ(udg_integers04[GetRandomInt(0,udg_integer04)],GetEnumUnit())
    call UnitAddAbilityBJ('A006',GetEnumUnit())
    call UnitAddAbilityBJ('A00P',GetEnumUnit())
    call SetHeroLevelBJ(GetEnumUnit(),(GetHeroLevel(GetEnumUnit())+15),false)
    call UnitAddItemByIdSwapped('srrc',GetEnumUnit())
    call UnitAddItemByIdSwapped('ankh',GetEnumUnit())
endfunction

function Trig_Impossible_Difficulty_Setup_Actions takes nothing returns nothing
    set udg_integer06=5
    set udg_integer11=999
    call DisplayTextToForce(GetPlayersAll(),"TRIGSTR_127")
    call DisplayTextToForce(GetPlayersAll(),"TRIGSTR_128")
   
    set udg_integer01=5
   
    call SetPlayerHandicapBJ(Player(10),50.00)
    call SetPlayerHandicapBJ(Player(11),175.00)
   
    call SetPlayerHandicapXPBJ(Player(11),120.00)
    call ForGroupBJ(GetUnitsInRectMatching(GetPlayableMapRect(),Condition(function Trig_Impossible_Difficulty_Setup_Func014001002)),function Trig_Impossible_Difficulty_Setup_Func014A)
   
    call TriggerExecute(udg_trigger02)
endfunction

function Trig_Level_Increase_Conditions takes nothing returns boolean
    if(not(udg_boolean02==false))then
        return false
    endif
    if(not(udg_boolean01==true))then
        return false
    endif
    return true
endfunction

function Trig_Level_Increase_Func002Func004C takes nothing returns boolean
    if(not(udg_integer01>udg_integer09))then
        return false
    endif
    return true
endfunction

function Trig_Level_Increase_Func002Func006001 takes nothing returns boolean
    return(udg_strings01[udg_integer01]!="")
endfunction

function Trig_Level_Increase_Func002C takes nothing returns boolean
    if(not(udg_integer05>=(50+(udg_integer01*25))))then
        return false
    endif
    return true
endfunction

function Trig_Level_Increase_Actions takes nothing returns nothing
    set udg_integer05=(udg_integer05+1)
    if(Trig_Level_Increase_Func002C())then
        set udg_integer05=0
        set udg_integer01=(udg_integer01+1)
       
        if(Trig_Level_Increase_Func002Func004C())then
            set udg_integer01=1
            set udg_boolean03=true
        else
        endif
        call DisplayTextToForce(GetPlayersAll(),("|cffff0000WARNING!|r The wave units have increased in difficulty. You are now on level |cffffcc00"+(I2S(udg_integer01)+"|r!")))
        if(Trig_Level_Increase_Func002Func006001())then
            call DisplayTextToForce(GetPlayersAll(),("|cffffcc00NOTICE: |r"+udg_strings01[udg_integer01]))
        else
            call DoNothing()
        endif
    else
    endif
endfunction

function Trig_Human_Spawning_Func001001001002 takes nothing returns boolean
    return(IsUnitInGroup(GetFilterUnit(),udg_group01)==false)
endfunction

function Trig_Human_Spawning_Conditions takes nothing returns boolean
    if(not(CountUnitsInGroup(GetUnitsOfPlayerMatching(Player(10),Condition(function Trig_Human_Spawning_Func001001001002)))<120))then
        return false
    endif
    if(not(udg_boolean02==false))then
        return false
    endif
    if(not(udg_boolean01==true))then
        return false
    endif
    return true
endfunction

function Trig_Human_Spawning_Func004Func001Func006001 takes nothing returns boolean
    return(udg_integer03==5)
endfunction

function Trig_Human_Spawning_Func004Func001Func008001 takes nothing returns boolean
    return(udg_boolean03==true)
endfunction

function Trig_Human_Spawning_Func004Func001Func010Func002002001002001 takes nothing returns boolean
    return(GetOwningPlayer(GetFilterUnit())==Player(10))
endfunction

function Trig_Human_Spawning_Func004Func001Func010Func002002001002002 takes nothing returns boolean
    return(IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)==false)
endfunction

function Trig_Human_Spawning_Func004Func001Func010Func002002001002 takes nothing returns boolean
    return GetBooleanAnd(Trig_Human_Spawning_Func004Func001Func010Func002002001002001(),Trig_Human_Spawning_Func004Func001Func010Func002002001002002())
endfunction

function Trig_Human_Spawning_Func004Func001Func010C takes nothing returns boolean
    if(not(udg_integer03==5))then
        return false
    endif
    return true
endfunction

function Trig_Human_Spawning_Func004Func001Func012001002001 takes nothing returns boolean
    return(GetOwningPlayer(GetFilterUnit())==Player(10))
endfunction

function Trig_Human_Spawning_Func004Func001Func012001002002001 takes nothing returns boolean
    return(IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)==false)
endfunction

function Trig_Human_Spawning_Func004Func001Func012001002002002 takes nothing returns boolean
    return(IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO)==false)
endfunction

function Trig_Human_Spawning_Func004Func001Func012001002002 takes nothing returns boolean
    return GetBooleanAnd(Trig_Human_Spawning_Func004Func001Func012001002002001(),Trig_Human_Spawning_Func004Func001Func012001002002002())
endfunction

function Trig_Human_Spawning_Func004Func001Func012001002 takes nothing returns boolean
    return GetBooleanAnd(Trig_Human_Spawning_Func004Func001Func012001002001(),Trig_Human_Spawning_Func004Func001Func012001002002())
endfunction

function Trig_Human_Spawning_Func004Func001Func012A takes nothing returns nothing
    call SetUnitManaPercentBJ(GetEnumUnit(),100)
    call IssuePointOrderLocBJ(GetEnumUnit(),"attack",GetRectCenter(udg_rects02[GetForLoopIndexA()]))
endfunction

function Trig_Human_Spawning_Func004Func001C takes nothing returns boolean
    return true
endfunction

function Trig_Human_Spawning_Actions takes nothing returns nothing
    set bj_forLoopAIndex=0
    set bj_forLoopAIndexEnd=4
    loop
        exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
        if(Trig_Human_Spawning_Func004Func001C())then
           
            call CreateNUnitsAtLoc(3,udg_integers05[udg_integer01],Player(10),GetRectCenter(udg_rects01[GetForLoopIndexA()]),bj_UNIT_FACING)
            call CreateNUnitsAtLoc(2,udg_integers06[udg_integer01],Player(10),GetRectCenter(udg_rects01[GetForLoopIndexA()]),bj_UNIT_FACING)
           
            set udg_integer03=GetRandomInt(1,5)
            if(Trig_Human_Spawning_Func004Func001Func006001())then
                call CreateNUnitsAtLoc(1,udg_integers07[udg_integer01],Player(10),GetRectCenter(udg_rects01[GetForLoopIndexA()]),bj_UNIT_FACING)
            else
                call DoNothing()
            endif
           
            if(Trig_Human_Spawning_Func004Func001Func008001())then
                set udg_integer03=GetRandomInt(1,5)
            else
                set udg_integer03=0
            endif
            set udg_integer03=GetRandomInt(1,5)
            if(Trig_Human_Spawning_Func004Func001Func010C())then
               
                set udg_unit01=GroupPickRandomUnit(GetUnitsInRectMatching(udg_rects01[GetForLoopIndexA()],Condition(function Trig_Human_Spawning_Func004Func001Func010Func002002001002)))
               
                call UnitAddAbilityBJ('A009',udg_unit01)
               
                call UnitAddAbilityBJ(udg_integers04[GetRandomInt(0,udg_integer04)],udg_unit01)
               
                call AddSpecialEffectTargetUnitBJ("weapon",udg_unit01,"Abilities\\Spells\\Items\\AIfb\\AIfbTarget.mdl")
                call SetUnitScalePercent(udg_unit01,150.00,150.00,150.00)
               
                call SetUnitExplodedBJ(udg_unit01,true)
            else
            endif
           
            call ForGroupBJ(GetUnitsInRectMatching(udg_rects01[GetForLoopIndexA()],Condition(function Trig_Human_Spawning_Func004Func001Func012001002)),function Trig_Human_Spawning_Func004Func001Func012A)
        else
        endif
        set bj_forLoopAIndex=bj_forLoopAIndex+1
    endloop
endfunction

function Trig_Undead_Spawning_Func001001001002 takes nothing returns boolean
    return(IsUnitInGroup(GetFilterUnit(),udg_group01)==false)
endfunction

function Trig_Undead_Spawning_Conditions takes nothing returns boolean
    if(not(CountUnitsInGroup(GetUnitsOfPlayerMatching(Player(11),Condition(function Trig_Undead_Spawning_Func001001001002)))<140))then
        return false
    endif
    if(not(udg_boolean02==false))then
        return false
    endif
    if(not(udg_boolean01==true))then
        return false
    endif
    return true
endfunction

function Trig_Undead_Spawning_Func004Func001Func006001 takes nothing returns boolean
    return(udg_integer03==5)
endfunction

function Trig_Undead_Spawning_Func004Func001Func008Func001001002001 takes nothing returns boolean
    return(GetOwningPlayer(GetFilterUnit())==Player(11))
endfunction

function Trig_Undead_Spawning_Func004Func001Func008Func001001002002001 takes nothing returns boolean
    return(IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)==false)
endfunction

function Trig_Undead_Spawning_Func004Func001Func008Func001001002002002 takes nothing returns boolean
    return(IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO)==false)
endfunction

function Trig_Undead_Spawning_Func004Func001Func008Func001001002002 takes nothing returns boolean
    return GetBooleanAnd(Trig_Undead_Spawning_Func004Func001Func008Func001001002002001(),Trig_Undead_Spawning_Func004Func001Func008Func001001002002002())
endfunction

function Trig_Undead_Spawning_Func004Func001Func008Func001001002 takes nothing returns boolean
    return GetBooleanAnd(Trig_Undead_Spawning_Func004Func001Func008Func001001002001(),Trig_Undead_Spawning_Func004Func001Func008Func001001002002())
endfunction

function Trig_Undead_Spawning_Func004Func001Func008Func001A takes nothing returns nothing
    call UnitAddAbilityBJ('A00P',GetEnumUnit())
    call UnitAddAbilityBJ('A00Q',GetEnumUnit())
endfunction

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

function Trig_Undead_Spawning_Func004Func001Func010001 takes nothing returns boolean
    return(udg_boolean03==false)
endfunction

function Trig_Undead_Spawning_Func004Func001Func011Func002002001002001001 takes nothing returns boolean
    return(GetOwningPlayer(GetFilterUnit())==Player(11))
endfunction

function Trig_Undead_Spawning_Func004Func001Func011Func002002001002001002 takes nothing returns boolean
    return(IsUnitInGroup(GetFilterUnit(),udg_group01)==false)
endfunction

function Trig_Undead_Spawning_Func004Func001Func011Func002002001002001 takes nothing returns boolean
    return GetBooleanAnd(Trig_Undead_Spawning_Func004Func001Func011Func002002001002001001(),Trig_Undead_Spawning_Func004Func001Func011Func002002001002001002())
endfunction

function Trig_Undead_Spawning_Func004Func001Func011Func002002001002002001 takes nothing returns boolean
    return(IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)==false)
endfunction

function Trig_Undead_Spawning_Func004Func001Func011Func002002001002002002 takes nothing returns boolean
    return(IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO)==false)
endfunction

function Trig_Undead_Spawning_Func004Func001Func011Func002002001002002 takes nothing returns boolean
    return GetBooleanAnd(Trig_Undead_Spawning_Func004Func001Func011Func002002001002002001(),Trig_Undead_Spawning_Func004Func001Func011Func002002001002002002())
endfunction

function Trig_Undead_Spawning_Func004Func001Func011Func002002001002 takes nothing returns boolean
    return GetBooleanAnd(Trig_Undead_Spawning_Func004Func001Func011Func002002001002001(),Trig_Undead_Spawning_Func004Func001Func011Func002002001002002())
endfunction

function Trig_Undead_Spawning_Func004Func001Func011C takes nothing returns boolean
    if(not(udg_integer03==5))then
        return false
    endif
    return true
endfunction

function Trig_Undead_Spawning_Func004Func001Func013001002001001 takes nothing returns boolean
    return(GetOwningPlayer(GetFilterUnit())==Player(11))
endfunction

function Trig_Undead_Spawning_Func004Func001Func013001002001002 takes nothing returns boolean
    return(IsUnitInGroup(GetFilterUnit(),udg_group01)==false)
endfunction

function Trig_Undead_Spawning_Func004Func001Func013001002001 takes nothing returns boolean
    return GetBooleanAnd(Trig_Undead_Spawning_Func004Func001Func013001002001001(),Trig_Undead_Spawning_Func004Func001Func013001002001002())
endfunction

function Trig_Undead_Spawning_Func004Func001Func013001002002001 takes nothing returns boolean
    return(IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)==false)
endfunction

function Trig_Undead_Spawning_Func004Func001Func013001002002002 takes nothing returns boolean
    return(IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO)==false)
endfunction

function Trig_Undead_Spawning_Func004Func001Func013001002002 takes nothing returns boolean
    return GetBooleanAnd(Trig_Undead_Spawning_Func004Func001Func013001002002001(),Trig_Undead_Spawning_Func004Func001Func013001002002002())
endfunction

function Trig_Undead_Spawning_Func004Func001Func013001002 takes nothing returns boolean
    return GetBooleanAnd(Trig_Undead_Spawning_Func004Func001Func013001002001(),Trig_Undead_Spawning_Func004Func001Func013001002002())
endfunction

function Trig_Undead_Spawning_Func004Func001Func013A takes nothing returns nothing
    call SetUnitManaPercentBJ(GetEnumUnit(),100)
    call IssuePointOrderLocBJ(GetEnumUnit(),"attack",GetRectCenter(udg_rects04[GetForLoopIndexA()]))
endfunction

function Trig_Undead_Spawning_Func004Func001Func014001001002 takes nothing returns boolean
    return(GetUnitTypeId(GetFilterUnit())=='usep')
endfunction

function Trig_Undead_Spawning_Func004Func001C takes nothing returns boolean
    if(not(CountUnitsInGroup(GetUnitsInRectMatching(udg_rects03[GetForLoopIndexA()],Condition(function Trig_Undead_Spawning_Func004Func001Func014001001002)))>=1))then
        return false
    endif
    return true
endfunction

function Trig_Undead_Spawning_Actions takes nothing returns nothing
    set bj_forLoopAIndex=1
    set bj_forLoopAIndexEnd=11
    loop
        exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
        if(Trig_Undead_Spawning_Func004Func001C())then
           
            call CreateNUnitsAtLoc(3,udg_integers01[udg_integer01],Player(11),GetRectCenter(udg_rects03[GetForLoopIndexA()]),bj_UNIT_FACING)
            call CreateNUnitsAtLoc(2,udg_integers03[udg_integer01],Player(11),GetRectCenter(udg_rects03[GetForLoopIndexA()]),bj_UNIT_FACING)
           
            set udg_integer03=GetRandomInt(1,5)
            if(Trig_Undead_Spawning_Func004Func001Func006001())then
                call CreateNUnitsAtLoc(1,udg_integers02[udg_integer01],Player(11),GetRectCenter(udg_rects03[GetForLoopIndexA()]),bj_UNIT_FACING)
            else
                call DoNothing()
            endif
           
            if(Trig_Undead_Spawning_Func004Func001Func008C())then
                call ForGroupBJ(GetUnitsInRectMatching(udg_rects03[GetForLoopIndexA()],Condition(function Trig_Undead_Spawning_Func004Func001Func008Func001001002)),function Trig_Undead_Spawning_Func004Func001Func008Func001A)
            else
            endif
           
            if(Trig_Undead_Spawning_Func004Func001Func010001())then
                set udg_integer03=GetRandomInt(1,5)
            else
                set udg_integer03=GetRandomInt(3,5)
            endif
            if(Trig_Undead_Spawning_Func004Func001Func011C())then
               
                set udg_unit01=GroupPickRandomUnit(GetUnitsInRectMatching(udg_rects03[GetForLoopIndexA()],Condition(function Trig_Undead_Spawning_Func004Func001Func011Func002002001002)))
               
                call UnitAddAbilityBJ('A004',udg_unit01)
                call UnitAddAbilityBJ('A006',udg_unit01)
                call UnitAddAbilityBJ('A005',udg_unit01)
               
                call UnitAddAbilityBJ(udg_integers04[GetRandomInt(0,udg_integer04)],udg_unit01)
               
                call AddSpecialEffectTargetUnitBJ("weapon",udg_unit01,"Abilities\\Spells\\Items\\AIob\\AIobTarget.mdl")
                call SetUnitVertexColorBJ(udg_unit01,GetRandomReal(20.00,100.00),GetRandomReal(20.00,100.00),GetRandomReal(20.00,100.00),0)
                call SetUnitScalePercent(udg_unit01,150.00,150.00,150.00)
               
                call SetUnitExplodedBJ(udg_unit01,true)
               
                call SetUnitUserData(udg_unit01,1)
            else
            endif
           
            call ForGroupBJ(GetUnitsInRectMatching(udg_rects03[GetForLoopIndexA()],Condition(function Trig_Undead_Spawning_Func004Func001Func013001002)),function Trig_Undead_Spawning_Func004Func001Func013A)
        else
        endif
        set bj_forLoopAIndex=bj_forLoopAIndex+1
    endloop
endfunction

function Trig_Human_Spawn_Setup_Actions takes nothing returns nothing
   
    set udg_rects01[0]=udg_rect13
    set udg_rects02[0]=udg_rect18
    set udg_rects01[1]=udg_rect16
    set udg_rects02[1]=udg_rect21
    set udg_rects01[2]=udg_rect15
    set udg_rects02[2]=udg_rect20
    set udg_rects01[3]=udg_rect17
    set udg_rects02[3]=udg_rect22
    set udg_rects01[4]=udg_rect14
    set udg_rects02[4]=udg_rect19
endfunction

function Trig_Undead_Spawn_Setup_Actions takes nothing returns nothing
   
    set udg_rects03[1]=udg_rect30
    set udg_rects04[1]=udg_rect13
    set udg_rects03[2]=udg_rect33
    set udg_rects04[2]=udg_rect16
    set udg_rects03[3]=udg_rect32
    set udg_rects04[3]=udg_rect15
    set udg_rects03[4]=udg_rect34
    set udg_rects04[4]=udg_rect17
    set udg_rects03[5]=udg_rect31
    set udg_rects04[5]=udg_rect14
   
    set udg_rects03[6]=udg_rect26
    set udg_rects04[6]=udg_rect13
    set udg_rects03[7]=udg_rect27
    set udg_rects04[7]=udg_rect16
    set udg_rects03[8]=udg_rect28
    set udg_rects04[8]=udg_rect15
    set udg_rects03[9]=udg_rect29
    set udg_rects04[9]=udg_rect17
    set udg_rects03[10]=udg_rect24
    set udg_rects04[10]=udg_rect14
   
    set udg_rects03[11]=udg_rect25
    set udg_rects04[11]=udg_rect15
endfunction

function Trig_Human_Wave_Setup_Actions takes nothing returns nothing
   
    set udg_integer02=1
   
    set udg_integers05[udg_integer02]='hfoo'
    set udg_integers06[udg_integer02]='hrif'
    set udg_integers07[udg_integer02]='hcth'
    set udg_integer02=(udg_integer02+1)
    set udg_integers05[udg_integer02]='hfoo'
    set udg_integers06[udg_integer02]='hmtm'
    set udg_integers07[udg_integer02]='hkni'
    set udg_integer02=(udg_integer02+1)
    set udg_integers05[udg_integer02]='hcth'
    set udg_integers06[udg_integer02]='hmpr'
    set udg_integers07[udg_integer02]='hsor'
    set udg_integer02=(udg_integer02+1)
    set udg_integers05[udg_integer02]='nbel'
    set udg_integers06[udg_integer02]='hsor'
    set udg_integers07[udg_integer02]='hspt'
    set udg_integer02=(udg_integer02+1)
   
    set udg_integers05[udg_integer02]='hspt'
    set udg_integers06[udg_integer02]='hrif'
    set udg_integers07[udg_integer02]='nbel'
    set udg_integer02=(udg_integer02+1)
    set udg_integers05[udg_integer02]='esen'
    set udg_integers06[udg_integer02]='nhea'
    set udg_integers07[udg_integer02]='hsor'
    set udg_integer02=(udg_integer02+1)
    set udg_integers05[udg_integer02]='hspt'
    set udg_integers06[udg_integer02]='hrif'
    set udg_integers07[udg_integer02]='nbel'
    set udg_integer02=(udg_integer02+1)
    set udg_integers05[udg_integer02]='hfoo'
    set udg_integers06[udg_integer02]='earc'
    set udg_integers07[udg_integer02]='edry'
    set udg_integer02=(udg_integer02+1)
    set udg_integers05[udg_integer02]='hkni'
    set udg_integers06[udg_integer02]='hgry'
    set udg_integers07[udg_integer02]='hmpr'
    set udg_integer02=(udg_integer02+1)
   
    set udg_integers05[udg_integer02]='earc'
    set udg_integers06[udg_integer02]='hrif'
    set udg_integers07[udg_integer02]='nhea'
    set udg_integer02=(udg_integer02+1)
    set udg_integers05[udg_integer02]='hfoo'
    set udg_integers06[udg_integer02]='hmtm'
    set udg_integers07[udg_integer02]='hkni'
    set udg_integer02=(udg_integer02+1)
    set udg_integers05[udg_integer02]='hfoo'
    set udg_integers06[udg_integer02]='hmtm'
    set udg_integers07[udg_integer02]='hkni'
    set udg_integer02=(udg_integer02+1)
    set udg_integers05[udg_integer02]='hfoo'
    set udg_integers06[udg_integer02]='hmtm'
    set udg_integers07[udg_integer02]='hkni'
    set udg_integer02=(udg_integer02+1)
    set udg_integers05[udg_integer02]='hfoo'
    set udg_integers06[udg_integer02]='hmtm'
    set udg_integers07[udg_integer02]='hkni'
    set udg_integer02=(udg_integer02+1)
   
    set udg_integers05[udg_integer02]='hfoo'
    set udg_integers06[udg_integer02]='hmtm'
    set udg_integers07[udg_integer02]='hkni'
    set udg_integer02=(udg_integer02+1)
    set udg_integers05[udg_integer02]='hfoo'
    set udg_integers06[udg_integer02]='hmtm'
    set udg_integers07[udg_integer02]='hkni'
    set udg_integer02=(udg_integer02+1)
    set udg_integers05[udg_integer02]='hfoo'
    set udg_integers06[udg_integer02]='hmtm'
    set udg_integers07[udg_integer02]='hkni'
    set udg_integer02=(udg_integer02+1)
    set udg_integers05[udg_integer02]='hfoo'
    set udg_integers06[udg_integer02]='hmtm'
    set udg_integers07[udg_integer02]='hkni'
    set udg_integer02=(udg_integer02+1)
    set udg_integers05[udg_integer02]='hfoo'
    set udg_integers06[udg_integer02]='hmtm'
    set udg_integers07[udg_integer02]='hkni'
    set udg_integer02=(udg_integer02+1)
   
    set udg_integers05[udg_integer02]='hfoo'
    set udg_integers06[udg_integer02]='hmtm'
    set udg_integers07[udg_integer02]='hkni'
endfunction

function Trig_Undead_Wave_Setup_Actions takes nothing returns nothing
   
    set udg_integer02=1
   
    set udg_integers01[udg_integer02]='uske'
    set udg_integers03[udg_integer02]='ugho'
    set udg_integers02[udg_integer02]='uskm'
    set udg_strings01[udg_integer02]="|cff00ccffWaves are now repeating, but be careful as the units are a lot more resistant to your attacks."
    set udg_integer02=(udg_integer02+1)
    set udg_integers01[udg_integer02]='ugho'
    set udg_integers03[udg_integer02]='uskm'
    set udg_integers02[udg_integer02]='nskf'
    set udg_strings01[udg_integer02]=""
    set udg_integer02=(udg_integer02+1)
    set udg_integers01[udg_integer02]='nrvf'
    set udg_integers03[udg_integer02]='nsgt'
    set udg_integers02[udg_integer02]='uabo'
    set udg_strings01[udg_integer02]=""
    set udg_integer02=(udg_integer02+1)
    set udg_integers01[udg_integer02]='nrvs'
    set udg_integers03[udg_integer02]='ncen'
    set udg_integers02[udg_integer02]='ucry'
    set udg_strings01[udg_integer02]="Buy Keep Defence upgrades at the Useful Item Merchant to increase your Keeps defensive and attack power!"
    set udg_integer02=(udg_integer02+1)
   
    set udg_integers01[udg_integer02]='nsog'
    set udg_integers03[udg_integer02]='uabo'
    set udg_integers02[udg_integer02]='ugar'
    set udg_strings01[udg_integer02]=""
    set udg_integer02=(udg_integer02+1)
    set udg_integers01[udg_integer02]='ndqv'
    set udg_integers03[udg_integer02]='ndqt'
    set udg_integers02[udg_integer02]='ndqp'
    set udg_strings01[udg_integer02]=""
    set udg_integer02=(udg_integer02+1)
    set udg_integers01[udg_integer02]='ntrh'
    set udg_integers03[udg_integer02]='ntrs'
    set udg_integers02[udg_integer02]='n005'
    set udg_strings01[udg_integer02]="|cffccffccTurtle power!"
    set udg_integer02=(udg_integer02+1)
    set udg_integers01[udg_integer02]='u006'
    set udg_integers03[udg_integer02]='ugho'
    set udg_integers02[udg_integer02]='u007'
    set udg_strings01[udg_integer02]=""
    set udg_integer02=(udg_integer02+1)
    set udg_integers01[udg_integer02]='nwwd'
    set udg_integers03[udg_integer02]='nplg'
    set udg_integers02[udg_integer02]='nfpu'
    set udg_strings01[udg_integer02]=""
    set udg_integer02=(udg_integer02+1)
   
    set udg_integers01[udg_integer02]='nfel'
    set udg_integers03[udg_integer02]='nvdg'
    set udg_integers02[udg_integer02]='ufro'
    set udg_strings01[udg_integer02]="Orbs that allow melee to attack air are available at the Useful Item Merchant."
    set udg_integer02=(udg_integer02+1)
    set udg_integers01[udg_integer02]='nmgw'
    set udg_integers03[udg_integer02]='n005'
    set udg_integers02[udg_integer02]='nndr'
    set udg_strings01[udg_integer02]=""
    set udg_integer02=(udg_integer02+1)
    set udg_integers01[udg_integer02]='ugho'
    set udg_integers03[udg_integer02]='ndtb'
    set udg_integers02[udg_integer02]='uabo'
    set udg_strings01[udg_integer02]=""
    set udg_integer02=(udg_integer02+1)
    set udg_integers01[udg_integer02]='u007'
    set udg_integers03[udg_integer02]='nstl'
    set udg_integers02[udg_integer02]='n007'
    set udg_strings01[udg_integer02]=""
    set udg_integer02=(udg_integer02+1)
    set udg_integers01[udg_integer02]='ugho'
    set udg_integers03[udg_integer02]='uban'
    set udg_integers02[udg_integer02]='uabo'
    set udg_strings01[udg_integer02]=""
    set udg_integer02=(udg_integer02+1)
   
    set udg_integers01[udg_integer02]='ugho'
    set udg_integers03[udg_integer02]='ninc'
    set udg_integers02[udg_integer02]='uabo'
    set udg_strings01[udg_integer02]=""
    set udg_integer02=(udg_integer02+1)
    set udg_integers01[udg_integer02]='nssp'
    set udg_integers03[udg_integer02]='nkol'
    set udg_integers02[udg_integer02]='nwrg'
    set udg_strings01[udg_integer02]=""
    set udg_integer02=(udg_integer02+1)
    set udg_integers01[udg_integer02]='ugho'
    set udg_integers03[udg_integer02]='uban'
    set udg_integers02[udg_integer02]='uabo'
    set udg_strings01[udg_integer02]=""
    set udg_integer02=(udg_integer02+1)
    set udg_integers01[udg_integer02]='ugho'
    set udg_integers03[udg_integer02]='uban'
    set udg_integers02[udg_integer02]='uabo'
    set udg_strings01[udg_integer02]=""
    set udg_integer02=(udg_integer02+1)
    set udg_integers01[udg_integer02]='ugho'
    set udg_integers03[udg_integer02]='uban'
    set udg_integers02[udg_integer02]='uabo'
    set udg_strings01[udg_integer02]=""
    set udg_integer02=(udg_integer02+1)
   
    set udg_integers01[udg_integer02]='u00A'
    set udg_integers03[udg_integer02]='ufro'
    set udg_integers02[udg_integer02]='u005'
    set udg_strings01[udg_integer02]="|cff00ccffThis is the final wave type! After this waves will repeat (only harder)."
   
    set udg_integer09=udg_integer02
endfunction

function Trig_Human_Redirect_Conditions takes nothing returns boolean
    if(not(GetOwningPlayer(GetEnteringUnit())==Player(10)))then
        return false
    endif
    return true
endfunction

function Trig_Human_Redirect_Actions takes nothing returns nothing
    call IssuePointOrderLocBJ(GetEnteringUnit(),"attack",GetUnitLoc(udg_unit04))
endfunction

function Trig_Hero_Death_Conditions takes nothing returns boolean
    if(not(IsUnitType(GetDyingUnit(),UNIT_TYPE_HERO)==true))then
        return false
    endif
    if(not(GetOwningPlayer(GetDyingUnit())!=Player(11)))then
        return false
    endif
    if(not(GetOwningPlayer(GetDyingUnit())!=Player(10)))then
        return false
    endif
    return true
endfunction

function Trig_Hero_Death_Func002C takes nothing returns boolean
    if(not(IsPlayerInForce(GetOwningPlayer(GetDyingUnit()),udg_force02)==true))then
        return false
    endif
    return true
endfunction

function Trig_Hero_Death_Actions takes nothing returns nothing
   
    if(Trig_Hero_Death_Func002C())then
        set udg_strings02[GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))]="Healing"
    else
    endif
    call DisplayTextToForce(GetForceOfPlayer(GetOwningPlayer(GetDyingUnit())),"TRIGSTR_492")
    call DisplayTextToForce(GetForceOfPlayer(GetOwningPlayer(GetDyingUnit())),"TRIGSTR_1099")
    call PolledWait(20.00)
    call ReviveHeroLoc(GetDyingUnit(),GetRectCenter(udg_rect15),true)
endfunction

function Trig_Select_I_Assassin_Conditions takes nothing returns boolean
    if(not(udg_boolean02==false))then
        return false
    endif
    if(not(udg_boolean01==true))then
        return false
    endif
    return true
endfunction

function Trig_Select_I_Assassin_Func019C takes nothing returns boolean
    if(not(udg_integer06==1))then
        return false
    endif
    return true
endfunction

function Trig_Select_I_Assassin_Func020C takes nothing returns boolean
    if(not(udg_integer06==5))then
        return false
    endif
    return true
endfunction

function Trig_Select_I_Assassin_Actions takes nothing returns nothing
   
    call RemoveUnit(GetEnteringUnit())
    call CreateNUnitsAtLoc(1,'E001',GetOwningPlayer(GetEnteringUnit()),GetRectCenter(udg_rect11),bj_UNIT_FACING)
    set udg_units01[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]=GetLastCreatedUnit()
   
    set udg_integers09[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='A00H'
    set udg_integers10[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='A00U'
    set udg_integers11[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='A00F'
    set udg_integers12[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='A00C'
   
    set udg_integers13[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='I000'
   
    call UnitAddItemByIdSwapped('ankh',GetLastCreatedUnit())
    call UnitAddItemByIdSwapped('pghe',GetLastCreatedUnit())
    call UnitAddItemByIdSwapped('pgma',GetLastCreatedUnit())
   
    if(Trig_Select_I_Assassin_Func019C())then
        call UnitAddItemByIdSwapped('I00N',GetLastCreatedUnit())
    else
    endif
    if(Trig_Select_I_Assassin_Func020C())then
        call UnitAddItemByIdSwapped('I00O',GetLastCreatedUnit())
    else
    endif
   
    call SetPlayerName(GetOwningPlayer(GetEnteringUnit()),(GetPlayerName(GetOwningPlayer(GetEnteringUnit()))+" (Assassin)"))
   
    call AddSpecialEffectTargetUnitBJ("origin",GetLastCreatedUnit(),"Abilities\\Spells\\Human\\ReviveHuman\\ReviveHuman.mdl")
    call PanCameraToTimedLocForPlayer(GetOwningPlayer(GetEnteringUnit()),GetRectCenter(udg_rect11),0.00)
    call SelectUnitAddForPlayer(GetLastCreatedUnit(),GetOwningPlayer(GetEnteringUnit()))
endfunction

function Trig_Select_I_Attack_Goblin_Conditions takes nothing returns boolean
    if(not(udg_boolean02==false))then
        return false
    endif
    if(not(udg_boolean01==true))then
        return false
    endif
    return true
endfunction

function Trig_Select_I_Attack_Goblin_Func019C takes nothing returns boolean
    if(not(udg_integer06==1))then
        return false
    endif
    return true
endfunction

function Trig_Select_I_Attack_Goblin_Func020C takes nothing returns boolean
    if(not(udg_integer06==5))then
        return false
    endif
    return true
endfunction

function Trig_Select_I_Attack_Goblin_Actions takes nothing returns nothing
   
    call RemoveUnit(GetEnteringUnit())
    call CreateNUnitsAtLoc(1,'H001',GetOwningPlayer(GetEnteringUnit()),GetRectCenter(udg_rect11),bj_UNIT_FACING)
    set udg_units01[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]=GetLastCreatedUnit()
   
    set udg_integers09[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='A008'
    set udg_integers10[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='A00R'
    set udg_integers11[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='A00D'
    set udg_integers12[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='A00L'
   
    set udg_integers13[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='I007'
   
    call UnitAddItemByIdSwapped('ankh',GetLastCreatedUnit())
    call UnitAddItemByIdSwapped('pghe',GetLastCreatedUnit())
    call UnitAddItemByIdSwapped('pgma',GetLastCreatedUnit())
   
    if(Trig_Select_I_Attack_Goblin_Func019C())then
        call UnitAddItemByIdSwapped('I00N',GetLastCreatedUnit())
    else
    endif
    if(Trig_Select_I_Attack_Goblin_Func020C())then
        call UnitAddItemByIdSwapped('I00O',GetLastCreatedUnit())
    else
    endif
   
    call SetPlayerName(GetOwningPlayer(GetEnteringUnit()),(GetPlayerName(GetOwningPlayer(GetEnteringUnit()))+" (Attack Goblin)"))
   
    call AddSpecialEffectTargetUnitBJ("origin",GetLastCreatedUnit(),"Abilities\\Spells\\Human\\ReviveHuman\\ReviveHuman.mdl")
    call PanCameraToTimedLocForPlayer(GetOwningPlayer(GetEnteringUnit()),GetRectCenter(udg_rect11),0.00)
    call SelectUnitAddForPlayer(GetLastCreatedUnit(),GetOwningPlayer(GetEnteringUnit()))
endfunction

function Trig_Select_I_Sorceress_Conditions takes nothing returns boolean
    if(not(udg_boolean02==false))then
        return false
    endif
    if(not(udg_boolean01==true))then
        return false
    endif
    if(not(GetUnitTypeId(GetEnteringUnit())=='e000'))then
        return false
    endif
    return true
endfunction

function Trig_Select_I_Sorceress_Func020C takes nothing returns boolean
    if(not(udg_integer06==1))then
        return false
    endif
    return true
endfunction

function Trig_Select_I_Sorceress_Func021C takes nothing returns boolean
    if(not(udg_integer06==5))then
        return false
    endif
    return true
endfunction

function Trig_Select_I_Sorceress_Actions takes nothing returns nothing
   
    call RemoveUnit(GetEnteringUnit())
    call CreateNUnitsAtLoc(1,'H000',GetOwningPlayer(GetEnteringUnit()),GetRectCenter(udg_rect11),bj_UNIT_FACING)
    set udg_units01[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]=GetLastCreatedUnit()
   
    set udg_integers09[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='A00X'
    set udg_integers10[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='A00T'
    set udg_integers11[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='A00V'
    set udg_integers12[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='A00Y'
   
    set udg_integers13[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='I007'
   
    call UnitAddItemByIdSwapped('ankh',GetLastCreatedUnit())
    call UnitAddItemByIdSwapped('pghe',GetLastCreatedUnit())
    call UnitAddItemByIdSwapped('pgma',GetLastCreatedUnit())
   
    if(Trig_Select_I_Sorceress_Func020C())then
        call UnitAddItemByIdSwapped('I00N',GetLastCreatedUnit())
    else
    endif
    if(Trig_Select_I_Sorceress_Func021C())then
        call UnitAddItemByIdSwapped('I00O',GetLastCreatedUnit())
    else
    endif
   
    call SetPlayerName(GetOwningPlayer(GetEnteringUnit()),(GetPlayerName(GetOwningPlayer(GetEnteringUnit()))+" (Sorceress)"))
   
    call AddSpecialEffectTargetUnitBJ("origin",GetLastCreatedUnit(),"Abilities\\Spells\\Human\\ReviveHuman\\ReviveHuman.mdl")
    call PanCameraToTimedLocForPlayer(GetOwningPlayer(GetEnteringUnit()),GetRectCenter(udg_rect11),0.00)
    call SelectUnitAddForPlayer(GetLastCreatedUnit(),GetOwningPlayer(GetEnteringUnit()))
endfunction

function Trig_Select_I_Savage_Conditions takes nothing returns boolean
    if(not(udg_boolean02==false))then
        return false
    endif
    if(not(udg_boolean01==true))then
        return false
    endif
    if(not(GetUnitTypeId(GetEnteringUnit())=='e000'))then
        return false
    endif
    return true
endfunction

function Trig_Select_I_Savage_Func020C takes nothing returns boolean
    if(not(udg_integer06==1))then
        return false
    endif
    return true
endfunction

function Trig_Select_I_Savage_Func021C takes nothing returns boolean
    if(not(udg_integer06==5))then
        return false
    endif
    return true
endfunction

function Trig_Select_I_Savage_Actions takes nothing returns nothing
   
    call RemoveUnit(GetEnteringUnit())
    call CreateNUnitsAtLoc(1,'H002',GetOwningPlayer(GetEnteringUnit()),GetRectCenter(udg_rect11),bj_UNIT_FACING)
    set udg_units01[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]=GetLastCreatedUnit()
   
    set udg_integers09[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='A016'
    set udg_integers10[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='A017'
    set udg_integers11[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='A00Z'
    set udg_integers12[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='A018'
   
    set udg_integers13[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='I00B'
   
    call UnitAddItemByIdSwapped('ankh',GetLastCreatedUnit())
    call UnitAddItemByIdSwapped('pghe',GetLastCreatedUnit())
    call UnitAddItemByIdSwapped('pgma',GetLastCreatedUnit())
   
    if(Trig_Select_I_Savage_Func020C())then
        call UnitAddItemByIdSwapped('I00N',GetLastCreatedUnit())
    else
    endif
    if(Trig_Select_I_Savage_Func021C())then
        call UnitAddItemByIdSwapped('I00O',GetLastCreatedUnit())
    else
    endif
   
    call SetPlayerName(GetOwningPlayer(GetEnteringUnit()),(GetPlayerName(GetOwningPlayer(GetEnteringUnit()))+" (Savage)"))
   
    call AddSpecialEffectTargetUnitBJ("origin",GetLastCreatedUnit(),"Abilities\\Spells\\Human\\ReviveHuman\\ReviveHuman.mdl")
    call PanCameraToTimedLocForPlayer(GetOwningPlayer(GetEnteringUnit()),GetRectCenter(udg_rect11),0.00)
    call SelectUnitAddForPlayer(GetLastCreatedUnit(),GetOwningPlayer(GetEnteringUnit()))
endfunction

function Trig_Select_I_Inferno_Gnoll_Conditions takes nothing returns boolean
    if(not(udg_boolean02==false))then
        return false
    endif
    if(not(udg_boolean01==true))then
        return false
    endif
    return true
endfunction

function Trig_Select_I_Inferno_Gnoll_Func019C takes nothing returns boolean
    if(not(udg_integer06==1))then
        return false
    endif
    return true
endfunction

function Trig_Select_I_Inferno_Gnoll_Func020C takes nothing returns boolean
    if(not(udg_integer06==5))then
        return false
    endif
    return true
endfunction

function Trig_Select_I_Inferno_Gnoll_Actions takes nothing returns nothing
   
    call RemoveUnit(GetEnteringUnit())
    call CreateNUnitsAtLoc(1,'U00D',GetOwningPlayer(GetEnteringUnit()),GetRectCenter(udg_rect11),bj_UNIT_FACING)
    set udg_units01[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]=GetLastCreatedUnit()
   
    set udg_integers09[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='A00M'
    set udg_integers10[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='A00I'
    set udg_integers11[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='A002'
    set udg_integers12[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='A00J'
   
    set udg_integers13[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='I00B'
   
    call UnitAddItemByIdSwapped('ankh',GetLastCreatedUnit())
    call UnitAddItemByIdSwapped('pghe',GetLastCreatedUnit())
    call UnitAddItemByIdSwapped('pgma',GetLastCreatedUnit())
   
    if(Trig_Select_I_Inferno_Gnoll_Func019C())then
        call UnitAddItemByIdSwapped('I00N',GetLastCreatedUnit())
    else
    endif
    if(Trig_Select_I_Inferno_Gnoll_Func020C())then
        call UnitAddItemByIdSwapped('I00O',GetLastCreatedUnit())
    else
    endif
   
    call SetPlayerName(GetOwningPlayer(GetEnteringUnit()),(GetPlayerName(GetOwningPlayer(GetEnteringUnit()))+" (Inferno Gnoll)"))
   
    call AddSpecialEffectTargetUnitBJ("origin",GetLastCreatedUnit(),"Abilities\\Spells\\Human\\ReviveHuman\\ReviveHuman.mdl")
    call PanCameraToTimedLocForPlayer(GetOwningPlayer(GetEnteringUnit()),GetRectCenter(udg_rect11),0.00)
    call SelectUnitAddForPlayer(GetLastCreatedUnit(),GetOwningPlayer(GetEnteringUnit()))
endfunction

function Trig_Select_I_Necromancer_Conditions takes nothing returns boolean
    if(not(udg_boolean02==false))then
        return false
    endif
    if(not(udg_boolean01==true))then
        return false
    endif
    if(not(GetUnitTypeId(GetEnteringUnit())=='e000'))then
        return false
    endif
    return true
endfunction

function Trig_Select_I_Necromancer_Func020C takes nothing returns boolean
    if(not(udg_integer06==1))then
        return false
    endif
    return true
endfunction

function Trig_Select_I_Necromancer_Func021C takes nothing returns boolean
    if(not(udg_integer06==5))then
        return false
    endif
    return true
endfunction

function Trig_Select_I_Necromancer_Actions takes nothing returns nothing
   
    call RemoveUnit(GetEnteringUnit())
    call CreateNUnitsAtLoc(1,'U00E',GetOwningPlayer(GetEnteringUnit()),GetRectCenter(udg_rect11),bj_UNIT_FACING)
    set udg_units01[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]=GetLastCreatedUnit()
   
    set udg_integers09[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='A00N'
    set udg_integers10[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='A00S'
    set udg_integers11[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='A001'
    set udg_integers12[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='A003'
   
    set udg_integers13[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]='I007'
   
    call UnitAddItemByIdSwapped('ankh',GetLastCreatedUnit())
    call UnitAddItemByIdSwapped('pghe',GetLastCreatedUnit())
    call UnitAddItemByIdSwapped('pgma',GetLastCreatedUnit())
   
    if(Trig_Select_I_Necromancer_Func020C())then
        call UnitAddItemByIdSwapped('I00N',GetLastCreatedUnit())
    else
    endif
    if(Trig_Select_I_Necromancer_Func021C())then
        call UnitAddItemByIdSwapped('I00O',GetLastCreatedUnit())
    else
    endif
   
    call SetPlayerName(GetOwningPlayer(GetEnteringUnit()),(GetPlayerName(GetOwningPlayer(GetEnteringUnit()))+" (Necromancer)"))
   
    call AddSpecialEffectTargetUnitBJ("origin",GetLastCreatedUnit(),"Abilities\\Spells\\Human\\ReviveHuman\\ReviveHuman.mdl")
    call PanCameraToTimedLocForPlayer(GetOwningPlayer(GetEnteringUnit()),GetRectCenter(udg_rect11),0.00)
    call SelectUnitAddForPlayer(GetLastCreatedUnit(),GetOwningPlayer(GetEnteringUnit()))
endfunction

function Trig_Gold_Valuts_Conditions takes nothing returns boolean
    if(not(udg_boolean02==false))then
        return false
    endif
    if(not(udg_boolean01==true))then
        return false
    endif
    return true
endfunction

function Trig_Gold_Valuts_Func004A takes nothing returns nothing
    call AdjustPlayerStateBJ((CountUnitsInGroup(GetUnitsOfPlayerAndTypeId(GetEnumPlayer(),'n00A'))*45),GetEnumPlayer(),PLAYER_STATE_RESOURCE_GOLD)
endfunction

function Trig_Gold_Valuts_Func005A takes nothing returns nothing
    call AddSpecialEffectTargetUnitBJ("overhead",GetEnumUnit(),"UI\\Feedback\\GoldCredit\\GoldCredit.mdl")
endfunction

function Trig_Gold_Valuts_Func007A takes nothing returns nothing
    call AdjustPlayerStateBJ((GetPlayerState(Player(10),PLAYER_STATE_RESOURCE_GOLD)/CountPlayersInForceBJ(udg_force01)),GetEnumPlayer(),PLAYER_STATE_RESOURCE_GOLD)
endfunction

function Trig_Gold_Valuts_Actions takes nothing returns nothing
   
    call ForForce(GetPlayersAll(),function Trig_Gold_Valuts_Func004A)
    call ForGroupBJ(GetUnitsOfTypeIdAll('n00A'),function Trig_Gold_Valuts_Func005A)
   
    call ForForce(GetPlayersAll(),function Trig_Gold_Valuts_Func007A)
    call SetPlayerStateBJ(Player(10),PLAYER_STATE_RESOURCE_GOLD,1000)
endfunction

function Trig_Undead_Champions_Conditions takes nothing returns boolean
    if(not(GetUnitUserData(GetDyingUnit())==1))then
        return false
    endif
    if(not(udg_boolean01==true))then
        return false
    endif
    if(not(udg_boolean02==false))then
        return false
    endif
    return true
endfunction

function Trig_Undead_Champions_Actions takes nothing returns nothing
    call CreateItemLoc(ChooseRandomItemExBJ(8,ITEM_TYPE_POWERUP),GetUnitLoc(GetDyingUnit()))
    call AddSpecialEffectLocBJ(GetUnitLoc(GetDyingUnit()),"Abilities\\Spells\\Items\\TomeOfRetraining\\TomeOfRetrainingCaster.mdl")
   
    call ConditionalTriggerExecute(udg_trigger53)
endfunction

function Trig_Undead_Heroes_Conditions takes nothing returns boolean
    if(not(IsUnitType(GetDyingUnit(),UNIT_TYPE_HERO)==true))then
        return false
    endif
    if(not(udg_boolean01==true))then
        return false
    endif
    if(not(udg_boolean02==false))then
        return false
    endif
    return true
endfunction

function Trig_Undead_Heroes_Actions takes nothing returns nothing
    call CreateItemLoc(ChooseRandomItemExBJ(8,ITEM_TYPE_POWERUP),GetUnitLoc(GetDyingUnit()))
    call CreateItemLoc('rhe3',GetUnitLoc(GetDyingUnit()))
    call AddSpecialEffectLocBJ(GetUnitLoc(GetDyingUnit()),"Abilities\\Spells\\Items\\TomeOfRetraining\\TomeOfRetrainingCaster.mdl")
   
    call ConditionalTriggerExecute(udg_trigger53)
endfunction

function Trig_Black_Citadel_Tyrant_Dies_Conditions takes nothing returns boolean
    if(not(GetUnitTypeId(GetDyingUnit())=='u00H'))then
        return false
    endif
    return true
endfunction

function Trig_Black_Citadel_Tyrant_Dies_Actions takes nothing returns nothing
    call StartTimerBJ(udg_timer02,false,120.00)
endfunction

function Trig_Black_Citadel_Tyrants_Conditions takes nothing returns boolean
    if(not(GetUnitLifePercent(udg_unit04)<=75.00))then
        return false
    endif
    if(not(TimerGetRemaining(udg_timer02)==0.00))then
        return false
    endif
    if(not(CountUnitsInGroup(GetUnitsOfPlayerAndTypeId(Player(11),'u00H'))==0))then
        return false
    endif
    if(not(udg_integer11>0))then
        return false
    endif
    return true
endfunction

function Trig_Black_Citadel_Tyrants_Actions takes nothing returns nothing
    set udg_integer11=(udg_integer11-1)
    call CreateNUnitsAtLoc(1,'u00H',Player(11),GetRandomLocInRect(udg_rect37),270.00)
    call AddSpecialEffectTargetUnitBJ("origin",GetLastCreatedUnit(),"Abilities\\Spells\\Undead\\RaiseSkeletonWarrior\\RaiseSkeleton.mdl")
endfunction

function Trig_Black_Citadel_Zealots_Conditions takes nothing returns boolean
    if(not(TimerGetRemaining(udg_timer03)==0.00))then
        return false
    endif
    return true
endfunction

function Trig_Black_Citadel_Zealots_Actions takes nothing returns nothing
    call CreateNUnitsAtLoc(1,'u00I',Player(11),GetRandomLocInRect(udg_rect37),270.00)
    call AddSpecialEffectTargetUnitBJ("origin",GetLastCreatedUnit(),"Abilities\\Spells\\Undead\\RaiseSkeletonWarrior\\RaiseSkeleton.mdl")
    call UnitApplyTimedLifeBJ(120.00,'Brai',GetLastCreatedUnit())
    call StartTimerBJ(udg_timer03,false,10.00)
endfunction

function Trig_Black_Citadel_dies_Conditions takes nothing returns boolean
    if(not(GetUnitTypeId(GetDyingUnit())=='unp2'))then
        return false
    endif
    return true
endfunction

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

function Trig_Black_Citadel_dies_Actions takes nothing returns nothing
    set udg_boolean02=true
    call DisplayTimedTextToForce(GetPlayersAll(),60.00,"TRIGSTR_133")
    call TriggerSleepAction(8.00)
    call ForForce(udg_force01,function Trig_Black_Citadel_dies_Func004002)
endfunction

function Trig_Keep_under_attack_Conditions takes nothing returns boolean
    if(not(IsUnitType(GetAttackedUnitBJ(),UNIT_TYPE_TOWNHALL)==true))then
        return false
    endif
    if(not(RectContainsLoc(udg_rect12,GetUnitLoc(GetAttackedUnitBJ()))==true))then
        return false
    endif
    if(not(udg_boolean02==false))then
        return false
    endif
    return true
endfunction

function Trig_Keep_under_attack_Actions takes nothing returns nothing
    call DisableTrigger(GetTriggeringTrigger())
    call StartTimerBJ(udg_timer01,false,10.00)
    call DisplayTimedTextToForce(GetPlayersAll(),8.00,"TRIGSTR_943")
    call PingMinimapLocForForceEx(GetPlayersAll(),GetUnitLoc(GetAttackedUnitBJ()),5.00,bj_MINIMAPPINGSTYLE_ATTACK,100,100.00,100.00)
endfunction

function Trig_Keep_Timer_Actions takes nothing returns nothing
    call EnableTrigger(udg_trigger32)
endfunction

function Trig_Keep_dies_Conditions takes nothing returns boolean
    if(not(IsUnitType(GetDyingUnit(),UNIT_TYPE_TOWNHALL)==true))then
        return false
    endif
    if(not(RectContainsLoc(udg_rect12,GetUnitLoc(GetDyingUnit()))==true))then
        return false
    endif
    if(not(udg_boolean02==false))then
        return false
    endif
    return true
endfunction

function Trig_Keep_dies_Func004002 takes nothing returns nothing
    call CustomDefeatBJ(GetEnumPlayer(),"TRIGSTR_938")
endfunction

function Trig_Keep_dies_Actions takes nothing returns nothing
    set udg_boolean02=true
    call DisplayTimedTextToForce(GetPlayersAll(),60.00,"TRIGSTR_933")
    call TriggerSleepAction(8.00)
    call ForForce(udg_force01,function Trig_Keep_dies_Func004002)
endfunction

function Trig_Wake_of_Fire_Trap_Conditions takes nothing returns boolean
    if(not(GetLearnedSkillBJ()=='A00H'))then
        return false
    endif
    return true
endfunction

function Trig_Wake_of_Fire_Trap_Actions takes nothing returns nothing
    set udg_integers17[GetConvertedPlayerId(GetOwningPlayer(GetLearningUnit()))]=(udg_integers17[GetConvertedPlayerId(GetOwningPlayer(GetLearningUnit()))]+1)
    call SetPlayerTechResearchedSwap('R004',udg_integers17[GetConvertedPlayerId(GetOwningPlayer(GetLearningUnit()))],GetOwningPlayer(GetLearningUnit()))
endfunction

function Trig_Hydra_Conditions takes nothing returns boolean
    if(not(GetLearnedSkillBJ()=='A00V'))then
        return false
    endif
    return true
endfunction

function Trig_Hydra_Actions takes nothing returns nothing
    set udg_integers20[GetConvertedPlayerId(GetOwningPlayer(GetLearningUnit()))]=(udg_integers20[GetConvertedPlayerId(GetOwningPlayer(GetLearningUnit()))]+1)
    call SetPlayerTechResearchedSwap('R005',udg_integers20[GetConvertedPlayerId(GetOwningPlayer(GetLearningUnit()))],GetOwningPlayer(GetLearningUnit()))
endfunction

function Trig_Crippling_Slash_Conditions takes nothing returns boolean
    if(not(GetUnitTypeId(GetAttacker())=='H001'))then
        return false
    endif
    return true
endfunction

function Trig_Crippling_Slash_Func001C takes nothing returns boolean
    if(not(GetRandomInt(1,10)==1))then
        return false
    endif
    return true
endfunction

function Trig_Crippling_Slash_Actions takes nothing returns nothing
    if(Trig_Crippling_Slash_Func001C())then
        call DestroyTextTagBJ(udg_texttag01)
        call CreateTextTagUnitBJ("TRIGSTR_352",GetAttackedUnitBJ(),0,10,100,0.00,0.00,0)
        set udg_texttag01=GetLastCreatedTextTag()
        call SetTextTagVelocityBJ(udg_texttag01,64,90)
       
        call CreateNUnitsAtLoc(1,'unec',Player(10),GetUnitLoc(GetAttackedUnitBJ()),bj_UNIT_FACING)
        call SetUnitInvulnerable(GetLastCreatedUnit(),true)
        call ShowUnitHide(GetLastCreatedUnit())
        call SetUnitManaPercentBJ(GetLastCreatedUnit(),100)
        call IssueTargetOrderBJ(GetLastCreatedUnit(),"cripple",GetAttackedUnitBJ())
        call PolledWait(0.50)
        call RemoveUnit(GetLastCreatedUnit())
       
        call PolledWait(1.75)
        call DestroyTextTagBJ(udg_texttag01)
    else
    endif
endfunction

function Trig_Summon_Gnoll_Warden_Conditions takes nothing returns boolean
    if(not(GetLearnedSkillBJ()=='A00M'))then
        return false
    endif
    return true
endfunction

function Trig_Summon_Gnoll_Warden_Actions takes nothing returns nothing
    set udg_integers14[GetConvertedPlayerId(GetOwningPlayer(GetLearningUnit()))]=(udg_integers14[GetConvertedPlayerId(GetOwningPlayer(GetLearningUnit()))]+1)
    call SetPlayerTechResearchedSwap('R001',udg_integers14[GetConvertedPlayerId(GetOwningPlayer(GetLearningUnit()))],GetOwningPlayer(GetLearningUnit()))
endfunction

function Trig_Skeletal_Mastery_Conditions takes nothing returns boolean
    if(not(GetLearnedSkillBJ()=='A00S'))then
        return false
    endif
    return true
endfunction

function Trig_Skeletal_Mastery_Actions takes nothing returns nothing
    set udg_integers15[GetConvertedPlayerId(GetOwningPlayer(GetLearningUnit()))]=(udg_integers15[GetConvertedPlayerId(GetOwningPlayer(GetLearningUnit()))]+1)
    call SetPlayerTechResearchedSwap('R003',udg_integers15[GetConvertedPlayerId(GetOwningPlayer(GetLearningUnit()))],GetOwningPlayer(GetLearningUnit()))
endfunction

function Trig_Summon_Iron_Golem_Conditions takes nothing returns boolean
    if(not(GetLearnedSkillBJ()=='A003'))then
        return false
    endif
    return true
endfunction

function Trig_Summon_Iron_Golem_Actions takes nothing returns nothing
    set udg_integers16[GetConvertedPlayerId(GetOwningPlayer(GetLearningUnit()))]=(udg_integers16[GetConvertedPlayerId(GetOwningPlayer(GetLearningUnit()))]+1)
    call SetPlayerTechResearchedSwap('R002',udg_integers16[GetConvertedPlayerId(GetOwningPlayer(GetLearningUnit()))],GetOwningPlayer(GetLearningUnit()))
endfunction

function Trig_Create_Corpse_Conditions takes nothing returns boolean
    if(not(GetUnitTypeId(GetSummonedUnit())=='hfoo'))then
        return false
    endif
    return true
endfunction

function Trig_Create_Corpse_Actions takes nothing returns nothing
    call RemoveUnit(GetSummonedUnit())
    call CreateCorpseLocBJ('hfoo',Player(0),GetUnitLoc(GetSummonedUnit()))
    call AddSpecialEffectLocBJ(GetUnitLoc(GetSummonedUnit()),"Objects\\Spawnmodels\\Human\\HumanLargeDeathExplode\\HumanLargeDeathExplode.mdl")
endfunction

function Trig_Keep_Defence_Conditions takes nothing returns boolean
    if(not(GetItemTypeId(GetManipulatedItem())=='I00F'))then
        return false
    endif
    return true
endfunction

function Trig_Keep_Defence_Func001C takes nothing returns boolean
    if(not(udg_integer08<20))then
        return false
    endif
    return true
endfunction

function Trig_Keep_Defence_Actions takes nothing returns nothing
    if(Trig_Keep_Defence_Func001C())then
        set udg_integer08=(udg_integer08+1)
        call SetPlayerTechResearchedSwap('R000',udg_integer08,Player(10))
        call DisplayTextToForce(GetPlayersAll(),(("|cffffcc00NOTICE:|r "+GetPlayerName(GetOwningPlayer(GetManipulatingUnit())))+(" has brought a Keep defence upgrade. Current level is: "+I2S(udg_integer08))))
    else
        call AdjustPlayerStateBJ(500,GetOwningPlayer(GetManipulatingUnit()),PLAYER_STATE_RESOURCE_GOLD)
        call DisplayTextToForce(GetForceOfPlayer(GetOwningPlayer(GetManipulatingUnit())),"TRIGSTR_1317")
    endif
    call RemoveItem(GetManipulatedItem())
endfunction

function Trig_Q_Main_Objective_Actions takes nothing returns nothing
    call CreateQuestBJ(bj_QUESTTYPE_REQ_DISCOVERED,"TRIGSTR_234","TRIGSTR_235","ReplaceableTextures\\CommandButtons\\BTNKiljaedin.tga")
    call CreateQuestBJ(bj_QUESTTYPE_REQ_DISCOVERED,"TRIGSTR_348","TRIGSTR_349","ReplaceableTextures\\CommandButtons\\BTNKeep.tga")
    call CreateQuestBJ(bj_QUESTTYPE_REQ_DISCOVERED,"TRIGSTR_314","TRIGSTR_347","ReplaceableTextures\\CommandButtons\\BTNAltarOfKings.tga")
   
    call CreateQuestBJ(bj_QUESTTYPE_REQ_DISCOVERED,"TRIGSTR_141","TRIGSTR_142","ReplaceableTextures\\CommandButtons\\BTNStatUp.blp")
   
    call CreateQuestBJ(bj_QUESTTYPE_OPT_DISCOVERED,"TRIGSTR_149","TRIGSTR_150","ReplaceableTextures\\CommandButtons\\BTNChestOfGold.tga")
   
    call CreateQuestBJ(bj_QUESTTYPE_OPT_DISCOVERED,"TRIGSTR_151","TRIGSTR_152","ReplaceableTextures\\CommandButtons\\BTNMagicalSentry.tga")
   
    call CreateQuestBJ(bj_QUESTTYPE_OPT_DISCOVERED,"TRIGSTR_153","TRIGSTR_154","ReplaceableTextures\\CommandButtons\\BTNHeroDreadLord.tga")
   
    call CreateQuestBJ(bj_QUESTTYPE_OPT_DISCOVERED,"TRIGSTR_155","TRIGSTR_156","ReplaceableTextures\\CommandButtons\\BTNTayl0rAnimateDeadThumbsUp.tga")
    call CreateQuestItemBJ(GetLastCreatedQuestBJ(),"TRIGSTR_157")
    call CreateQuestItemBJ(GetLastCreatedQuestBJ(),"TRIGSTR_158")
    call CreateQuestItemBJ(GetLastCreatedQuestBJ(),"TRIGSTR_159")
    call CreateQuestItemBJ(GetLastCreatedQuestBJ(),"TRIGSTR_160")
    call CreateQuestItemBJ(GetLastCreatedQuestBJ(),"TRIGSTR_161")
    call CreateQuestItemBJ(GetLastCreatedQuestBJ(),"TRIGSTR_162")
    call CreateQuestItemBJ(GetLastCreatedQuestBJ(),"TRIGSTR_421")
   
    call CreateQuestBJ(bj_QUESTTYPE_OPT_DISCOVERED,"TRIGSTR_451","TRIGSTR_719","ReplaceableTextures\\CommandButtons\\BTNTheCaptain.tga")
    call CreateQuestItemBJ(GetLastCreatedQuestBJ(),"TRIGSTR_720")
    call CreateQuestItemBJ(GetLastCreatedQuestBJ(),"TRIGSTR_723")
endfunction

function Trig_Undead_Building_Deaths_Conditions takes nothing returns boolean
    if(not(IsUnitType(GetDyingUnit(),UNIT_TYPE_STRUCTURE)==true))then
        return false
    endif
    return true
endfunction

function Trig_Undead_Building_Deaths_Actions takes nothing returns nothing
   
    call SetBlightRadiusLocBJ(false,Player(11),GetUnitLoc(GetDyingUnit()),192.00)
endfunction

function Trig_AI_Request_Information_Func001Func002A takes nothing returns nothing
    call DisplayTextToForce(GetPlayersAll(),("|cff00ccffAI:|r "+((GetPlayerName(GetEnumPlayer())+" is currently |cffffcc00")+(udg_strings02[GetConvertedPlayerId(GetEnumPlayer())]+(("|r, and has |cffffcc00"+I2S(GetPlayerState(GetEnumPlayer(),PLAYER_STATE_RESOURCE_GOLD)))+"|r gold.")))))
endfunction

function Trig_AI_Request_Information_Func001C takes nothing returns boolean
    if(not(CountPlayersInForceBJ(udg_force02)==0))then
        return false
    endif
    return true
endfunction

function Trig_AI_Request_Information_Actions takes nothing returns nothing
    if(Trig_AI_Request_Information_Func001C())then
        call DisplayTextToForce(GetPlayersAll(),"TRIGSTR_1282")
    else
        call DisplayTextToForce(GetPlayersAll(),"TRIGSTR_1283")
        call ForForce(udg_force02,function Trig_AI_Request_Information_Func001Func002A)
    endif
endfunction

function Trig_AI_Get_Corridor_Actions takes nothing returns nothing
    set udg_integers08[1]=0
    set udg_integers08[2]=0
    set udg_integers08[3]=1
    set udg_integers08[4]=1
    set udg_integers08[5]=2
    set udg_integers08[6]=2
    set udg_integers08[7]=3
    set udg_integers08[8]=3
    set udg_integers08[9]=4
    set udg_integers08[10]=4
endfunction

function Trig_AI_Select_Hero_Func001001001 takes nothing returns boolean
    return(GetPlayerController(GetFilterPlayer())!=MAP_CONTROL_USER)
endfunction

function Trig_AI_Select_Hero_Func001A takes nothing returns nothing
    set udg_strings02[GetConvertedPlayerId(GetEnumPlayer())]="SelectingHero"
endfunction

function Trig_AI_Select_Hero_Func002001001 takes nothing returns boolean
    return(GetPlayerController(GetFilterPlayer())!=MAP_CONTROL_USER)
endfunction

function Trig_AI_Select_Hero_Func002Func001002001002 takes nothing returns boolean
    return(GetUnitTypeId(GetFilterUnit())=='ncop')
endfunction

function Trig_AI_Select_Hero_Func002A takes nothing returns nothing
    set udg_unit03=GroupPickRandomUnit(GetUnitsInRectMatching(udg_rect12,Condition(function Trig_AI_Select_Hero_Func002Func001002001002)))
    call IssuePointOrderLocBJ(GroupPickRandomUnit(GetUnitsOfPlayerAndTypeId(GetEnumPlayer(),'e000')),"move",GetUnitLoc(udg_unit03))
endfunction

function Trig_AI_Select_Hero_Actions takes nothing returns nothing
    call ForForce(GetPlayersMatching(Condition(function Trig_AI_Select_Hero_Func001001001)),function Trig_AI_Select_Hero_Func001A)
    call ForForce(GetPlayersMatching(Condition(function Trig_AI_Select_Hero_Func002001001)),function Trig_AI_Select_Hero_Func002A)
endfunction

function Trig_AI_Got_Hero_Conditions takes nothing returns boolean
    if(not(GetPlayerController(GetOwningPlayer(GetEnteringUnit()))==MAP_CONTROL_COMPUTER))then
        return false
    endif
    if(not(GetOwningPlayer(GetEnteringUnit())!=Player(10)))then
        return false
    endif
    if(not(GetOwningPlayer(GetEnteringUnit())!=Player(11)))then
        return false
    endif
    return true
endfunction

function Trig_AI_Got_Hero_Actions takes nothing returns nothing
    set udg_strings02[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]="Preparing"
    call IssuePointOrderLocBJ(GetEnteringUnit(),"move",GetRectCenter(udg_rects01[udg_integers08[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))]]))
    call SelectHeroSkill(GetEnteringUnit(),udg_integers09[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))])
endfunction

function Trig_AI_Level_Up_Conditions takes nothing returns boolean
    if(not(IsPlayerInForce(GetOwningPlayer(GetLevelingUnit()),udg_force02)==true))then
        return false
    endif
    return true
endfunction

function Trig_AI_Level_Up_Actions takes nothing returns nothing
    set bj_forLoopAIndex=1
    set bj_forLoopAIndexEnd=GetHeroSkillPoints(GetLevelingUnit())
    loop
        exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
        call SelectHeroSkill(GetLevelingUnit(),udg_integers12[GetConvertedPlayerId(GetOwningPlayer(GetLevelingUnit()))])
        call SelectHeroSkill(GetLevelingUnit(),udg_integers09[GetConvertedPlayerId(GetOwningPlayer(GetLevelingUnit()))])
        call SelectHeroSkill(GetLevelingUnit(),udg_integers10[GetConvertedPlayerId(GetOwningPlayer(GetLevelingUnit()))])
        call SelectHeroSkill(GetLevelingUnit(),udg_integers11[GetConvertedPlayerId(GetOwningPlayer(GetLevelingUnit()))])
        call SelectHeroSkill(GetLevelingUnit(),'A00O')
        set bj_forLoopAIndex=bj_forLoopAIndex+1
    endloop
endfunction

function Trig_AI_Main_Conditions takes nothing returns boolean
    if(not(CountPlayersInForceBJ(udg_force02)>0))then
        return false
    endif
    if(not(udg_boolean02==false))then
        return false
    endif
    if(not(udg_boolean01==true))then
        return false
    endif
    return true
endfunction

function Trig_AI_Main_Func004Func007Func001C takes nothing returns boolean
    if(not(GetItemType(UnitItemInSlotBJ(udg_units01[GetConvertedPlayerId(GetEnumPlayer())],GetForLoopIndexA()))==ITEM_TYPE_POWERUP))then
        return false
    endif
    return true
endfunction

function Trig_AI_Main_Func004Func014Func002C takes nothing returns boolean
    if(not(RectContainsUnit(udg_rects01[udg_integers08[GetConvertedPlayerId(GetEnumPlayer())]],udg_units01[GetConvertedPlayerId(GetEnumPlayer())])==true))then
        return false
    endif
    return true
endfunction

function Trig_AI_Main_Func004Func014C takes nothing returns boolean
    if(not(udg_strings02[GetConvertedPlayerId(GetEnumPlayer())]=="Preparing"))then
        return false
    endif
    return true
endfunction

function Trig_AI_Main_Func004Func018C takes nothing returns boolean
    if(not(udg_strings02[GetConvertedPlayerId(GetEnumPlayer())]=="Attacking"))then
        return false
    endif
    return true
endfunction

function Trig_AI_Main_Func004Func022C takes nothing returns boolean
    if(not(udg_strings02[GetConvertedPlayerId(GetEnumPlayer())]=="Assaulting"))then
        return false
    endif
    return true
endfunction

function Trig_AI_Main_Func004Func026C takes nothing returns boolean
    if(not(udg_strings02[GetConvertedPlayerId(GetEnumPlayer())]=="Healing"))then
        return false
    endif
    if(not(RectContainsUnit(udg_rect03,udg_units01[GetConvertedPlayerId(GetEnumPlayer())])==false))then
        return false
    endif
    return true
endfunction

function Trig_AI_Main_Func004Func030C takes nothing returns boolean
    if(not(udg_strings02[GetConvertedPlayerId(GetEnumPlayer())]=="OffToTheShops"))then
        return false
    endif
    return true
endfunction

function Trig_AI_Main_Func004Func038Func001C takes nothing returns boolean
    if((udg_strings02[GetConvertedPlayerId(GetEnumPlayer())]=="Healing"))then
        return true
    endif
    if((udg_strings02[GetConvertedPlayerId(GetEnumPlayer())]=="Attacking"))then
        return true
    endif
    if((udg_strings02[GetConvertedPlayerId(GetEnumPlayer())]=="Assualting"))then
        return true
    endif
    return false
endfunction

function Trig_AI_Main_Func004Func038C takes nothing returns boolean
    if(not Trig_AI_Main_Func004Func038Func001C())then
        return false
    endif
    if(not(GetUnitLifePercent(udg_units01[GetConvertedPlayerId(GetEnumPlayer())])<25.00))then
        return false
    endif
    return true
endfunction

function Trig_AI_Main_Func004Func042C takes nothing returns boolean
    if(not(udg_strings02[GetConvertedPlayerId(GetEnumPlayer())]=="Attacking"))then
        return false
    endif
    if(not(RectContainsUnit(udg_rect02,udg_units01[GetConvertedPlayerId(GetEnumPlayer())])==true))then
        return false
    endif
    return true
endfunction

function Trig_AI_Main_Func004Func047C takes nothing returns boolean
    if(not(RectContainsUnit(udg_rect03,udg_units01[GetConvertedPlayerId(GetEnumPlayer())])==true))then
        return false
    endif
    if(not(udg_strings02[GetConvertedPlayerId(GetEnumPlayer())]=="Healing"))then
        return false
    endif
    if(not(GetUnitLifePercent(udg_units01[GetConvertedPlayerId(GetEnumPlayer())])>=75.00))then
        return false
    endif
    if(not(GetPlayerState(GetEnumPlayer(),PLAYER_STATE_RESOURCE_GOLD)<500))then
        return false
    endif
    return true
endfunction

function Trig_AI_Main_Func004Func051C takes nothing returns boolean
    if(not(udg_strings02[GetConvertedPlayerId(GetEnumPlayer())]=="Healing"))then
        return false
    endif
    if(not(GetUnitLifePercent(udg_units01[GetConvertedPlayerId(GetEnumPlayer())])>=75.00))then
        return false
    endif
    if(not(GetPlayerState(GetEnumPlayer(),PLAYER_STATE_RESOURCE_GOLD)>=500))then
        return false
    endif
    return true
endfunction

function Trig_AI_Main_Func004A takes nothing returns nothing
   
   
   
   
   
   
    set bj_forLoopAIndex=1
    set bj_forLoopAIndexEnd=6
    loop
        exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
        if(Trig_AI_Main_Func004Func007Func001C())then
            set bj_forLoopBIndex=1
            set bj_forLoopBIndexEnd=15
            loop
                exitwhen bj_forLoopBIndex>bj_forLoopBIndexEnd
                call UnitUseItem(udg_units01[GetConvertedPlayerId(GetEnumPlayer())],UnitItemInSlotBJ(udg_units01[GetConvertedPlayerId(GetEnumPlayer())],GetForLoopIndexA()))
                set bj_forLoopBIndex=bj_forLoopBIndex+1
            endloop
        else
        endif
        set bj_forLoopAIndex=bj_forLoopAIndex+1
    endloop
   
   
   
   
   
   
    if(Trig_AI_Main_Func004Func014C())then
        call IssuePointOrderLocBJ(udg_units01[GetConvertedPlayerId(GetEnumPlayer())],"move",GetRectCenter(udg_rects01[udg_integers08[GetConvertedPlayerId(GetEnumPlayer())]]))
        if(Trig_AI_Main_Func004Func014Func002C())then
            set udg_strings02[GetConvertedPlayerId(GetEnumPlayer())]="Attacking"
        else
        endif
    else
    endif
   
   
   
    if(Trig_AI_Main_Func004Func018C())then
        call IssuePointOrderLocBJ(udg_units01[GetConvertedPlayerId(GetEnumPlayer())],"attack",GetRectCenter(udg_rects02[udg_integers08[GetConvertedPlayerId(GetEnumPlayer())]]))
    else
    endif
   
   
   
    if(Trig_AI_Main_Func004Func022C())then
        call IssuePointOrderLocBJ(udg_units01[GetConvertedPlayerId(GetEnumPlayer())],"attack",GetUnitLoc(udg_unit04))
    else
    endif
   
   
   
    if(Trig_AI_Main_Func004Func026C())then
        call IssuePointOrderLocBJ(udg_units01[GetConvertedPlayerId(GetEnumPlayer())],"move",GetRectCenter(udg_rect03))
    else
    endif
   
   
   
    if(Trig_AI_Main_Func004Func030C())then
        call IssuePointOrderLocBJ(udg_units01[GetConvertedPlayerId(GetEnumPlayer())],"move",GetRectCenter(udg_rect23))
    else
    endif
   
   
   
   
   
   
   
    if(Trig_AI_Main_Func004Func038C())then
        set udg_strings02[GetConvertedPlayerId(GetEnumPlayer())]="Healing"
        call IssuePointOrderLocBJ(udg_units01[GetConvertedPlayerId(GetEnumPlayer())],"move",GetRectCenter(udg_rect03))
    else
    endif
   
   
   
    if(Trig_AI_Main_Func004Func042C())then
        set udg_strings02[GetConvertedPlayerId(GetEnumPlayer())]="Assaulting"
    else
    endif
   
   
   
   
    if(Trig_AI_Main_Func004Func047C())then
        set udg_strings02[GetConvertedPlayerId(GetEnumPlayer())]="Preparing"
    else
    endif
   
   
   
    if(Trig_AI_Main_Func004Func051C())then
        set udg_strings02[GetConvertedPlayerId(GetEnumPlayer())]="OffToTheShops"
    else
    endif
endfunction

function Trig_AI_Main_Actions takes nothing returns nothing
    call ForForce(udg_force02,function Trig_AI_Main_Func004A)
    call ConditionalTriggerExecute(udg_trigger52)
    call ConditionalTriggerExecute(udg_trigger53)
endfunction

function Trig_AI_Shopping_Func001Func004Func001001 takes nothing returns boolean
    return(udg_strings02[GetConvertedPlayerId(GetEnumPlayer())]=="OffToTheShops")
endfunction

function Trig_AI_Shopping_Func001Func004Func001002 takes nothing returns boolean
    return(udg_strings02[GetConvertedPlayerId(GetEnumPlayer())]=="Shopping")
endfunction

function Trig_AI_Shopping_Func001Func004Func004C takes nothing returns boolean
    if(not(UnitHasItemOfTypeBJ(udg_units01[GetConvertedPlayerId(GetEnumPlayer())],'ankh')==false))then
        return false
    endif
    if(not(GetPlayerState(GetEnumPlayer(),PLAYER_STATE_RESOURCE_GOLD)>=500))then
        return false
    endif
    return true
endfunction

function Trig_AI_Shopping_Func001Func004Func006C takes nothing returns boolean
    if(not(UnitHasItemOfTypeBJ(udg_units01[GetConvertedPlayerId(GetEnumPlayer())],'ocor')==false))then
        return false
    endif
    if(not(IsUnitType(udg_units01[GetConvertedPlayerId(GetEnumPlayer())],UNIT_TYPE_RANGED_ATTACKER)==false))then
        return false
    endif
    if(not(GetPlayerState(GetEnumPlayer(),PLAYER_STATE_RESOURCE_GOLD)>=400))then
        return false
    endif
    return true
endfunction

function Trig_AI_Shopping_Func001Func004Func014C takes nothing returns boolean
    if(not(udg_integer03==3))then
        return false
    endif
    return true
endfunction

function Trig_AI_Shopping_Func001Func004C takes nothing returns boolean
    if(not GetBooleanOr(Trig_AI_Shopping_Func001Func004Func001001(),Trig_AI_Shopping_Func001Func004Func001002()))then
        return false
    endif
    if(not(RectContainsUnit(udg_rect23,udg_units01[GetConvertedPlayerId(GetEnumPlayer())])==true))then
        return false
    endif
    return true
endfunction

function Trig_AI_Shopping_Func001A takes nothing returns nothing
   
   
   
    if(Trig_AI_Shopping_Func001Func004C())then
        set udg_strings02[GetConvertedPlayerId(GetEnumPlayer())]="Shopping"
       
        if(Trig_AI_Shopping_Func001Func004Func004C())then
            call UnitAddItemByIdSwapped('ankh',udg_units01[GetConvertedPlayerId(GetEnumPlayer())])
            call AdjustPlayerStateBJ(-500,GetEnumPlayer(),PLAYER_STATE_RESOURCE_GOLD)
        else
        endif
       
        if(Trig_AI_Shopping_Func001Func004Func006C())then
            call UnitAddItemByIdSwapped('ocor',udg_units01[GetConvertedPlayerId(GetEnumPlayer())])
            call AdjustPlayerStateBJ(-400,GetEnumPlayer(),PLAYER_STATE_RESOURCE_GOLD)
        else
        endif
       
       
       
        loop
            exitwhen(GetPlayerState(GetEnumPlayer(),PLAYER_STATE_RESOURCE_GOLD)<1200)
           
            set udg_integer03=GetRandomInt(1,3)
            if(Trig_AI_Shopping_Func001Func004Func014C())then
                call UnitAddItemByIdSwapped('I001',udg_units01[GetConvertedPlayerId(GetEnumPlayer())])
            else
                call UnitAddItemByIdSwapped(udg_integers13[GetConvertedPlayerId(GetEnumPlayer())],udg_units01[GetConvertedPlayerId(GetEnumPlayer())])
            endif
            set bj_forLoopAIndex=1
            set bj_forLoopAIndexEnd=15
            loop
                exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
                call UnitUseItem(udg_units01[GetConvertedPlayerId(GetEnumPlayer())],GetLastCreatedItem())
                set bj_forLoopAIndex=bj_forLoopAIndex+1
            endloop
            call AdjustPlayerStateBJ(-1200,GetEnumPlayer(),PLAYER_STATE_RESOURCE_GOLD)
            call TriggerSleepAction(0.01)
        endloop
       
        set udg_strings02[GetConvertedPlayerId(GetEnumPlayer())]="Preparing"
    else
    endif
endfunction

function Trig_AI_Shopping_Actions takes nothing returns nothing
    call ForForce(udg_force02,function Trig_AI_Shopping_Func001A)
endfunction

function Trig_AI_Go_And_Grab_Tomes_Func001Func001002001003001 takes nothing returns boolean
    return(IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO)==true)
endfunction

function Trig_AI_Go_And_Grab_Tomes_Func001Func001002001003002 takes nothing returns boolean
    return(IsPlayerInForce(GetOwningPlayer(GetFilterUnit()),udg_force02)==true)
endfunction

function Trig_AI_Go_And_Grab_Tomes_Func001Func001002001003 takes nothing returns boolean
    return GetBooleanAnd(Trig_AI_Go_And_Grab_Tomes_Func001Func001002001003001(),Trig_AI_Go_And_Grab_Tomes_Func001Func001002001003002())
endfunction

function Trig_AI_Go_And_Grab_Tomes_Func001Func003C takes nothing returns boolean
    if(not(GetItemType(udg_item01)==ITEM_TYPE_POWERUP))then
        return false
    endif
    return true
endfunction

function Trig_AI_Go_And_Grab_Tomes_Func001A takes nothing returns nothing
    set udg_unit03=GroupPickRandomUnit(GetUnitsInRangeOfLocMatching(250.00,GetItemLoc(GetEnumItem()),Condition(function Trig_AI_Go_And_Grab_Tomes_Func001Func001002001003)))
    set udg_item01=RandomItemInRectSimpleBJ(RectFromCenterSizeBJ(GetUnitLoc(udg_units01[GetConvertedPlayerId(GetEnumPlayer())]),200.00,200.00))
    if(Trig_AI_Go_And_Grab_Tomes_Func001Func003C())then
        call UnitAddItemSwapped(udg_item01,udg_units01[GetConvertedPlayerId(GetEnumPlayer())])
    else
    endif
endfunction

function Trig_AI_Go_And_Grab_Tomes_Actions takes nothing returns nothing
    call ForForce(udg_force02,function Trig_AI_Go_And_Grab_Tomes_Func001A)
endfunction

function Trig_Player_1_Quits_Conditions takes nothing returns boolean
    if(not(GetPlayerSlotState(Player(0))==PLAYER_SLOT_STATE_LEFT))then
        return false
    endif
    return true
endfunction

function Trig_Player_1_Quits_Actions takes nothing returns nothing
    call DisableTrigger(GetTriggeringTrigger())
    call DisplayTextToForce(GetPlayersAll(),(GetPlayerName(Player(0))+" has left the game. His hero is now controlled by AI."))
    call ForceAddPlayerSimple(Player(0),udg_force02)
endfunction

function Trig_Player_2_Quits_Conditions takes nothing returns boolean
    if(not(GetPlayerSlotState(Player(1))==PLAYER_SLOT_STATE_LEFT))then
        return false
    endif
    return true
endfunction

function Trig_Player_2_Quits_Actions takes nothing returns nothing
    call DisableTrigger(GetTriggeringTrigger())
    call DisplayTextToForce(GetPlayersAll(),(GetPlayerName(Player(1))+" has left the game. His hero is now controlled by AI."))
    call ForceAddPlayerSimple(Player(1),udg_force02)
endfunction

function Trig_Player_3_Quits_Conditions takes nothing returns boolean
    if(not(GetPlayerSlotState(Player(2))==PLAYER_SLOT_STATE_LEFT))then
        return false
    endif
    return true
endfunction

function Trig_Player_3_Quits_Actions takes nothing returns nothing
    call DisableTrigger(GetTriggeringTrigger())
    call DisplayTextToForce(GetPlayersAll(),(GetPlayerName(Player(2))+" has left the game. His hero is now controlled by AI."))
    call ForceAddPlayerSimple(Player(2),udg_force02)
endfunction

function Trig_Player_4_Quits_Conditions takes nothing returns boolean
    if(not(GetPlayerSlotState(Player(3))==PLAYER_SLOT_STATE_LEFT))then
        return false
    endif
    return true
endfunction

function Trig_Player_4_Quits_Actions takes nothing returns nothing
    call DisableTrigger(GetTriggeringTrigger())
    call DisplayTextToForce(GetPlayersAll(),(GetPlayerName(Player(3))+" has left the game. His hero is now controlled by AI."))
    call ForceAddPlayerSimple(Player(3),udg_force02)
endfunction

function Trig_Player_5_Quits_Conditions takes nothing returns boolean
    if(not(GetPlayerSlotState(Player(4))==PLAYER_SLOT_STATE_LEFT))then
        return false
    endif
    return true
endfunction

function Trig_Player_5_Quits_Actions takes nothing returns nothing
    call DisableTrigger(GetTriggeringTrigger())
    call DisplayTextToForce(GetPlayersAll(),(GetPlayerName(Player(4))+" has left the game. His hero is now controlled by AI."))
    call ForceAddPlayerSimple(Player(4),udg_force02)
endfunction

function Trig_Player_6_Quits_Conditions takes nothing returns boolean
    if(not(GetPlayerSlotState(Player(5))==PLAYER_SLOT_STATE_LEFT))then
        return false
    endif
    return true
endfunction

function Trig_Player_6_Quits_Actions takes nothing returns nothing
    call DisableTrigger(GetTriggeringTrigger())
    call DisplayTextToForce(GetPlayersAll(),(GetPlayerName(Player(5))+" has left the game. His hero is now controlled by AI."))
    call ForceAddPlayerSimple(Player(5),udg_force02)
endfunction

function Trig_Player_7_Quits_Conditions takes nothing returns boolean
    if(not(GetPlayerSlotState(Player(6))==PLAYER_SLOT_STATE_LEFT))then
        return false
    endif
    return true
endfunction

function Trig_Player_7_Quits_Actions takes nothing returns nothing
    call DisableTrigger(GetTriggeringTrigger())
    call DisplayTextToForce(GetPlayersAll(),(GetPlayerName(Player(6))+" has left the game. His hero is now controlled by AI."))
    call ForceAddPlayerSimple(Player(6),udg_force02)
endfunction

function Trig_Player_8_Quits_Conditions takes nothing returns boolean
    if(not(GetPlayerSlotState(Player(7))==PLAYER_SLOT_STATE_LEFT))then
        return false
    endif
    return true
endfunction

function Trig_Player_8_Quits_Actions takes nothing returns nothing
    call DisableTrigger(GetTriggeringTrigger())
    call DisplayTextToForce(GetPlayersAll(),(GetPlayerName(Player(7))+" has left the game. His hero is now controlled by AI."))
    call ForceAddPlayerSimple(Player(7),udg_force02)
endfunction

function Trig_Player_9_Quits_Conditions takes nothing returns boolean
    if(not(GetPlayerSlotState(Player(8))==PLAYER_SLOT_STATE_LEFT))then
        return false
    endif
    return true
endfunction

function Trig_Player_9_Quits_Actions takes nothing returns nothing
    call DisableTrigger(GetTriggeringTrigger())
    call DisplayTextToForce(GetPlayersAll(),(GetPlayerName(Player(8))+" has left the game. His hero is now controlled by AI."))
    call ForceAddPlayerSimple(Player(8),udg_force02)
endfunction

function Trig_Player_10_Quits_Conditions takes nothing returns boolean
    if(not(GetPlayerSlotState(Player(9))==PLAYER_SLOT_STATE_LEFT))then
        return false
    endif
    return true
endfunction

function Trig_Player_10_Quits_Actions takes nothing returns nothing
    call DisableTrigger(GetTriggeringTrigger())
    call DisplayTextToForce(GetPlayersAll(),(GetPlayerName(Player(9))+" has left the game. His hero is now controlled by AI."))
    call ForceAddPlayerSimple(Player(9),udg_force02)
endfunction

function main2 takes nothing returns nothing
    call SetCameraBounds(-8576.0+GetCameraMargin(CAMERA_MARGIN_LEFT),-13696.0+GetCameraMargin(CAMERA_MARGIN_BOTTOM),8192.0-GetCameraMargin(CAMERA_MARGIN_RIGHT),17792.0-GetCameraMargin(CAMERA_MARGIN_TOP),-8576.0+GetCameraMargin(CAMERA_MARGIN_LEFT),17792.0-GetCameraMargin(CAMERA_MARGIN_TOP),8192.0-GetCameraMargin(CAMERA_MARGIN_RIGHT),-13696.0+GetCameraMargin(CAMERA_MARGIN_BOTTOM))
    call SetDayNightModels("Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdl","Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdl")
    call SetTerrainFogEx(0,1000.0,5000.0,0.000,0.757,0.902,1.000)
    call NewSoundEnvironment("Default")
    call SetAmbientDaySound("LordaeronWinterDay")
    call SetAmbientNightSound("LordaeronWinterNight")
    call SetMapMusic("Music",true,0)
    call CreateRegions2()
    call SetPlayerTechResearched(Player(10),'Rhme',3)
    call SetPlayerTechResearched(Player(10),'Rhra',3)
    call SetPlayerTechResearched(Player(10),'Rhhb',1)
    call SetPlayerTechResearched(Player(10),'Rhar',3)
    call SetPlayerTechResearched(Player(10),'Rhac',3)
    call SetPlayerTechResearched(Player(10),'Rhpt',2)
    call SetPlayerTechResearched(Player(10),'Rhde',1)
    call SetPlayerTechResearched(Player(10),'Rhan',1)
    call SetPlayerTechResearched(Player(10),'Rhst',2)
    call SetPlayerTechResearched(Player(10),'Rhla',3)
    call SetPlayerTechResearched(Player(10),'Rhlh',2)
    call SetPlayerTechResearched(Player(10),'Rhse',1)
    call SetPlayerTechResearched(Player(10),'Rhfl',1)
    call SetPlayerTechResearched(Player(10),'Rhss',1)
    call SetPlayerTechResearched(Player(10),'Rhrt',1)
    call SetPlayerTechResearched(Player(10),'Rhpm',1)
    call SetPlayerTechResearched(Player(10),'Rhcd',1)
    call SetPlayerTechResearched(Player(10),'Rhfs',1)
    call SetPlayerTechResearched(Player(10),'Rhfc',1)
    call SetPlayerTechResearched(Player(10),'Rome',3)
    call SetPlayerTechResearched(Player(10),'Rora',3)
    call SetPlayerTechResearched(Player(10),'Roar',3)
    call SetPlayerTechResearched(Player(10),'Rwdm',1)
    call SetPlayerTechResearched(Player(10),'Ropg',1)
    call SetPlayerTechResearched(Player(10),'Robs',1)
    call SetPlayerTechResearched(Player(10),'Rows',1)
    call SetPlayerTechResearched(Player(10),'Roen',1)
    call SetPlayerTechResearched(Player(10),'Rovs',1)
    call SetPlayerTechResearched(Player(10),'Rowd',2)
    call SetPlayerTechResearched(Player(10),'Rost',2)
    call SetPlayerTechResearched(Player(10),'Rosp',3)
    call SetPlayerTechResearched(Player(10),'Rotr',1)
    call SetPlayerTechResearched(<