1. Are you planning to upload your awesome map to Hive? Please review the rules here.
    Dismiss Notice
  2. The contestants were to create water structures for the 20th Terraining Contest. Choose one in the public poll!
    Dismiss Notice
  3. Join other hivers in a friendly concept-art contest. The contestants have to create a genie coming out of its container. We wish you the best of luck!
    Dismiss Notice
  4. The Melee Mapping Contest #4: 2v2 - Results are out! Step by to congratulate the winners!
    Dismiss Notice
  5. We're hosting the 15th Mini-Mapping Contest with YouTuber Abelhawk! The contestants are to create a custom map that uses the hidden content within Warcraft 3 or is inspired by any of the many secrets within the game.
    Dismiss Notice
  6. Check out the Staff job openings thread.
    Dismiss Notice

Trigger Viewer

Burning Skies 1.1.w3x
Variables
IZZZZZZI INFO IZZZZZI
Informations
Credits and CL
IZZZZZZI SYSTEMS IZZZZZZI
Core Systems
MemoryLeakHelper
Bonus Mod
Unit Indexer
Damage Engine
Additional Libraries
Table
Parachute by Haley
Parachute Init
Parachute Drop
Parachute Loop
IZZZZZZI SETUP IZZZZZZI
Initialization
Init
Start Campaign AI
Setup ComputerPlayers
SetupCinematicPlayer
Setup PlayerResources
Setup Allies
Setup CinematicUnits
Setup Fire
Setup Doors
Setup SummoningCircle
Setup Timers
Setup Vision
Setup Quests
Difficulty
Dialog
Button Response
Dialog 2
Response 2
Difficulty Easy
Difficulty Normal
Normal Spellcaster
Difficulty Hard
Hard Spellcasters
Hard Soldiers
Difficulty Easy Endless
Difficulty Normal Endless
Difficulty Hard Endless
Endless Score
Endless Score Update
Endless Challenge Up
Endless Hour
Suicide AI Rush
Paradrop Wave North
Paradrop Wave West
Paradrop Wave East
TimerRushNormal
TimerRushHard
Paradrop Rush Normal
Paradrop Rush Hard
ComputerResources
TealGold
BlueGold
RedGold
TealLumber
BlueLumber
RedLumber
Level Data
Load Heroes
Load Arthas
Load KelThuzad
Next Level Run
Max Level Hit
IZZZZZZI CINEMATICS IZZZZZZI
OpeningCinematic
OpeningCancelled
Opening01
Opening02
Opening03
MiningAcolytes
EndingCinematic
ArthasHoldPosition
EndingCancelled
Ending01
IZZZZZZZZZZZZZZZZZZZZZZZI
KelThuzad Summon Reset
KelThuzad Animation Resets
KelThuzad attack message
DialogueStart
DialogueCooldown
Reinforcements
Timer01HellHound
Timer01HellHound Queue
Timer02HellHound
Timer02HellHound Queue
Timer03HellHound
Timer03HellHound Queue
TimerInfernals
TimerInfernals Queue
ShadeScouts
Shades
ShadeFountain
ShadeFountain Queue
Hermit
ArchmageLevel
ArchmageSpell
SheepContainmentArea
GoblinMinesSideQuest
InitSideQuest
InitSideQuest Queue
QuestCompleted
GoblinMine01
GoblinMine02
GoblinMine03
GoblinMine04
DalaranReinforcementSideQuest
InitSideQuest2
InitSideQuest2 Queue
QuestCompleted2
Periodic Spawn
Generator Shield Break
Spawning Ends
DialogAttack
Arthas01
Arthas01 Queue
Arthas02
Arthas02 Queue
VictoryDefeat
KelThuzadDead
Victory
Wipe The Map Victory
Player Kills All
IZZZZZZI SPELL LISTS IZZZZZZI
Units
Apotheracy Death Curse
Towers
Auto Raise Dead
Auto Raise Dead Copy
Auto Curse
Auto Curse Copy
Arthas
Soul Hunger
Soul Hunger Copy
Captain Falric
Corruption Strike Dummy
Corruption Strike
Destruction Shield Start
Destruction Shield Effect Update
Destruction Shield Damage
Norn
Cursed Staff
Cursed Staff Copy
IZZZZZZI NEW FEATURES IZZZZZZI
Skip Cinematic
Skip Cinematic Vote
AI Auto Agree
Virus Injection
Injection Start
Injection Cancelled
Injection Ready
Injection Effect
Unit Modifications
Spectre
Spectre Copy
IZZZZZZI UNDEAD AI IZZZZZZI
Resources + Tech
RT
Income
Hero MtP
Revive Hero
IZZZZZZI RUSH AI IZZZZZZI
Player 10
Final Rush
Rush 1
Hero Rush
Rush
Rush Reset
// Map header custom code

// SimError by Vexorian at wc3c.net

// Sim Error (modified)

function CSS_SimError takes string s returns nothing
    local string msg = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00" + s + "|r"
    local player ForPlayer = GetTriggerPlayer()
    local sound error = CreateSoundFromLabel("InterfaceError", false, false, false, 10, 10)

    if GetLocalPlayer() == ForPlayer then
        call ClearTextMessages()
        call DisplayTimedTextToPlayer(ForPlayer, 0.52, 0.96, 2.00, msg)
        call StartSound(error)
    endif

    set ForPlayer = null
endfunction

function CSS_SimNotification takes string s returns nothing
    local string msg = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cff32cd32" + s + "|r"
    local player ForPlayer = GetTriggerPlayer()
    local sound notify = CreateSoundFromLabel("ItemReward", false, false, false, 10, 10)

    if GetLocalPlayer() == ForPlayer then
        call ClearTextMessages()
        call DisplayTimedTextToPlayer(ForPlayer, 0.52, 0.96, 2.00, msg)
        call StartSound (notify)
    endif

    set ForPlayer = null
endfunction

// Bound Int by Magtheridon96 at hiveworkshop.com

// BoundInt

function BoundInt takes integer i, integer min, integer max returns integer
    return IMaxBJ(IMinBJ(i, max), min)
endfunction

// Bonus Handling Code

function CSS_AddBonus takes unit u, integer amount, integer bonusType returns nothing
    local integer max = udg_CSS_Power[17]
    local integer min = -udg_CSS_Power[17]
    local integer i = 16
    local integer j = LoadInteger (udg_CSS_Hashtable, GetHandleId(u), bonusType)

    if amount > max - 1 or amount < min then
        call CSS_SimError ("Value too high or too low")
        return
    endif

    if amount + j >= max or amount + j <= min then
        call CSS_SimError ("Current value at maximum or minimum")
    endif

    set amount = amount + j
    call BoundInt (amount, min, max - 1)

    if bonusType < 0 or bonusType > 10 then
        call CSS_SimError ("CSS Error: Invalid bonus type (" + I2S(bonusType) + ")")
        return
    elseif bonusType == 8 or bonusType == 9 then

        if bonusType == 8 and amount*1. + GetUnitState(u, UNIT_STATE_MAX_LIFE) <= 0 then
            call CSS_SimError ("Unit's current max life is lower than the negative bonus amount. Unable to subtract.")
            return
        elseif bonusType == 9 and amount*1. + GetUnitState(u, UNIT_STATE_MAX_MANA) <= 0 then
            call CSS_SimError ("Unit's current max mana is lower than the negative bonus amount. Unable to subtract.")
            return
        endif

        call SaveInteger(udg_CSS_Hashtable, GetHandleId(u), bonusType, amount)

        if amount < 0 then
            set amount = max + amount
        else
            call UnitRemoveAbility(u, udg_CSS_Abilities[(bonusType + 1)*18 - 1])
        endif

        loop
            if amount >= udg_CSS_Power[i] then
                call UnitAddAbility(u, udg_CSS_Abilities[bonusType*18 + i])
                call UnitMakeAbilityPermanent(u, true, udg_CSS_Abilities[bonusType*18 + i])
                set amount = amount - udg_CSS_Power[i]
            else
                call UnitRemoveAbility(u, udg_CSS_Abilities[bonusType*18 + i])
            endif
        
            set i = i - 1
            exitwhen i < 0
        endloop

        if LoadInteger(udg_CSS_Hashtable, GetHandleId(u), bonusType) < 0 then
            call UnitAddAbility(u, udg_CSS_Abilities[(bonusType + 1)*18 - 1])
            call UnitMakeAbilityPermanent(u, true, udg_CSS_Abilities[(bonusType + 1)*18 - 1])
        endif

    else

        call SaveInteger(udg_CSS_Hashtable, GetHandleId(u), bonusType, amount)

        if amount < 0 then
            set amount = max + amount
            call UnitAddAbility(u, udg_CSS_Abilities[(bonusType + 1)*18 - 1])
            call UnitMakeAbilityPermanent(u, true, udg_CSS_Abilities[(bonusType + 1)*18 - 1])
        else
            call UnitRemoveAbility(u, udg_CSS_Abilities[(bonusType+1)*18 - 1])
        endif

        loop
            if amount >= udg_CSS_Power[i] then
                call UnitAddAbility(u, udg_CSS_Abilities[bonusType*18 + i])
                call UnitMakeAbilityPermanent(u, true, udg_CSS_Abilities[bonusType*18 + i])
                set amount = amount - udg_CSS_Power[i]
            else
                call UnitRemoveAbility(u, udg_CSS_Abilities[bonusType*18 + i])
            endif
        
            set i = i - 1
            exitwhen i < 0
        endloop

    endif
endfunction

// Clear bonus

function CSS_ClearBonus takes unit u, integer bonusType returns nothing

    if bonusType > 10 or bonusType < 0 or GetUnitTypeId (u) == 0 or IsUnitType (u, UNIT_TYPE_DEAD) then
        return
    endif

    call CSS_AddBonus (u, -LoadInteger (udg_CSS_Hashtable, GetHandleId (u), bonusType), bonusType)
endfunction

// Get current bonus

function CSS_GetBonus takes unit u, integer bonusType returns integer

    if bonusType > 10 or bonusType < 0 or GetUnitTypeId (u) == 0 or IsUnitType (u, UNIT_TYPE_DEAD) then
        return 0
    endif

    return LoadInteger (udg_CSS_Hashtable, GetHandleId (u), bonusType)
endfunction
Name Type Is Array Initial Value
AdvSoldiers unit No
Archimonde unit No
Arthas unit No
BlightRange real No
BuildingFortified unit No
CinematicUnitGroup group No
ConstructedBuilding unit No
CountdownTimerWindow timerdialog No
CSS_Abilities abilcode Yes
CSS_Counter integer No
CSS_EventMainItem item No
CSS_EventMainItemStacked item Yes
CSS_EventSocketItem item No
CSS_EventSocketItemStacked item Yes
CSS_EventUnit unit No
CSS_EventUnitStacked unit Yes
CSS_GemBonusBoolean boolean No
CSS_GemLevel integer No
CSS_Hashtable hashtable No
CSS_Power integer Yes
CSS_PreloadBoolean boolean No
CSS_SocketingEnabled boolean No
CSS_String string Yes
DamageBlockingAbility abilcode No
DamageEvent real No
DamageEventAmount real No
DamageEventExplodesUnit boolean No
DamageEventOverride boolean No
DamageEventPrevAmt real No
DamageEventSource unit No
DamageEventsWasted integer No
DamageEventTarget unit No
DamageEventTrigger trigger No
DamageEventType integer No
DamageModifierEvent real No
DamageTypeDOT integer No
DamageTypeRanged integer No
DamageTypeSpell integer No
DarkSummonMissile effect No
DarkSummonTarget effect No
DeathSentence timer No
Dialog dialog No
Dialog_Button button Yes
DifEndless string No
DmgEvLife real No
DmgEvN integer No
DmgEvStack unit Yes
DmgEvTimer timer No
DmgTypPrev integer No
DSS_Damage_Storage integer No
EndingCancelled boolean No false
EndlessBoard leaderboard No
EndlessHandicapIncrement real No
EndlessMode boolean No
EVENT_SOCKET_FINISH real No
Falric unit No
GameOver boolean No false
HasVote boolean Yes
HealthBonus integer No
HellHoundEffect01 effect No
HellHoundEffect02 effect No
HellHoundEffect03 effect No
HourModifier integer No
HungerBonus integer No
InfernalEffect01 effect No
InfernalEffect02 effect No
InfernalEffect03 effect No
InfernalEffect04 effect No
InjectReady boolean No
KelThuzad unit No
KelzResetTimer timer No
loopIndex integervar No
MainLeader player No
ManaBonus integer No
OpeningCancelled boolean No false
OpeningEnd boolean No false
PA_Ability abilcode No
PA_Buff buffcode No
PA_BuffedGroup group No
PA_DamageBonus integer No
PA_Group group No
PA_Level integer No
PA_Point location No
PA_Radius real Yes
PA_SubGroup group No
PA_SubUnit unit No
PA_Unit unit No
Pcht_attachment string No
Pcht_dropAngle real No
Pcht_dropCreateNew boolean No
Pcht_dropEndTrigger trigger No
Pcht_dropHeight real No
Pcht_dropPlayer player No
Pcht_dropPoint location No
Pcht_dropSpeed real No
Pcht_dropUnit unit No
Pcht_dropUnitType unitcode No
Pcht_endTrigger trigger Yes
Pcht_height real Yes
Pcht_index integer No
Pcht_lastCreatedUnit unit No
Pcht_loopSpeed real No
Pcht_loopTrigger trigger No
Pcht_maxIndex integer No
Pcht_model effect Yes
Pcht_modelPath string No
Pcht_speed real Yes
Pcht_unit unit Yes
Player player No
QuestDalaranReinforcement quest No
QuestDalaranReinforcementReq questitem No
QuestGoblinMine quest No
QuestGoblinMineCompleted boolean No
QuestGoblinMineReq questitem No
QuestSummoning quest No
QuestSummoningReq questitem No
RequestNumber integer No
RevPoint location No
Score integer Yes
ScorePlayer player No
SkipCinVote integer No
Souls integer No
SummoningDuration real No
SummoningEffect effect No
Temp_Group group No
Temp_Point location No
Temp_Point2 location No
Temp_Point3 location No
TempInt integer No
tempLoc location No
TempPlayer player No
tempPlayer player No
TempUnit unit No
Tichondrius unit No
TimerHellHound01 timer No
TimerHellHound02 timer No
TimerHellHound03 timer No
TimerInfernals timer No
TimerRushHard timer No
TimerRushNormal timer No
TimerSideQuest timer No
TimerSummoning timer No
TP location No
UDex integer No
UDexGen integer No
UDexNext integer Yes
UDexPrev integer Yes
UDexRecycle integer No
UDexUnits unit Yes
UDexWasted integer No
UnitDamageRegistered boolean Yes
UnitIndexerEnabled boolean No
UnitIndexEvent real No
UnitIndexLock integer Yes
VampiricAura effect No
WarningLoopCooldownTimer timer No
ZDialog dialog No
ZDialog_Button button Yes
Credits and CL
  Events
  Conditions
  Actions
    -------- CHANGELOG --------
    Quest - Create a Optional quest titled Ver 1.1 with the description AI now start with level 5 Power of the Scourge upgradeIncreased Necromancer Tower's Death Bolt cooldown from 1 to 3 secondsFixes a bug with AI stop attacking randomlyFixes aesthetic of Skeleton Elite ArcherReposition one of Falric's Ziggurats and replace it with Spirit TowerBanshee Tower and Necromancer Tower now requires Black CitadelChanged Footman model back to defaultGreatly improves Captain and Adv. Cold Tower statsAdded additional Captains and Adv. Cold Towers around DalaranRemoves Food Max from all difficultiesReplaces Norn's Aura of Blight with Leech AuraIncreases Death Sentence duration from 15 (7) to 30 (15) secondsKNOWN BUG : Acolytes and Ghouls were taken from their resource gathering activity near Kel'Thuzad when he was attacked by Footmen, using icon path ReplaceableTextures\CommandButtons\BTNBlackCitadel.blp
    Quest - Create a Optional quest titled Ver 1.0 with the description Full Public Release, using icon path ReplaceableTextures\CommandButtons\BTNBlackCitadel.blp
    Quest - Create a Optional quest titled Ver 0.2.1 [Alpha] with the description Fixed blue AIFixed Archmages not learning abilitiesRush Archmages no longer gain level, level increased to 3Player now can reach level 12 on Endless ModeAI no longer needs foodRenamed Siege Engine to Steam TankRush Archmages now revives and gets more powerful with each reviveGiant Skeleton Warriors now has BashIncrease Rush AI random max goldAttempted to fix Final RushFood for undead units reduced by 1Reverted Spellcaster teching requirement to default, using icon path ReplaceableTextures\CommandButtons\BTNBlackCitadel.blp
    Quest - Create a Optional quest titled Ver 0.2.0 [Alpha] with the description Reduces massive Paradrop amount by 50%Modifies Easy/Normal ParadropAdded 2 Barracks to east and portal baseRemove 1 Barrack at WestAdded New Upgrade for Endless ModeChanged Norn modelChanged Falric's stat distribution and base stat into Agility from StrengthAdded lumber bounty to Endless ModeStarting unit changesRemoves Maiden of Pain and Eredar Warlock from Demon GateShuffled Skeleton Champion and Abomination between Falric and Norn tech treesChanged Techtree RequirementAdded 1 Gryphon for Kirin Tor (Portal Base)Fixed Player 5 and 6 ending cinematic cameraIncreased Enhanced Survivalism bonusesAdded enemy buffing for Endless ModeImproved Norn's Skeleton abilityAdded Total Score for Endless Mode, using icon path ReplaceableTextures\CommandButtons\BTNBlackCitadel.blp
    Quest - Create a Optional quest titled Ver 0.1.3 [Alpha] with the description MAJOR FIX : Virus Injection not properly spawn unitsHeavily improves Falric's Tainting Energy, Norn's Death Sentence, Arthas' Empower the Scourge, Arthas' Death Coil and Falric's Wave of Death CoilsAdded Tier 1 unique ranged unit for Falric and Norn, replacing Crypt FiendAdded Maiden of Pain and Eredar Warlock into Demon Gate unit listAdded Bounty Bonus for Endless Mode, using icon path ReplaceableTextures\CommandButtons\BTNArchimonde.blp
    Quest - Create a Optional quest titled Ver 0.1.2 [Alpha] with the description Removed Skeleton HallAdded Necromancer Tower and Banshee TowerAdded Another Upkeep TierAnimate Dead units no longer invulnerableLow Gold Amount warning increased from 1500 to 2500Ending Cinematic now erases all units that isn't involvedTainting Energy added to FalricAura of Blight added to Arthas and NornImproved Normal and Hard SpellcastersRemoved BattleshipsMore enemy spawnsReduce initial assault to Falric's BaseHeavily improves Falric's Tainting Energy, Norn's Death Sentence, Arthas' Empower the Scourge, Arthas' Death Coil and Falric's Wave of Death Coils, using icon path ReplaceableTextures\CommandButtons\BTNArchimonde.blp
    Quest - Create a Optional quest titled Ver 0.1.1 [Alpha] with the description MAJOR FIX : Endless Mode now run opening cinematic properly, also no longer spawns reinforcement during cinematicMAJOR FIX : Hopefully for real, fixed Archimonde during the appearance when summoned, where he was moving to an odd direction for some reasonMAJOR FIX : Hotkeys for Hero Spell are now QWERT basedEndless Mode reinforcement now comes on 5, 10, 15, and 30 minutes of the gameFixed the Ending CinematicWave of Death Coil now has proper debuffCorruption Strike [Falric] now increases max health upon deathblow and increased from 1/2/3 to 5/5/5Cursed Staff [Norn] now increases max mana per attack by 1/2/3Added Skeleton Warrior as trained unit in Skeleton HallSkeleton Hall now provides 15 foods from 11 foods, and health reduced from 600 to 575Hasten the rush timer from (e/n/i) 150/150/300 to 200/200/400Weakens Hard Difficulty RiflemansAdded 1 Skeleton Champion on Falric's Initial BaseRename Dalaran Ambush to Dalaran DefendersAdded 1 Barrack for Dalaran DefendersIncrease Endless Handicap Bonus from 2.5/2.5/2.5% to 3/4/5% (e/n/i)Fixed Norn's Mana Bonus from his Cursed Staff abilityChanged Norn's IconCreates a dummy ability to show Corruption Strike effectsWeakens Undead AIAdded Skeletal Mage to Skeleton HallSkeleton Warriors from Skeleton Hall no longer cost foodFixed several minor errors with Virus InjectionImproves Rush Paradrop for Easy and NormalWeakens Rush Paradrop for HardAdd more Barracks for spawningRemoves Item Bonus when reaching Level 10, using icon path ReplaceableTextures\CommandButtons\BTNArchimonde.blp
    Quest - Create a Optional quest titled Ver 0.1.0 [Alpha] with the description MAJOR FIX : Player 10 (Paradrops and Footman Rush) are now attacking Kel'thuzadModifies Virus Injection (reduces minimal health from 200 to 25)Improves Hard Mode significantlyImproves Easy and Normal Modes by a little bitFix Endless Mode to become truly EndlessDestruction Shield [Falric] Mana Cost increased from 100 to 200Added Skeleton HallIncrease Summon Skeleton [Norn] Cooldown from 9/7.2/6.48 to 15/13.5/12.15Reduces Cursed Staff [Norn] Mana Bonus from 10/20/30 to 1/2/3 per attackIncreases Cursed Staff [Norn] Health Bonus from 0.01/0.02/0.03% to 1/2/3% of Norn's HealthIncrease Falric and Norn start level from 7 to 8Fixed Norn and Falric Spell X/Y PositionDeath Coil [Arthas] can be used on selfDeath Pact [Arthas] is removed and replaced with a buffing skill named Empower the Scourge [Arthas]Death Coil [Arthas] heal (damage) value changed from 200/400/600 (100/200/300) to 250/500/1000 (125/250/500), mana cost from 75/75/75 to 75/82/90, cooldown from 6/6/6 to 6/7/8 seconds and cast range 800/800/800 to 800/900/1000Soul Hunger [Arthas] now adds additional 5 health and mana, fixed tooltip description to explain the effects more properlyIncreased SideQuest GoblinLandMine Timer from 30 second to 120 second to triggerChanges Reinforcement Arrival duration to fit each timer value to arrive at different times to allow maximum reinforcement usage in each timer valueImproves the timer, now it begans after the opening cinematic endsFix the Fel Stalker Demon Gate PurchaseIncrease Generator Health from 1000 to 1500Increase Portal Health from 400 to 1750Corruption Strike [Falric] now adds extra max health of 1/2/3 per attack, using icon path ReplaceableTextures\CommandButtons\BTNArchimonde.blp
    Quest - Create a Optional quest titled Ver 0.0.3 [Alpha] with the description Added Virus InjectionEndless Mode [Accepting Records]Minor Bug Fixes, using icon path ReplaceableTextures\CommandButtons\BTNArchimonde.blp
    Quest - Create a Optional quest titled Ver 0.0.2 [Alpha] with the description Public Release!Major Tweaks for the map from Closed Beta., using icon path ReplaceableTextures\CommandButtons\BTNArchimonde.blp
    Quest - Create a Optional quest titled [Closed Beta II] with the description Major Closed Release from the first closed Beta!, using icon path ReplaceableTextures\CommandButtons\BTNCaptainFalric.blp
    Quest - Create a Optional quest titled [Closed Beta I] with the description First Release to Some THW Members, using icon path ReplaceableTextures\CommandButtons\BTNCaptainFalric.blp
    -------- CREDITS --------
    Quest - Create a Optional quest titled Interface Credits with the description Spellbound [Hive Workshop] for Voidspawn UI, using icon path ReplaceableTextures\CommandButtons\BTNInfernalStone.blp
    Quest - Create a Optional quest titled Model Credits with the description Falric Model by Alastor [Hive Workshop]Darkness Citadel by Frankster [Hive Workshop] [Removed on 0.2.0]PlatedFootman by HappyTauren [Hive Workshop] [Removed on 0.1.3]Parachute by Bisnar13 [Hive Workshop]Diablo I - Archbishop Lazarus, the Corrupted Advocate by Rubellu Sidus [Hive Workshop]Beta Footman by Blizzard Entertainment [Warcraft 3 Beta]Necropolis 4 Tier by Ujimasa Hojo [Hive Workshop]Necromancer by Direfury [Hive Workshop]Reincarnate (Raise Dead) by 00110000 [Hive Workshop]Arcane Barrack by Ujimasa Hojo [Hive Workshop]Human Lumber Mill by Ujimasa Hojo [Hive Workshop], using icon path ReplaceableTextures\CommandButtons\BTNHeroDeathKnight.blp
    Quest - Create a Optional quest titled Icons Credit with the description PASTier3 by HappyTauren [Hive Workshop] [Removed on 0.2.0]Diablo I - Archbishop Lazarus, the Corrupted Advocate by Rubellu Sidus [Hive Workshop]Alternate Halls of the Dead by Ujimasa Hojo [Hive Workshop] [Removed On 0.2.0]Alternate Black Citadel by Ujimasa Hojo [Hive Workshop]Corruption Blade by Hemske [Hive Workshop], using icon path ReplaceableTextures\CommandButtons\BTNArchbishopLazarus.blp
    Quest - Create a Optional quest titled System Credits with the description Table by Bribe [Hive Workshop]Memory Leak Destroyer by MapperMalte [Hive Workshop]CSS by Doomlord [Hive Workshop]Parachute System by Haley [Hive Workshop], using icon path ReplaceableTextures\CommandButtons\BTNDeepLordRevenant.blp
    Quest - Create a Optional quest titled Helpers Credits with the description Hell_Master [Hive Workshop] aka Allain55X [Garena], using icon path ReplaceableTextures\CommandButtons\BTNHornOfDoom.blp
    Quest - Create a Optional quest titled Tester Credits with the description UndeadImmortal [Hive Workshop] aka The_Optimizer [Garena]BreathingAcid [Hive Workshop] aka NeroisHere [Garena]ILH [Hive Workshop] aka ILHKevin [Garena]Rheiko [Hive Workshop/Garena]Hell_Master [Hive Workshop] aka Allain55X [Garena]Forsaken [Hive Workshop]Sylvie [Hive Workshop]LegendzKing [Hive Workshop], using icon path ReplaceableTextures\CommandButtons\BTNInfernalStone.blp
//hook GetLocationX CatchLocation
//hook GetLocationY CatchLocation
//hook ForGroup FG

129k

3,02 + 43,32 + 697,86
744
library MemoryLeakHelper initializer Init requires Table
// ==================================
// Give credits to Mr.Malte when used!
//===========================================================================
// Information:
//==============
//
//  There are things called 'memory Leaks'. When you create a group or use a location
//  without destroying it, you will cause lag that stays in the whole game.
//  If you implement this library into your map it will automatically fix a big part
//  of those memory leaks, so reduce the lag extremely.
//  This should mainfully be used by GUI-users because the system is designed for them.
//
//  Of course no system can work totally automatically.
//  But there is only one thing you have to do in order to prevent bugs:
//  If you make groups or locations that have to be filled for more than CLEAN_UP_INTERVAL seconds
//  you have to save them with the code:
//
//  call ProtectHandle(XXX)
//
//  Where XXX is filled with your variable. Otherwise that variable gets destroyed
//  automatically. You can also fill in XXX with
//
//  GetLastCaughtHandle()
//
//  But if you save the things in a variable, I'd recommend to directly put the
//  variable into the brackets. Note: GUI variables have the prefix 'udg_' in JASS.
//
//     This gives the 'Do Nothing' function in GUI a sense!
//     When you call DoNothing, all data that were caught by this system
//     will be destroyed in CLEAN_UP_INTERVAL seconds, ignoring how big
//     the number of caught handles is. This will not work, if the system is
//     already cleaning up.
//===========================================================================
// Implementation:
//===============
//
//  The easiest thing is to directly implement this thing into your map, when you start making
//  it, so you don't have to look over your globals and use ProtectHandle on them.
//  These are the steps you have to do to clear the memory leaks:
//
//  1. Download a tool called 'JassNewGen', and unpack it somewhere. You need that
//     edit to use this tool. The 'JassNewGen' is used very commonly and offers other
//     nice features. You can find it at:
//     http://www.wc3c.net/showthread.php?t=90999

//  2. Make a new trigger, and convert it to custom text. Insert everything
//     the library contains into that trigger.
//
//  3. Download a system called 'Table' from this link:
//     http://www.wc3c.net/showthread.php?t=101246
//     Do the same installation stuff for 'Table' as for this system.
//
//  4. Save your map and enjoy :-)
//    
//  Note: Instead of doing 2 and 3 you can also copy and paste the folder 'MemoryLeakHelper'
//        from the example map.
//===========================================================================
// How bad are memory leaks?
//==========================
//  If you don't remove memory leaks, they suck memory:
//
//  Location:  0.361 kb
//  Group:     0.62 kb + 0.040 kb for each unit in the group.
//  Effect:    11.631 kb
//
// Both, locations and groups are used very frequently. So when you don't fix those memory leaks,
// you will experience lag.

//        When you want to see, how useful this is for your map, implement it
//        and write 'call DisplayLeaks()' into a custom script that is fired when
//        they game ends.
//===========================================================================
// Changelog:
//===========
// v1.00 --- first version
// v1.01 --- able to detect special effects, too now.
// v1.02 --- made the system safer and reduced the number of variables to protect greatly.
// v1.03 --- Gave a sense to 'DoNothing'* GUI function and made the Pass Data part
//           more accurate, so the time until data get destroyed are much more explicit
//           now.
// v1.04 --- Added the very important constant MAX_LEAK_INSTANCES
//
// *if you don't want it to be hooked, comment line 350.
//===========================================================================
// FAQ:
// ====
//  1. Why don't you hook functions like GetLocationX or the ForGroup without BJ?
//
//      Answer: Well, in jass you would never destroy groups, rather have one global group
//              and clear/recycle it. But GUI always creates new groups with the functions.
//              So actually, jass groups don't have to be destroyed.
//              And special effects are mostly instantly destroyed and locations are never used.
//              So I don't want to endanger breaking jass systems, I rather make it for GUI, where it is
//              really useful and neccessary
//
//  2. Why should I protect my variables instead of killing my leaks?
//
//      Answer: In GUI, unitgroup effect and location variables are actually just used
//              for destroying stuff. It is rare that you really want to keep the groups.
//              So in fact, it is like one-hundred times less frequent that you want to keep
//              your data instead of destroying it.
//
//  3. I can't use jass. How can this system be useful for me?
//
//      Answer: This system works mainly automatically; You just have to use jass very rarely (and then a simple function).
//              The functions you need are:
//
//                  ProtectVariable(udg_###)
//                  GetLastCaughtHandle()
//
//              where ProtectVariable saves something you want to keep from getting destroyed. Just replace ### with your
//              variable name. NOTE: You don't have to protect the variable, when you want to keep the data inside less than
//              CLEAN_UP_INTERVAL seconds.
//
//              and where GetLastCaughtHandle responses to the handle* that was used lastly.
//              That can be for example the point where you just spawned a unit.
//              
//      * 'handle' means a specialeffect, a location or a unitgroup
//
//  4. If you give functions like 'DelayMMH', why don't you add functions like 'Disable/EnableMMH'?
//
//      Answer: Well, I want to protect the user. You do not need Disable/Enable functions.
//              To me the danger is too big, that you forget to activate it again or do
//              something like that. DelayMMH is totally enough if you don't want this system
//              to affect the code that comes next. Also that prevents, that there are
//              spells like 'Trojan Horses' that get too much access to this and can
//              change it's infrastructure.
//
//===========================================================================
// Functions:
//==========
// ProtectHandle              : Saves a handle from getting destroyed
// ProtectVariable            : Same.
// DoNothing()                : Destroys all data caught by the system right now in X seconds.
// DelayMMD()                 : Stops the system working until the trigger ends/next wait *
//
// * This is as fast as an automatic memory leak destroyer can get. Why should
// you want to disable the system? Because it offers the possibilty to make things
// more efficient. I don't want to say, this is unefficient, because it is not.
// But this will destroy leaks like 10% slower.
//
//===========================================================================


    globals
        // The system fires when you do something that creates a leak.
        // The data that cause leak are saved in a variable then.
        // And every CLEAN_UP_INTERVAL seconds those data are destroyed.
        // This shouldn't be too high, or too low.
        private constant real CLEAN_UP_INTERVAL = 120.
        // If this is set to true, the system will work more slowly (but you wont notice)
        // and count, how much memory this system was able to save.
        // This value is display by the function DisplayLeaks() then.
        // WARNING: This sucks a lot of performance. I would ONLY use it when you want
        // to test, if this is useful for your map. Later set it to false.
        private constant boolean DISPLAY_SAVED_MEMORY = false
        // The Data are only cleaned up, when that many handles were caught
        private constant integer MIN_LEAK_NUMBER = 1750
        // How often are data passed to the destroyer?
        // Leaks stay for a random time between CLEAN_UP_INTERVAL and CLEAN_UP_INTERVAL+PASS_INTERVAL
        // in the game
        private constant real PASS_INTERVAL = 2.5
        // Memory leaks occur pretty frequently. When a leak is caught it is saved in
        // an array. But the array can't have more than MAX_LEAK_INSTANCES instances, so
        // if more than MAX_LEAK_INSTANCES memory leaks occur during a destroy interval,
        // the system fails.
        private constant integer MAX_LEAK_INSTANCES = 60000
    endglobals
   
    globals
        private HandleTable IndexData
        private HandleTable IsSaved
       
        //! textmacro MemoryLeakVars takes NAME, TYPE
        private integer Caught$NAME$Leaks = 0
        private $TYPE$ array $NAME$LeakData[MAX_LEAK_INSTANCES]
        private integer $NAME$DestroyCount = 0
        private $TYPE$ array $NAME$DestroyData[MAX_LEAK_INSTANCES]
        //! endtextmacro
        //! runtextmacro MemoryLeakVars("Location","location")
        //! runtextmacro MemoryLeakVars("Effect","effect")
        //! runtextmacro MemoryLeakVars("Group","group")
       
       
        private integer DestroyedLeaks = 0
        private integer CaughtLeaks = 0
        private integer DestroyedLeaksUser = 0
        private handle LastCaught
        private timer PassTimer = CreateTimer()
        private timer CleanTimer = CreateTimer()
        private timer DelayTimer = CreateTimer()
        private boolean IsDestroying = false
        private real SavedMemory = 0.
        private real LastCheckedGroupMemoryUsage = 0.
        private boolean DestroyThreadRunning = false
        private boolean Disabled = false
       
        // These values were found out in a big leak test by gekko.
        private constant real LOCATION_MEMORY_USAGE        = 0.361
        private constant real GROUP_MEMORY_USAGE           = 0.62
        private constant real GROUP_UNIT_MEMORY_USAGE      = 0.040
        private constant real EFFECT_MEMORY_USAGE          = 11.631
        private constant real REMOVED_EFFECT_MEMORY_USAGE  = 0.066
    endglobals
   
    // ======================================
    // ============= Basic Code =============
    // ======================================
   
    function GetLastCaughtHandle takes nothing returns handle
        return LastCaught
    endfunction
   
    function ProtectHandle takes handle h returns nothing
        set IsSaved[h] = 1
    endfunction
   
    function ProtectVariable takes handle h returns nothing
        set IsSaved[h] = 1
    endfunction

    private function EnableMMH takes nothing returns nothing
        set Disabled = false
    endfunction

    function DelayMMH takes nothing returns nothing
        set Disabled = true
        call TimerStart(DelayTimer,0.00,false,function EnableMMH)
    endfunction
   
    function DisplayLeaks takes nothing returns nothing
        call ClearTextMessages()
        call BJDebugMsg("======= MemoryLeakHelper =======")
        call BJDebugMsg("Destroyed Leaks: "+I2S(DestroyedLeaks))
        call BJDebugMsg("Destroyed Leaks by user: "+I2S(DestroyedLeaksUser))
        call BJDebugMsg("Percentage System: "+R2S(I2R(DestroyedLeaks)/I2R(DestroyedLeaks+DestroyedLeaksUser)*100.)+"%")
        call BJDebugMsg("Percentage User: "+R2S(I2R(DestroyedLeaksUser)/I2R(DestroyedLeaks+DestroyedLeaksUser)*100.)+"%")
        call BJDebugMsg("Leaks until next destroy: "+I2S(MIN_LEAK_NUMBER-CaughtLeaks))
        call BJDebugMsg(" === In Destroy Queue === ")
        call BJDebugMsg("   Group Leaks: "+I2S(GroupDestroyCount))
        call BJDebugMsg("   Location Leaks: "+I2S(LocationDestroyCount))
        call BJDebugMsg("   Effect Leaks: "+I2S(EffectDestroyCount))
        call BJDebugMsg(" === Not in Destroy Queue yet === ")
        call BJDebugMsg("   Group Leaks: "+I2S(CaughtGroupLeaks))
        call BJDebugMsg("   Location Leaks: "+I2S(CaughtLocationLeaks))
        call BJDebugMsg("   Effect Leaks: "+I2S(CaughtEffectLeaks))
        call BJDebugMsg("Time until next PassSequence: "+I2S(R2I(TimerGetRemaining(PassTimer)+0.5))+" seconds.")
        call BJDebugMsg(" ")
        if DISPLAY_SAVED_MEMORY then
            call BJDebugMsg("All in all the MemoryLeakHelper could release "+R2S(SavedMemory)+" kb of memory.")
        endif
        call BJDebugMsg("================================")
    endfunction
   
    private function GroupGetMemoryUsageEnum takes nothing returns nothing
        set LastCheckedGroupMemoryUsage = LastCheckedGroupMemoryUsage + GROUP_UNIT_MEMORY_USAGE
    endfunction
   
    function GroupGetMemoryUsage takes group g returns real
        set LastCheckedGroupMemoryUsage = 0.
        call ForGroup(g,function GroupGetMemoryUsageEnum)
        return LastCheckedGroupMemoryUsage + GROUP_MEMORY_USAGE
    endfunction
   
    //! textmacro ResponseOnLeak takes NAME, VALUE
    private function Catch$NAME$ takes $VALUE$ l returns nothing
        set LastCaught = l
       
        if Disabled then
            return
        elseif Caught$NAME$Leaks == MAX_LEAK_INSTANCES then
            debug call BJDebugMsg("MemoryLeakHelper: Failed to store leak because of size limitations")
            return
        endif
       
        if IndexData.exists(l) == false then
            //call BJDebugMsg("Caught $NAME$")
            set Caught$NAME$Leaks = Caught$NAME$Leaks + 1
            set $NAME$LeakData[Caught$NAME$Leaks] = l
            set IndexData[l] = Caught$NAME$Leaks
        endif
    endfunction
   
    private function AddTo$NAME$DestroyQueue takes $VALUE$ l returns nothing
        set $NAME$DestroyCount = $NAME$DestroyCount + 1
        set $NAME$DestroyData[$NAME$DestroyCount] = l
        set IndexData[l] = $NAME$DestroyCount*-1 // Put his to negative, so we know that this is used in the DestroyQueue now.
    endfunction
   
    private function Release$NAME$ takes $VALUE$ l returns nothing
        local integer index
        if IsDestroying == false and IndexData.exists(l) then
            set index = IndexData[l]
            // If this is true, the index wasn't put to a destroy queue yet.
            if index > 0 then
                set $NAME$LeakData[index] = $NAME$LeakData[Caught$NAME$Leaks]
                set Caught$NAME$Leaks = Caught$NAME$Leaks - 1
            else
                set index = index * -1
                set $NAME$DestroyData[index] = $NAME$DestroyData[$NAME$DestroyCount]
                set $NAME$DestroyCount = $NAME$DestroyCount - 1
            endif
            call IndexData.flush(l)
            set DestroyedLeaksUser = DestroyedLeaksUser + 1
        endif
    endfunction
    //! endtextmacro
    //! runtextmacro ResponseOnLeak("Location","location")
    //! runtextmacro ResponseOnLeak("Group","group")
    //! runtextmacro ResponseOnLeak("Effect","effect")
   
    private function DestroyMemoryLeaks takes nothing returns nothing
        set IsDestroying = true
       
        //call BJDebugMsg("DESTROYING Memory Leaks")
        //! textmacro DestroyLeaks takes NAME, DESTROYCALL, MEMORYUSAGE
        set DestroyedLeaks = DestroyedLeaks + $NAME$DestroyCount
        loop
            exitwhen $NAME$DestroyCount == 0
           
            if DISPLAY_SAVED_MEMORY then
                set SavedMemory = SavedMemory + $MEMORYUSAGE$
            endif
           
            call $DESTROYCALL$($NAME$DestroyData[$NAME$DestroyCount])
            call IndexData.flush($NAME$DestroyData[$NAME$DestroyCount])
            set $NAME$DestroyCount = $NAME$DestroyCount - 1
        endloop
        //! endtextmacro
        //! runtextmacro DestroyLeaks ("Group","DestroyGroup","GroupGetMemoryUsage(GroupDestroyData[GroupDestroyCount])")
        //! runtextmacro DestroyLeaks ("Location","RemoveLocation","LOCATION_MEMORY_USAGE")
        //! runtextmacro DestroyLeaks ("Effect","DestroyEffect","EFFECT_MEMORY_USAGE")
       
        set IsDestroying = false
        set DestroyThreadRunning = false
        //call StartPassTimer.execute() // Strange. This causes bugs sometimes and the function isn't called
        // This is slower, but safe.
        call ExecuteFunc("StartPassTimer")
    endfunction
   
    function StartDestroyThread takes nothing returns nothing
        if DestroyThreadRunning == false then
            set DestroyThreadRunning = true
            call TimerStart(CleanTimer,CLEAN_UP_INTERVAL,false,function DestroyMemoryLeaks)
            call PauseTimer(PassTimer)
        endif
    endfunction
   
    hook DoNothing StartDestroyThread
   
    // We want that the user doesn't have to protect too many variables, but all the variables that are filled longer
    // than CLEAN_UP_INTERVAL seconds. But what, when the handle thing is put into the destroy stack and the next destroy is
    // in 5 seconds, because the last one was 15 seconds ago? We can simply avoid something like that by using a 2-step-system
    // that goes sure, the handle is only destroyed when it passed the CLEAN_UP_INTERVAL twice.
    // Having two kinds of variables is simply easier and more efficient than having another variable that refers to
    // how many times the handle passed the timer; If it isn't passed/cleared in the Interval then, we can't loop
    // that easily through the data and we'd have to fix gaps later; That would suck a lot of performacne.
    private function PassMemoryLeaks takes nothing returns nothing
        //call BJDebugMsg("PassMemoryLeaks")
        //! textmacro PassLeaks takes NAME
        set CaughtLeaks = CaughtLeaks + Caught$NAME$Leaks
        //call BJDebugMsg("Caught $NAME$s: "+I2S(Caught$NAME$Leaks))
        loop
            exitwhen Caught$NAME$Leaks < 1
            if IsSaved.exists($NAME$LeakData[Caught$NAME$Leaks]) == false and $NAME$LeakData[Caught$NAME$Leaks] != null then
                call AddTo$NAME$DestroyQueue($NAME$LeakData[Caught$NAME$Leaks])
            endif
            set $NAME$LeakData[Caught$NAME$Leaks] = null
            set Caught$NAME$Leaks = Caught$NAME$Leaks - 1
        endloop
        //! endtextmacro
        //! runtextmacro PassLeaks ("Group")
        //! runtextmacro PassLeaks ("Location")
        //! runtextmacro PassLeaks ("Effect")
       
        if CaughtLeaks > MIN_LEAK_NUMBER then
            set CaughtLeaks = 0
            //call BJDebugMsg("Caught Leaks: "+I2S(MIN_LEAK_NUMBER))
            //call BJDebugMsg("Now start Destroy Timer")
            set DestroyThreadRunning = true
            call TimerStart(CleanTimer,CLEAN_UP_INTERVAL,false,function DestroyMemoryLeaks)
            // We have to pause this timer a bit; Otherwise it would break the CLEAN_UP_INTERVAL rule.
            call PauseTimer(PassTimer)
        endif
       
    endfunction
   
    // =================================
    // ============= Usage =============
    // =================================
   
    private function PP takes location source, real dist, real angle returns nothing
        call CatchLocation(source)
    endfunction
   
    private function CU takes integer count, integer unitId, player p, location l, real face returns nothing
        call CatchLocation(l)
    endfunction
   
    private function IPO takes unit k, string order, location l returns nothing
        call CatchLocation(l)
    endfunction
   
    private function SUP takes unit who, location l returns nothing
        call CatchLocation(l)
    endfunction
   
    private function SUF takes unit who, location l, real dur returns nothing
        call CatchLocation(l)
    endfunction
   
    private function GUR takes real radius, location l, boolexpr filter returns nothing
        call CatchLocation(l)
    endfunction
   
    private function CUF takes integer count, integer unitId, player whichPlayer, location loc, location lookAt returns nothing
        call CatchLocation(loc)
        call CatchLocation(lookAt)
    endfunction
   
    hook PolarProjectionBJ PP
    hook CreateNUnitsAtLoc CU
    hook CreateNUnitsAtLocFacingLocBJ CUF
    hook IssuePointOrderLocBJ IPO
    hook SetUnitPositionLoc SUP
    hook SetUnitFacingToFaceLocTimed SUF
    hook GetUnitsInRangeOfLocMatching GUR

    hook RemoveLocation ReleaseLocation
   
   
    private function FG takes group g, code callback returns nothing
        call CatchGroup(g)
    endfunction
   
    hook ForGroupBJ FG // :D This should catch all GUI usages for groups.
    hook GroupPickRandomUnit CatchGroup
    hook CountUnitsInGroup CatchGroup
   
    hook DestroyGroup ReleaseGroup
   
    private function ASETU takes string bla, widget d, string blu returns nothing
        // We can not catch THIS effect, but the effect that was created before.
        // So we can destroy all SpecialEffects excpet one.
        call CatchEffect(GetLastCreatedEffectBJ())
    endfunction
   
    private function ASE takes location where, string modelName returns nothing
        call CatchLocation(where)
        call CatchEffect(GetLastCreatedEffectBJ())
    endfunction

    hook AddSpecialEffectLocBJ ASE
    hook AddSpecialEffectTargetUnitBJ ASETU
    hook DestroyEffect ReleaseEffect
    hook DestroyEffectBJ ReleaseEffect
   
    // When I want to make the timer run the PassMemoryLeaks things, I have to use an .execute command which requires an extra func.
    function StartPassTimer takes nothing returns nothing
        //call BJDebugMsg("Restarting PassTimer")
        call TimerStart(PassTimer,PASS_INTERVAL,true,function PassMemoryLeaks)
    endfunction
   
    private function Init takes nothing returns nothing
        set IndexData = HandleTable.create()
        set IsSaved = HandleTable.create()
        call StartPassTimer()
    endfunction
endlibrary
//************************************************************************************************************
//*                                                                                                          *
//*                              CUSTOM STAT SYSTEM (CSS)                                                    *
//*                                                                                                          *
//*   Author:   Doomlord                                                                                     *
//*   Version:  1.5i                                                                                         *
//*                                                                                                          *
//*   Credits:                                                                                               *
//*   + Earth-Fury:    BonusMod binary algoritm; implementation macro.                                       *
//*   + Crigges:       A great amount of help and support.                                                   *
//*   + Geries:        Help me with the item hashtable values cleanup.                                       *
//*   + rulerofiron99: Item Socketing method referenced from [GUI]Right Click Item Recipe v1.05.             *
//*   + Vexorian:      CSS_SimError [url]http://www.wc3c.net/showthread.php?t=101260[/url]                   *
//*   + Magtheridon96: [Snippet]BoundInt [url]http://www.hiveworkshop.com/forums/2294066-post804.html[/url]  *
//*   + WaterKnight:   Help with the stack for custom Event Response.                                        *
//*   + PurgeandFire:  Pinpoint a possible desync bug with the system.                                       *
//*   + Nestharus:     Mentioning the possible negative life bug in his Bonus lib.                           *
//*                                                                                                          *
//************************************************************************************************************


//**************************************************************************************
//* INTRODUCTION:                                                                      *
//*                                                                                    *
//* An alternative to BonusMod for those who prefer a vanilla JASS approach.           *
//*                                                                                    *
//* Just follow the API and you are pretty much done.                                  *
//**************************************************************************************


//********************************************************************************************************
//* REQUIREMENTS:                                                                                        *
//*                                                                                                      *
//* JNGP [url]http://www.hiveworkshop.com/forums/tools-560/jassnewgenpack-5d-227445[/url] (Recommended)  *
//* OR:                                                                                                  *
//* Your superhuman capability to transfer 198 abilities to your map. (Not Recommended)                  *
//********************************************************************************************************


//************************************************************************************************************************************************
//* INSTALLATION INSTRUCTION:                                                                                                                    *
//*                                                                                                                                              *
//* Step 1: Copy the custom code for bonus handling to your map header.                                                                          *
//* Step 2: Use JNGP to implement the system's abilities through macro. Instruction is included in the Implementation Macro trigger.             *
//* Step 3: Copy the whole CSS folder to your map. Don't forget to turn on "Automatically create unknown variables while pasting trigger data".  *
//* Step 4: Except for this trigger, delete every other useless elements.                                                                        *
//* Step 5: Use this BonusMod alternative however you want.                                                                                      *
//*                                                                                                                                              *
//************************************************************************************************************************************************


//**************************************************************************************
//* Bonus Types Identifier:                                                            *
//*                                                                                    *
//* Armor Bonus:        0                                                              *
//* Attack Speed Bonus: 1                                                              *
//* Damage Bonus:       2                                                              *
//* Agility Bonus:      3                                                              *
//* Intelligence Bonus: 4                                                              *
//* Strength Bonus:     5                                                              *
//* Life Regen Bonus:   6                                                              *
//* Mana Regen Bonus:   7                                                              *
//* Life Bonus:         8                                                              *
//* Mana Bonus:         9                                                              *
//* Sight Range Bonus:  10                                                             *
//**************************************************************************************


//********************************************************************************
//* Generic Bonus APIs                                                           *
//*                                                                              *
//* CSS_GetBonus takes unit u, integer bonusType returns integer                 *
//* CSS_AddBonus takes unit u, integer amount, integer bonusType returns nothing *
//* CSS_ClearBonus takes unit u, integer bonusType                               *
//********************************************************************************

// For preloading abilities
function CSS_Preload takes nothing returns nothing
    local integer i = 0
    local unit u = CreateUnit(Player(15), 'hfoo', 0, 0, 0.00)

    loop
        exitwhen i > 197
        call UnitAddAbility(u, udg_CSS_Abilities[i])
        set i = i + 1
    endloop

    call RemoveUnit(u)
    set u = null
endfunction

//===========================================================================
function InitTrig_Bonus_Mod takes nothing returns nothing
    local integer i = 0
    local integer a = 1

    set udg_CSS_Abilities[0] = 'ZxA0'
    set udg_CSS_Abilities[1] = 'ZxA1'
    set udg_CSS_Abilities[2] = 'ZxA2'
    set udg_CSS_Abilities[3] = 'ZxA3'
    set udg_CSS_Abilities[4] = 'ZxA4'
    set udg_CSS_Abilities[5] = 'ZxA5'
    set udg_CSS_Abilities[6] = 'ZxA6'
    set udg_CSS_Abilities[7] = 'ZxA7'
    set udg_CSS_Abilities[8] = 'ZxA8'
    set udg_CSS_Abilities[9] = 'ZxA9'
    set udg_CSS_Abilities[10] = 'ZxAa'
    set udg_CSS_Abilities[11] = 'ZxAb'
    set udg_CSS_Abilities[12] = 'ZxAc'
    set udg_CSS_Abilities[13] = 'ZxAd'
    set udg_CSS_Abilities[14] = 'ZxAe'
    set udg_CSS_Abilities[15] = 'ZxAf'
    set udg_CSS_Abilities[16] = 'ZxAg'
    set udg_CSS_Abilities[17] = 'ZxAh'
    set udg_CSS_Abilities[18] = 'ZxI0'
    set udg_CSS_Abilities[19] = 'ZxI1'
    set udg_CSS_Abilities[20] = 'ZxI2'
    set udg_CSS_Abilities[21] = 'ZxI3'
    set udg_CSS_Abilities[22] = 'ZxI4'
    set udg_CSS_Abilities[23] = 'ZxI5'
    set udg_CSS_Abilities[24] = 'ZxI6'
    set udg_CSS_Abilities[25] = 'ZxI7'
    set udg_CSS_Abilities[26] = 'ZxI8'
    set udg_CSS_Abilities[27] = 'ZxI9'
    set udg_CSS_Abilities[28] = 'ZxIa'
    set udg_CSS_Abilities[29] = 'ZxIb'
    set udg_CSS_Abilities[30] = 'ZxIc'
    set udg_CSS_Abilities[31] = 'ZxId'
    set udg_CSS_Abilities[32] = 'ZxIe'
    set udg_CSS_Abilities[33] = 'ZxIf'
    set udg_CSS_Abilities[34] = 'ZxIg'
    set udg_CSS_Abilities[35] = 'ZxIh'
    set udg_CSS_Abilities[36] = 'ZxB0'
    set udg_CSS_Abilities[37] = 'ZxB1'
    set udg_CSS_Abilities[38] = 'ZxB2'
    set udg_CSS_Abilities[39] = 'ZxB3'
    set udg_CSS_Abilities[40] = 'ZxB4'
    set udg_CSS_Abilities[41] = 'ZxB5'
    set udg_CSS_Abilities[42] = 'ZxB6'
    set udg_CSS_Abilities[43] = 'ZxB7'
    set udg_CSS_Abilities[44] = 'ZxB8'
    set udg_CSS_Abilities[45] = 'ZxB9'
    set udg_CSS_Abilities[46] = 'ZxBa'
    set udg_CSS_Abilities[47] = 'ZxBb'
    set udg_CSS_Abilities[48] = 'ZxBc'
    set udg_CSS_Abilities[49] = 'ZxBd'
    set udg_CSS_Abilities[50] = 'ZxBe'
    set udg_CSS_Abilities[51] = 'ZxBf'
    set udg_CSS_Abilities[52] = 'ZxBg'
    set udg_CSS_Abilities[53] = 'ZxBh'
    set udg_CSS_Abilities[54] = 'ZxG0'
    set udg_CSS_Abilities[55] = 'ZxG1'
    set udg_CSS_Abilities[56] = 'ZxG2'
    set udg_CSS_Abilities[57] = 'ZxG3'
    set udg_CSS_Abilities[58] = 'ZxG4'
    set udg_CSS_Abilities[59] = 'ZxG5'
    set udg_CSS_Abilities[60] = 'ZxG6'
    set udg_CSS_Abilities[61] = 'ZxG7'
    set udg_CSS_Abilities[62] = 'ZxG8'
    set udg_CSS_Abilities[63] = 'ZxG9'
    set udg_CSS_Abilities[64] = 'ZxGa'
    set udg_CSS_Abilities[65] = 'ZxGb'
    set udg_CSS_Abilities[66] = 'ZxGc'
    set udg_CSS_Abilities[67] = 'ZxGd'
    set udg_CSS_Abilities[68] = 'ZxGe'
    set udg_CSS_Abilities[69] = 'ZxGf'
    set udg_CSS_Abilities[70] = 'ZxGg'
    set udg_CSS_Abilities[71] = 'ZxGh'
    set udg_CSS_Abilities[72] = 'ZxH0'
    set udg_CSS_Abilities[73] = 'ZxH1'
    set udg_CSS_Abilities[74] = 'ZxH2'
    set udg_CSS_Abilities[75] = 'ZxH3'
    set udg_CSS_Abilities[76] = 'ZxH4'
    set udg_CSS_Abilities[77] = 'ZxH5'
    set udg_CSS_Abilities[78] = 'ZxH6'
    set udg_CSS_Abilities[79] = 'ZxH7'
    set udg_CSS_Abilities[80] = 'ZxH8'
    set udg_CSS_Abilities[81] = 'ZxH9'
    set udg_CSS_Abilities[82] = 'ZxHa'
    set udg_CSS_Abilities[83] = 'ZxHb'
    set udg_CSS_Abilities[84] = 'ZxHc'
    set udg_CSS_Abilities[85] = 'ZxHd'
    set udg_CSS_Abilities[86] = 'ZxHe'
    set udg_CSS_Abilities[87] = 'ZxHf'
    set udg_CSS_Abilities[88] = 'ZxHg'
    set udg_CSS_Abilities[89] = 'ZxHh'
    set udg_CSS_Abilities[90] = 'ZxF0'
    set udg_CSS_Abilities[91] = 'ZxF1'
    set udg_CSS_Abilities[92] = 'ZxF2'
    set udg_CSS_Abilities[93] = 'ZxF3'
    set udg_CSS_Abilities[94] = 'ZxF4'
    set udg_CSS_Abilities[95] = 'ZxF5'
    set udg_CSS_Abilities[96] = 'ZxF6'
    set udg_CSS_Abilities[97] = 'ZxF7'
    set udg_CSS_Abilities[98] = 'ZxF8'
    set udg_CSS_Abilities[99] = 'ZxF9'
    set udg_CSS_Abilities[100] = 'ZxFa'
    set udg_CSS_Abilities[101] = 'ZxFb'
    set udg_CSS_Abilities[102] = 'ZxFc'
    set udg_CSS_Abilities[103] = 'ZxFd'
    set udg_CSS_Abilities[104] = 'ZxFe'
    set udg_CSS_Abilities[105] = 'ZxFf'
    set udg_CSS_Abilities[106] = 'ZxFg'
    set udg_CSS_Abilities[107] = 'ZxFh'
    set udg_CSS_Abilities[108] = 'ZxJ0'
    set udg_CSS_Abilities[109] = 'ZxJ1'
    set udg_CSS_Abilities[110] = 'ZxJ2'
    set udg_CSS_Abilities[111] = 'ZxJ3'
    set udg_CSS_Abilities[112] = 'ZxJ4'
    set udg_CSS_Abilities[113] = 'ZxJ5'
    set udg_CSS_Abilities[114] = 'ZxJ6'
    set udg_CSS_Abilities[115] = 'ZxJ7'
    set udg_CSS_Abilities[116] = 'ZxJ8'
    set udg_CSS_Abilities[117] = 'ZxJ9'
    set udg_CSS_Abilities[118] = 'ZxJa'
    set udg_CSS_Abilities[119] = 'ZxJb'
    set udg_CSS_Abilities[120] = 'ZxJc'
    set udg_CSS_Abilities[121] = 'ZxJd'
    set udg_CSS_Abilities[122] = 'ZxJe'
    set udg_CSS_Abilities[123] = 'ZxJf'
    set udg_CSS_Abilities[124] = 'ZxJg'
    set udg_CSS_Abilities[125] = 'ZxJh'
    set udg_CSS_Abilities[126] = 'ZxK0'
    set udg_CSS_Abilities[127] = 'ZxK1'
    set udg_CSS_Abilities[128] = 'ZxK2'
    set udg_CSS_Abilities[129] = 'ZxK3'
    set udg_CSS_Abilities[130] = 'ZxK4'
    set udg_CSS_Abilities[131] = 'ZxK5'
    set udg_CSS_Abilities[132] = 'ZxK6'
    set udg_CSS_Abilities[133] = 'ZxK7'
    set udg_CSS_Abilities[134] = 'ZxK8'
    set udg_CSS_Abilities[135] = 'ZxK9'
    set udg_CSS_Abilities[136] = 'ZxKa'
    set udg_CSS_Abilities[137] = 'ZxKb'
    set udg_CSS_Abilities[138] = 'ZxKc'
    set udg_CSS_Abilities[139] = 'ZxKd'
    set udg_CSS_Abilities[140] = 'ZxKe'
    set udg_CSS_Abilities[141] = 'ZxKf'
    set udg_CSS_Abilities[142] = 'ZxKg'
    set udg_CSS_Abilities[143] = 'ZxKh'
    set udg_CSS_Abilities[144] = 'ZxE0'
    set udg_CSS_Abilities[145] = 'ZxE1'
    set udg_CSS_Abilities[146] = 'ZxE2'
    set udg_CSS_Abilities[147] = 'ZxE3'
    set udg_CSS_Abilities[148] = 'ZxE4'
    set udg_CSS_Abilities[149] = 'ZxE5'
    set udg_CSS_Abilities[150] = 'ZxE6'
    set udg_CSS_Abilities[151] = 'ZxE7'
    set udg_CSS_Abilities[152] = 'ZxE8'
    set udg_CSS_Abilities[153] = 'ZxE9'
    set udg_CSS_Abilities[154] = 'ZxEa'
    set udg_CSS_Abilities[155] = 'ZxEb'
    set udg_CSS_Abilities[156] = 'ZxEc'
    set udg_CSS_Abilities[157] = 'ZxEd'
    set udg_CSS_Abilities[158] = 'ZxEe'
    set udg_CSS_Abilities[159] = 'ZxEf'
    set udg_CSS_Abilities[160] = 'ZxEg'
    set udg_CSS_Abilities[161] = 'ZxEh'
    set udg_CSS_Abilities[162] = 'ZxD0'
    set udg_CSS_Abilities[163] = 'ZxD1'
    set udg_CSS_Abilities[164] = 'ZxD2'
    set udg_CSS_Abilities[165] = 'ZxD3'
    set udg_CSS_Abilities[166] = 'ZxD4'
    set udg_CSS_Abilities[167] = 'ZxD5'
    set udg_CSS_Abilities[168] = 'ZxD6'
    set udg_CSS_Abilities[169] = 'ZxD7'
    set udg_CSS_Abilities[170] = 'ZxD8'
    set udg_CSS_Abilities[171] = 'ZxD9'
    set udg_CSS_Abilities[172] = 'ZxDa'
    set udg_CSS_Abilities[173] = 'ZxDb'
    set udg_CSS_Abilities[174] = 'ZxDc'
    set udg_CSS_Abilities[175] = 'ZxDd'
    set udg_CSS_Abilities[176] = 'ZxDe'
    set udg_CSS_Abilities[177] = 'ZxDf'
    set udg_CSS_Abilities[178] = 'ZxDg'
    set udg_CSS_Abilities[179] = 'ZxDh'
    set udg_CSS_Abilities[180] = 'ZxC0'
    set udg_CSS_Abilities[181] = 'ZxC1'
    set udg_CSS_Abilities[182] = 'ZxC2'
    set udg_CSS_Abilities[183] = 'ZxC3'
    set udg_CSS_Abilities[184] = 'ZxC4'
    set udg_CSS_Abilities[185] = 'ZxC5'
    set udg_CSS_Abilities[186] = 'ZxC6'
    set udg_CSS_Abilities[187] = 'ZxC7'
    set udg_CSS_Abilities[188] = 'ZxC8'
    set udg_CSS_Abilities[189] = 'ZxC9'
    set udg_CSS_Abilities[190] = 'ZxCa'
    set udg_CSS_Abilities[191] = 'ZxCb'
    set udg_CSS_Abilities[192] = 'ZxCc'
    set udg_CSS_Abilities[193] = 'ZxCd'
    set udg_CSS_Abilities[194] = 'ZxCe'
    set udg_CSS_Abilities[195] = 'ZxCf'
    set udg_CSS_Abilities[196] = 'ZxCg'
    set udg_CSS_Abilities[197] = 'ZxCh'

    loop
        exitwhen i > 30
        set udg_CSS_Power[i] = a
        set a = a*2
        set i = i + 1
    endloop

    set udg_CSS_Hashtable = InitHashtable()

    if udg_CSS_PreloadBoolean then
        call CSS_Preload()
    endif
endfunction
Unit Indexer gives you an array-safe (1-8190) custom value for units, eliminating the need for hashtables to store unit-specific data.
Just use "Set MyArrayData[(Custom value of Unit)] = (Some data)".
--------
If you want to get the unit assigned to an index (reverse lookup) use "UDexUnits[(Index)]".
--------
If you want to detect when an index is created or when it is released, use "UnitIndexEvent Equal to 1.00" (created) or "UnitIndexEvent Equal to 2.00" (released). The index being created/released is called "UDex".
--------
You can enable/disable Unit Indexer to protect some of your undesirable units from being indexed like this:

Trigger - Turn off Unit Indexer <gen>
Unit - Create 1 Dummy for (Triggering player) at TempPoint facing 0.00 degrees
Trigger - Turn on Unit Indexer <gen>
--------
If you want to use a Map Initialization trigger that uses custom value of units, to make sure that UnitIndexer initializes first, use the event "UnitIndexEvent Equal to 3.00". Otherwise the custom value of units may be zero.
--------
Advanced:
--------
If you want to lock the index of a unit, use "Set UnitIndexLock[(Index)] = (UnitIndexLock[(Index)] + 1)". This will prevent the index from being recycled. If you want to unlock it and allow it to be recycled, run the Unit Indexer <gen> trigger.

Note: Make sure if you add a lock that you will eventually remove the lock, otherwise the index will never be recycled.
Unit Indexer
  Events
    Map initialization
  Conditions
  Actions
    Custom script: call ExecuteFunc("InitializeUnitIndexer")
    Custom script: endfunction
    Custom script:
    Custom script: function ClearUnitIndex takes nothing returns nothing
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Custom value of UDexUnits[UDex]) Equal to 0
      Then - Actions
        Set UnitIndexLock[UDex] = (UnitIndexLock[UDex] - 1)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            UnitIndexLock[UDex] Equal to 0
          Then - Actions
            Set UDexNext[UDexPrev[UDex]] = UDexNext[UDex]
            Set UDexPrev[UDexNext[UDex]] = UDexPrev[UDex]
            Set UDexPrev[UDex] = 0
            Set UnitIndexEvent = 0.00
            Set UnitIndexEvent = 2.00
            Set UnitIndexEvent = 0.00
            Set UDexUnits[UDex] = No unit
            Set UDexNext[UDex] = UDexRecycle
            Set UDexRecycle = UDex
          Else - Actions
      Else - Actions
    Custom script: endfunction
    Custom script:
    Custom script: function IndexUnit takes nothing returns boolean
    Custom script: local integer pdex = udg_UDex
    Custom script: local integer ndex
    -------- - --------
    -------- You can customize the following block - if conditions are false the (Matching unit) won't be indexed. --------
    -------- - --------
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        UnitIndexerEnabled Equal to True
        (Custom value of (Matching unit)) Equal to 0
      Then - Actions
        Set UDexWasted = (UDexWasted + 1)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            UDexWasted Equal to 15
          Then - Actions
            Set UDexWasted = 0
            Set UDex = UDexNext[0]
            Custom script: loop
            Custom script: exitwhen udg_UDex == 0
            Custom script: set ndex = udg_UDexNext[udg_UDex]
            Custom script: call ClearUnitIndex()
            Custom script: set udg_UDex = ndex
            Custom script: endloop
          Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            UDexRecycle Equal to 0
          Then - Actions
            Set UDex = (UDexGen + 1)
            Set UDexGen = UDex
          Else - Actions
            Set UDex = UDexRecycle
            Set UDexRecycle = UDexNext[UDex]
        Set UDexUnits[UDex] = (Matching unit)
        Unit - Set the custom value of UDexUnits[UDex] to UDex
        Set UDexPrev[UDexNext[0]] = UDex
        Set UDexNext[UDex] = UDexNext[0]
        Set UDexNext[0] = UDex
        Set UnitIndexLock[UDex] = 1
        Set UnitIndexEvent = 0.00
        Set UnitIndexEvent = 1.00
        Set UnitIndexEvent = 0.00
        Custom script: set udg_UDex = pdex
      Else - Actions
    Custom script: return false
    Custom script: endfunction
    Custom script:
    Custom script: function InitializeUnitIndexer takes nothing returns nothing
    Custom script: local integer i = 16
    Custom script: local boolexpr b = Filter(function IndexUnit)
    Custom script: local region re = CreateRegion()
    Custom script: local trigger t = GetTriggeringTrigger()
    Custom script: local rect r = GetWorldBounds()
    Custom script: call RegionAddRect(re, r)
    Custom script: call TriggerRegisterEnterRegion(t, re, b)
    Custom script: call TriggerClearActions(t)
    Custom script: call TriggerAddAction(t, function ClearUnitIndex)
    Set UnitIndexerEnabled = True
    Custom script: loop
    Custom script: set i = i - 1
    Custom script: call GroupEnumUnitsOfPlayer(bj_lastCreatedGroup, Player(i), b)
    Custom script: exitwhen i == 0
    Custom script: endloop
    Custom script: call RemoveRect(r)
    Custom script: set re = null
    Custom script: set r = null
    Custom script: set t = null
    Custom script: set b = null
    Set UnitIndexEvent = 3.00
    Set UnitIndexEvent = 0.00
Damage Engine lets you detect, amplify, block or nullify damage, and lets you cause special or undetectable damage. Just reference DamageEventAmount/Source/Target, to get the necessary damage event data.
--------
Detect damage: use the event "DamageEvent Equal to 1.00"
Detect zero-damage: use the event "DamageEvent Equal to 2.00"
To change damage before it's dealt: use the event "DamageModifierEvent Equal to 1.00"
--------
Modify DamageEventAmount/ExplodesUnit/Override from a "DamageModifierEvent Equal to 1.00" trigger. To prevent your script's damage stacking with others, include the condition "DamageEventOverride Equal to false".

Likewise, set "DamageEventOverride" to true if you don't want other scripts to stack with it.

If you need to reference the original in-game damage, use the variable "DamageEventPrevAmt".
--------
If you trigger all non-attack damage in the game, you can tell the difference between in-game damage and triggered damage, and you can customize the type of triggered damage as well. You set the variable "DamageEventType" accordingly, <before> triggering the damage.

DamageEventType will be 0 if the damage was dealt in-game or if you didn't set it right before causing the damage. You can create your own special damage types and add them to the list, and/or you can reference the existing ones (DamageTypeSpell/DOT/Ranged).
Damage Engine
  Events
    Game - UnitIndexEvent becomes Equal to 1.00
    Game - UnitIndexEvent becomes Equal to 2.00
  Conditions
  Actions
    -------- Copy the Cheat Death Ability from Object Editor into your map and set the following variable respectively: --------
    Set DamageBlockingAbility = Cheat Death Ability (+500,000)
    -------- - --------
    Set DamageTypeSpell = 1
    Set DamageTypeDOT = 2
    Set DamageTypeRanged = 3
    -------- - --------
    Custom script: call ExecuteFunc("InitDamageEvent")
    Custom script: endfunction
    Custom script:
    Custom script: function DmgEvFilter takes nothing returns boolean
    -------- - --------
    -------- The next conditions let you filter out unwanted units. By default, units with Locust will not pass the check. --------
    -------- - --------
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
      Then - Actions
        Custom script: return true
      Else - Actions
    Custom script: return false
    Custom script: endfunction
    Custom script:
    Custom script: function DmgEvRemoveAbilities takes nothing returns nothing
    Custom script: local real r
    Custom script: loop
    Set DmgEvN = (DmgEvN - 1)
    Custom script: set r = GetWidgetLife(udg_DmgEvStack[udg_DmgEvN])
    Unit - Remove DamageBlockingAbility from DmgEvStack[DmgEvN]
    Custom script: call SetWidgetLife(udg_DmgEvStack[udg_DmgEvN], r)
    Set DmgEvStack[DmgEvN] = No unit
    Custom script: exitwhen udg_DmgEvN == 0
    Custom script: endloop
    Custom script: endfunction
    Custom script:
    Custom script: function DmgEvSetVars takes nothing returns nothing
    Set DamageEventAmount = (Damage taken)
    Set DamageEventSource = (Damage source)
    Set DamageEventTarget = (Triggering unit)
    Custom script: endfunction
    Custom script:
    Custom script: function FireDmgEv takes nothing returns nothing
    Custom script: local boolean b = GetUnitAbilityLevel(udg_DamageEventTarget, udg_DamageBlockingAbility) > 0
    Custom script: local real life = 0
    Custom script: local real pain = 0
    Custom script: if b then
    Custom script: set life = GetWidgetLife(udg_DamageEventTarget)
    Unit - Remove DamageBlockingAbility from DamageEventTarget
    Custom script: call SetWidgetLife(udg_DamageEventTarget, life)
    Custom script: set pain = GetWidgetLife(udg_DamageEventTarget)
    Custom script: endif
    Set DamageEventPrevAmt = DamageEventAmount
    Set DamageEventExplodesUnit = False
    Set DamageEventOverride = False
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        DamageEventAmount Equal to 0.00
      Then - Actions
        Set DamageEvent = 2.00
      Else - Actions
        Set DamageModifierEvent = 1.00
        Set DamageEvent = 1.00
    Custom script: if b then
    Unit - Add DamageBlockingAbility to DamageEventTarget
    Custom script: call SetWidgetLife(udg_DamageEventTarget, life + GetWidgetLife(udg_DamageEventTarget) - pain)
    Custom script: endif
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        DamageEventAmount Not equal to DamageEventPrevAmt
      Then - Actions
        Set DmgEvLife = ((Life of DamageEventTarget) + (DamageEventPrevAmt - DamageEventAmount))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            DamageEventAmount Greater than DamageEventPrevAmt
          Then - Actions
            Unit - Set life of DamageEventTarget to (Max(0.41, DmgEvLife))
            Custom script: if udg_DmgEvLife <= .405 then
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                DamageEventExplodesUnit Equal to True
              Then - Actions
                Unit - Make DamageEventTarget Explode on death
              Else - Actions
            Trigger - Turn off DamageEventTrigger
            Custom script: call UnitDamageTarget(udg_DamageEventSource, udg_DamageEventTarget, 999, false, false, null, null, null)
            Trigger - Turn on DamageEventTrigger
            Custom script: endif
          Else - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                (Max life of DamageEventTarget) Less than DmgEvLife
              Then - Actions
                Unit - Add DamageBlockingAbility to DamageEventTarget
                Set DmgEvStack[DmgEvN] = DamageEventTarget
                Set DmgEvN = (DmgEvN + 1)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  If - Conditions
                    DmgEvN Equal to 1
                  Then - Actions
                    Custom script: call TimerStart(udg_DmgEvTimer, 0, false, function DmgEvRemoveAbilities)
                  Else - Actions
              Else - Actions
            Unit - Set life of DamageEventTarget to DmgEvLife
      Else - Actions
    Custom script: endfunction
    Custom script:
    Custom script: function FireRecursiveDmgEv takes nothing returns nothing
    Custom script: local real d = udg_DamageEventAmount
    Custom script: local unit s = udg_DamageEventSource
    Custom script: local unit t = udg_DamageEventTarget
    Custom script: local integer ptype = udg_DmgTypPrev
    Custom script: local boolean explode = udg_DamageEventExplodesUnit
    Custom script: local boolean override = udg_DamageEventOverride
    Custom script: local real prev = udg_DamageEventPrevAmt
    Custom script: call DmgEvSetVars()
    Custom script: if udg_DamageEventTarget != t or udg_DamageEventSource != s or udg_DamageEventAmount != d or udg_DamageEventType != ptype then
    Set DamageEvent = 0.00
    Set DamageModifierEvent = 0.00
    Custom script: call FireDmgEv()
    -------- - --------
    -------- Delete the next three lines to disable the in-game recursion crash warnings --------
    -------- - --------
    Custom script: else
    Cinematic - Clear the screen of text messages for (All players)
    Game - Display to (All players) for 999.00 seconds the text: WARNING: Recursion error when dealing damage! Make sure when you deal damage from within a DamageEvent trigger, do it like this: Trigger - Turn off DamageEventTrigger Unit - Cause... Trigger - Turn on DamageEventTrigger
    -------- - --------
    Custom script: endif
    Custom script: set udg_DamageEventOverride = override
    Custom script: set udg_DamageEventExplodesUnit = explode
    Custom script: set udg_DamageEventPrevAmt = prev
    Custom script: set udg_DmgTypPrev = ptype
    Custom script: set udg_DamageEventAmount = d
    Custom script: set udg_DamageEventSource = s
    Custom script: set udg_DamageEventTarget = t
    Custom script: set s = null
    Custom script: set t = null
    Custom script: endfunction
    Custom script:
    Custom script: function OnDmgEv takes nothing returns boolean
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        DamageEvent Equal to 0.00
      Then - Actions
        Set DmgTypPrev = DamageEventType
        Custom script: call DmgEvSetVars()
        Custom script: call FireDmgEv()
        Set DamageModifierEvent = 0.00
        Set DamageEvent = 0.00
        Set DamageEventType = 0
      Else - Actions
        Custom script: call FireRecursiveDmgEv()
    Custom script: return false
    Custom script: endfunction
    Custom script:
    Custom script: function CreateDmgEv takes nothing returns nothing
    Custom script: set udg_DamageEventTrigger = CreateTrigger()
    Custom script: call TriggerAddCondition(udg_DamageEventTrigger, Filter(function OnDmgEv))
    Custom script: endfunction
    Custom script:
    Custom script: function SetupDmgEv takes nothing returns boolean
    Custom script: local integer pdex = udg_UDex
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        UnitIndexEvent Equal to 1.00
      Then - Actions
        Set TempUnit = UDexUnits[UDex]
        Custom script: if GetUnitAbilityLevel(udg_TempUnit, 'Aloc') == 0 and DmgEvFilter() then
        Set UnitDamageRegistered[UDex] = True
        Trigger - Add to DamageEventTrigger the event (TempUnit Takes damage)
        Custom script: endif
      Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            UnitDamageRegistered[UDex] Equal to True
          Then - Actions
            Set UnitDamageRegistered[UDex] = False
            Set DamageEventsWasted = (DamageEventsWasted + 1)
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                DamageEventsWasted Equal to 15
              Then - Actions
                Set DamageEventsWasted = 0
                Custom script: call DestroyTrigger(udg_DamageEventTrigger)
                Custom script: call CreateDmgEv()
                Set UDex = UDexNext[0]
                Custom script: loop
                Custom script: exitwhen udg_UDex == 0
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  If - Conditions
                    UnitDamageRegistered[UDex] Equal to True
                  Then - Actions
                    Trigger - Add to DamageEventTrigger the event (UDexUnits[UDex] Takes damage)
                  Else - Actions
                Set UDex = UDexNext[UDex]
                Custom script: endloop
                Custom script: set udg_UDex = pdex
              Else - Actions
          Else - Actions
    Custom script: return false
    Custom script: endfunction
    Custom script:
    Custom script: function InitDamageEvent takes nothing returns nothing
    Custom script: call CreateDmgEv()
    Custom script: call TriggerAddCondition(GetTriggeringTrigger(), Filter(function SetupDmgEv))
    Set UnitIndexerEnabled = False
    Custom script: set udg_TempUnit = CreateUnit(Player(15), 'uloc', 0, 0, 0)
    Set UnitIndexerEnabled = True
    Unit - Add DamageBlockingAbility to TempUnit
    Unit - Remove TempUnit from the game
    Trigger - Run (This trigger) (checking conditions)
library Table
//***************************************************************
//* Table object 3.0
//* ------------
//*
//*   set t=Table.create() - instanceates a new table object
//*   call t.destroy()     - destroys it
//*   t[1234567]           - Get value for key 1234567
//*                          (zero if not assigned previously)
//*   set t[12341]=32      - Assigning it.
//*   call t.flush(12341)  - Flushes the stored value, so it
//*                          doesn't use any more memory
//*   t.exists(32)         - Was key 32 assigned? Notice
//*                          that flush() unassigns values.
//*   call t.reset()       - Flushes the whole contents of the
//*                          Table.
//*
//*   call t.destroy()     - Does reset() and also recycles the id.
//*
//*   If you use HandleTable instead of Table, it is the same
//* but it uses handles as keys, the same with StringTable.
//*
//*  You can use Table on structs' onInit  if the struct is
//* placed in a library that requires Table or outside a library.
//*
//*  You can also do 2D array syntax if you want to touch
//* mission keys directly, however, since this is shared space
//* you may want to prefix your mission keys accordingly:
//*
//*  set Table["thisstring"][ 7 ] = 2
//*  set Table["thisstring"][ 5 ] = Table["thisstring"][7]
//*
//***************************************************************

//=============================================================
    globals
        private constant integer MAX_INSTANCES=8100 //400000
        //Feel free to change max instances if necessary, it will only affect allocation
        //speed which shouldn't matter that much.

    //=========================================================
        private hashtable ht
    endglobals

    private struct GTable[MAX_INSTANCES]

        method reset takes nothing returns nothing
            call FlushChildHashtable(ht, integer(this) )
        endmethod

        private method onDestroy takes nothing returns nothing
            call this.reset()
        endmethod

        //=============================================================
        // initialize it all.
        //
        private static method onInit takes nothing returns nothing
            set ht = InitHashtable()
        endmethod

    endstruct

    //Hey: Don't instanciate other people's textmacros that you are not supposed to, thanks.
    //! textmacro Table__make takes name, type, key
    struct $name$ extends GTable

        method operator [] takes $type$ key returns integer
            return LoadInteger(ht, integer(this), $key$)
        endmethod

        method operator []= takes $type$ key, integer value returns nothing
            call SaveInteger(ht,  integer(this)  ,$key$, value)
        endmethod

        method flush takes $type$ key returns nothing
            call RemoveSavedInteger(ht, integer(this), $key$)
        endmethod

        method exists takes $type$ key returns boolean
            return HaveSavedInteger( ht,  integer(this)  ,$key$)
        endmethod

        static method flush2D takes string firstkey returns nothing
            call $name$(- StringHash(firstkey)).reset()
        endmethod

        static method operator [] takes string firstkey returns $name$
            return $name$(- StringHash(firstkey) )
        endmethod

    endstruct
    //! endtextmacro

    //! runtextmacro Table__make("Table","integer","key" )
    //! runtextmacro Table__make("StringTable","string", "StringHash(key)" )
    //! runtextmacro Table__make("HandleTable","handle","GetHandleId(key)" )

endlibrary
Pcht_
Parachute Init
  Events
    Map initialization
  Conditions
  Actions
    -------- --------------------------- --------
    -------- After importing this system, you might need to sets these variables again --------
    Set Pcht_modelPath = war3mapImported\Parachute.mdx
    Set Pcht_attachment = chest
    Set Pcht_loopTrigger = Parachute_Loop <gen>
    -------- --------------------------- --------
    -------- Determines the loop timer speed --------
    Set Pcht_loopSpeed = 0.03
    -------- Note: I recommend you not to change this, but for some reason i leave this configurable for those who might need this somehow --------
    -------- --------------------------- --------
    -------- Do not change anything below this line if don't know what you're doing --------
    -------- =========================================================================== --------
    Trigger - Add to Pcht_loopTrigger the event (Every Pcht_loopSpeed seconds of game time)
Pcht_
Parachute Drop
  Events
  Conditions
  Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        Pcht_maxIndex Equal to 0
      Then - Actions
        Trigger - Turn on Pcht_loopTrigger
      Else - Actions
    Set Pcht_maxIndex = (Pcht_maxIndex + 1)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        Pcht_dropCreateNew Equal to True
      Then - Actions
        Unit - Create 1 Pcht_dropUnitType for Pcht_dropPlayer at Pcht_dropPoint facing Pcht_dropAngle degrees
        Set Pcht_unit[Pcht_maxIndex] = (Last created unit)
        Unit - Pause Pcht_unit[Pcht_maxIndex]
        Unit - Add classification of A flying unit to Pcht_unit[Pcht_index]
        Unit - Disable supply usage for Pcht_unit[Pcht_index]
        Set Pcht_lastCreatedUnit = Pcht_unit[Pcht_maxIndex]
      Else - Actions
        Set Pcht_unit[Pcht_maxIndex] = Pcht_dropUnit
    Custom script: if UnitAddAbility(udg_Pcht_unit[udg_Pcht_maxIndex],'Amrf') and UnitRemoveAbility(udg_Pcht_unit[udg_Pcht_maxIndex],'Amrf') then
    Custom script: endif
    Animation - Change Pcht_unit[Pcht_maxIndex] flying height to Pcht_dropHeight at 0.00
    Special Effect - Create a special effect attached to the Pcht_attachment of Pcht_unit[Pcht_maxIndex] using Pcht_modelPath
    Set Pcht_model[Pcht_maxIndex] = (Last created special effect)
    Set Pcht_height[Pcht_maxIndex] = Pcht_dropHeight
    Set Pcht_speed[Pcht_maxIndex] = Pcht_dropSpeed
    Set Pcht_endTrigger[Pcht_maxIndex] = Pcht_dropEndTrigger
    Set Pcht_dropAngle = 0.00
    Set Pcht_dropCreateNew = False
    Custom script: set udg_Pcht_dropEndTrigger=null
    Set Pcht_dropHeight = 0.00
    Custom script: set udg_Pcht_dropPlayer=null
    Set Pcht_dropSpeed = 0.00
    Set Pcht_dropUnit = No unit
    Set Pcht_dropUnitType = No unit-type
Pcht_
Parachute Loop
  Events
  Conditions
  Actions
    For each (Integer Pcht_index) from 1 to Pcht_maxIndex, do (Actions)
      Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            Pcht_height[Pcht_index] Greater than 0.00
          Then - Actions
            Set Pcht_height[Pcht_index] = (Pcht_height[Pcht_index] - Pcht_speed[Pcht_index])
            Animation - Change Pcht_unit[Pcht_index] flying height to Pcht_height[Pcht_index] at 0.00
          Else - Actions
            Unit - Unpause Pcht_unit[Pcht_index]
            Unit - Remove classification of A flying unit from Pcht_unit[Pcht_index]
            Animation - Change Pcht_unit[Pcht_index] flying height to 0.00 at 0.00
            Special Effect - Destroy Pcht_model[Pcht_index]
            Trigger - Run Pcht_dropEndTrigger (ignoring conditions)
            Set Pcht_endTrigger[Pcht_index] = Pcht_endTrigger[Pcht_maxIndex]
            Set Pcht_height[Pcht_index] = Pcht_height[Pcht_maxIndex]
            Set Pcht_model[Pcht_index] = Pcht_model[Pcht_maxIndex]
            Set Pcht_speed[Pcht_index] = Pcht_speed[Pcht_maxIndex]
            Set Pcht_unit[Pcht_index] = Pcht_unit[Pcht_maxIndex]
            Set Pcht_maxIndex = (Pcht_maxIndex - 1)
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                Pcht_maxIndex Equal to 0
              Then - Actions
                Trigger - Turn off (This trigger)
              Else - Actions
                Set Pcht_index = (Pcht_index - 1)
Default melee game initialization for all players
Init
  Events
    Map initialization
  Conditions
  Actions
    Set Falric = Undead Captain 0231 <gen>
    -------- *********************** --------
    Game - Set campaign to Undead Campaign
    -------- *********************** --------
    Game - Set the time of day to 6.01
    -------- *********************** --------
    Environment - Set sky to Dalaran Sky
    Trigger - Run Load_Heroes <gen> (checking conditions)
    Trigger - Run Setup_PlayerResources <gen> (checking conditions)
    Trigger - Run Setup_Allies <gen> (checking conditions)
    Trigger - Run Setup_Fire <gen> (checking conditions)
    Trigger - Run Setup_CinematicUnits <gen> (checking conditions)
    Trigger - Run Setup_Doors <gen> (checking conditions)
    Trigger - Run Setup_SummoningCircle <gen> (checking conditions)
    Trigger - Run Setup_Vision <gen> (checking conditions)
    Trigger - Run Setup_Quests <gen> (checking conditions)
    Trigger - Run SetupCinematicPlayer <gen> (checking conditions)
    Trigger - Run Credits_and_CL <gen> (ignoring conditions)
    -------- Difficulty --------
    Hero - Make Player 4 (Purple) Heroes gain 25.00% experience from future kills
    Hero - Make Player 5 (Yellow) Heroes gain 25.00% experience from future kills
    Hero - Make Player 6 (Orange) Heroes gain 25.00% experience from future kills
    Hero - Make Player 10 (Light Blue) Heroes gain 0.00% experience from future kills
    -------- *********************** --------
    Unit - Hide Demon Gate 0327 <gen>
Run from 'Opening04' and 'OpeningCancelled'
Start Campaign AI
  Events
  Conditions
  Actions
    Trigger - Turn off (This trigger)
    AI - Start campaign AI script for Player 1 (Red): war3mapImported\u08_red.ai (aiscript)
    AI - Start campaign AI script for Player 2 (Blue): war3mapImported\u08_blue.ai (aiscript)
    AI - Start campaign AI script for Player 3 (Teal): war3mapImported\u08_teal.ai (aiscript)
    -------- Send Signal --------
    AI - Send Player 1 (Red) the AI Command (0, 0)
    AI - Send Player 2 (Blue) the AI Command (0, 0)
    AI - Send Player 3 (Teal) the AI Command (0, 0)
Run after the opening cinematic
Setup ComputerPlayers
  Events
  Conditions
  Actions
    -------- Blue --------
    Player - Set Player 2 (Blue) Current gold to 2000
    Player - Set Player 2 (Blue) Current lumber to 1500
    Player - Change color of Player 2 (Blue) to Gray, Changing color of existing units
    -------- Red --------
    Player - Set Player 1 (Red) Current gold to 2000
    Player - Set Player 1 (Red) Current lumber to 1500
    Player - Change color of Player 1 (Red) to Blue, Changing color of existing units
    -------- Teal --------
    Player - Set Player 3 (Teal) Current gold to 2000
    Player - Set Player 3 (Teal) Current lumber to 1500
    Player - Change color of Player 3 (Teal) to Light Blue, Changing color of existing units
    -------- Computers against Kel'Thuzad --------
    Player - Make Player 1 (Red) treat Player 7 (Green) as an Enemy
    Player - Make Player 2 (Blue) treat Player 7 (Green) as an Enemy
    Player - Make Player 3 (Teal) treat Player 7 (Green) as an Enemy
    Player - Make Player 8 (Pink) treat Player 7 (Green) as an Enemy
    Player - Make Player 10 (Light Blue) treat Player 7 (Green) as an Enemy
    -------- *********************** --------
SetupCinematicPlayer
  Events
  Conditions
  Actions
    -------- Pre-placed non-AI player --------
    Player - Change color of Player 8 (Pink) to Gray, Changing color of existing units
    -------- Cinematic Shared Vision --------
    Player - Make Player 8 (Pink) treat Player 4 (Purple) as an Ally with shared vision
    Player - Make Player 8 (Pink) treat Player 5 (Yellow) as an Ally with shared vision
    Player - Make Player 8 (Pink) treat Player 6 (Orange) as an Ally with shared vision
    -------- Tichondrius Grey = Red --------
    Player - Change color of Player 9 (Gray) to Red, Changing color of existing units
    Player - Make Player 9 (Gray) treat Player 6 (Orange) as an Ally with shared vision
    Player - Make Player 6 (Orange) treat Player 9 (Gray) as an Ally with shared vision
    Player - Make Player 9 (Gray) treat Player 5 (Yellow) as an Ally with shared vision
    Player - Make Player 5 (Yellow) treat Player 9 (Gray) as an Ally with shared vision
    Player - Hide Player 7 (Green) in the post-game score screen
    Player - Hide Player 8 (Pink) in the post-game score screen
Setup PlayerResources
  Events
  Conditions
  Actions
    Player - Set Player 4 (Purple) Current lumber to 550
    Player - Set Player 5 (Yellow) Current lumber to 550
    Player - Set Player 6 (Orange) Current lumber to 550
    Player - Set Player 4 (Purple) Current gold to 1800
    Player - Set Player 5 (Yellow) Current gold to 1800
    Player - Set Player 6 (Orange) Current gold to 1800
Setup Allies
  Events
  Conditions
  Actions
    Player - Make Player 4 (Purple) treat Player 7 (Green) as an Ally with shared vision
    Player - Make Player 5 (Yellow) treat Player 7 (Green) as an Ally with shared vision
    Player - Make Player 6 (Orange) treat Player 7 (Green) as an Ally with shared vision
    Player - Make Player 7 (Green) treat Player 4 (Purple) as an Ally with shared vision
    Player - Make Player 7 (Green) treat Player 5 (Yellow) as an Ally with shared vision
    Player - Make Player 7 (Green) treat Player 6 (Orange) as an Ally with shared vision
Setup CinematicUnits
  Events
  Conditions
  Actions
    Unit Group - Pick every unit in (Units in ArchmageArea01 <gen>) and do (Add (Picked unit) to CinematicUnitGroup)
    Unit Group - Pick every unit in (Units in ArchmageArea02 <gen>) and do (Add (Picked unit) to CinematicUnitGroup)
    Unit Group - Pick every unit in (Units in GryphonArea <gen>) and do (Add (Picked unit) to CinematicUnitGroup)
Setup Fire
  Events
  Conditions
  Actions
    Wait 0.10 seconds
    Animation - Play the death animation for all doodads of type YOtf (doodadcode) within (Playable map area)
    Animation - Play the death animation for all doodads of type YOf2 (doodadcode) within (Playable map area)
Setup Doors
  Events
  Conditions
  Actions
    Destructible - Open Gate 0073 <gen>
    Destructible - Open Gate 0263 <gen>
    Destructible - Open Iron Gate 0029 <gen>
Setup SummoningCircle
  Events
  Conditions
  Actions
    Special Effect - Create a special effect at (Center of KelThuzadPost <gen>) using Abilities\Spells\Undead\VampiricAura\VampiricAura.mdl
    Set VampiricAura = (Last created special effect)
Run from 'Opening02' and OpeningCancelled'
Setup Timers
  Events
  Conditions
  Actions
    -------- HellHounds 1/12 game min --------
    Countdown Timer - Start TimerHellHound01 as a One-shot timer that will expire in (SummoningDuration / 12.00) seconds
    Set TimerHellHound01 = (Last started timer)
    -------- HellHounds 1/6 game min --------
    Countdown Timer - Start TimerHellHound02 as a One-shot timer that will expire in (SummoningDuration / 6.00) seconds
    Set TimerHellHound02 = (Last started timer)
    -------- HellHounds 1/4 game min --------
    Countdown Timer - Start TimerHellHound03 as a One-shot timer that will expire in (SummoningDuration / 4.00) seconds
    Set TimerHellHound03 = (Last started timer)
    -------- Infernals 1/2 game min --------
    Countdown Timer - Start TimerInfernals as a One-shot timer that will expire in (SummoningDuration / 2.00) seconds
    Set TimerInfernals = (Last started timer)
    -------- Rush Timer NORMAL --------
    Countdown Timer - Start TimerRushNormal as a One-shot timer that will expire in (SummoningDuration - 200.00) seconds
    Set TimerRushNormal = (Last started timer)
    -------- Rush Timer HARD --------
    Countdown Timer - Start TimerRushHard as a One-shot timer that will expire in (SummoningDuration - 400.00) seconds
    Set TimerRushHard = (Last started timer)
    -------- Side quest --------
    Countdown Timer - Start TimerSideQuest as a One-shot timer that will expire in 120.00 seconds
    Set TimerSideQuest = (Last started timer)
    -------- Summoning timer --------
    Countdown Timer - Start TimerSummoning as a One-shot timer that will expire in SummoningDuration seconds
    Set TimerSummoning = (Last started timer)
    -------- Summoning timer --------
    Countdown Timer - Create a timer window for TimerSummoning with title Summoning
    Set CountdownTimerWindow = (Last created timer window)
Setup Vision
  Events
  Conditions
  Actions
    Visibility - Create an initially Enabled visibility modifier for Player 4 (Purple) emitting Visibility from (Center of TempleVision <gen>) to a radius of 1200.00
    Visibility - Create an initially Enabled visibility modifier for Player 5 (Yellow) emitting Visibility from (Center of TempleVision <gen>) to a radius of 1200.00
    Visibility - Create an initially Enabled visibility modifier for Player 6 (Orange) emitting Visibility from (Center of TempleVision <gen>) to a radius of 1200.00
Setup Quests
  Events
  Conditions
  Actions
    -------- Main Quest --------
    Quest - Create a Required, undiscovered quest titled [Main Quest] Archimonde with the description The hour of Archimonde's arrival has come! You must defend Kel'Thuzad as he chants the volatile, intricate spell of summoning. , using icon path ReplaceableTextures\CommandButtons\BTNHerolich.tga
    Set QuestSummoning = (Last created quest)
    -------- Main Quest Requirement --------
    Quest - Create a quest requirement for QuestSummoning with the description Kel'Thuzad must survive until timer runs out.
    Set QuestSummoningReq = QuestSummoningReq
    -------- Side Quest --------
    Quest - Create a Required, undiscovered quest titled [Opt] Goblin Land Mines with the description Your scouts have discovered a cache of Goblin Land Mines. The crafty devices may be useful when strategically placed for base defense., using icon path ReplaceableTextures\CommandButtons\BTNGoblinLandMine.tga
    Set QuestGoblinMine = (Last created quest)
    -------- Side Quest Requirement --------
    Quest - Create a quest requirement for QuestGoblinMine with the description Acquire the Goblin Land Mines
    Set QuestGoblinMineReq = (Last created quest requirement)
    -------- Side Quest --------
    Quest - Create a Required, undiscovered quest titled [Opt] Dalaran Portal with the description Dalaran Humans have create a portal to summon reinforcement, find their petty hidden portal that seems to send them to join the battle., using icon path ReplaceableTextures\CommandButtons\BTNPortal.blp
    Set QuestDalaranReinforcement = (Last created quest)
    -------- Side Quest Requirement --------
    Quest - Create a quest requirement for QuestDalaranReinforcement with the description Destroy Dalaran Portal hidden in a secret camp.
    Set QuestDalaranReinforcementReq = (Last created quest requirement)
Dialog
  Events
    Time - Elapsed game time is 0.00 seconds
  Conditions
  Actions
    Cinematic - Clear the screen of text messages for (All players)
    Game - Pause the game
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Player 4 (Purple) controller) Equal to User
      Then - Actions
        Game - Display to (All players) the text: Player 4 has to select a difficulty to begin the game.
        Dialog - Clear Dialog
        Dialog - Change the title of Dialog to Please choose difficulty.
        Dialog - Create a dialog button for Dialog labelled Easy Difficulty
        Set Dialog_Button[1] = (Last created dialog Button)
        Dialog - Create a dialog button for Dialog labelled Normal Difficulty
        Set Dialog_Button[2] = (Last created dialog Button)
        Dialog - Create a dialog button for Dialog labelled Hard Difficulty
        Set Dialog_Button[3] = (Last created dialog Button)
        Dialog - Create a dialog button for Dialog labelled Easy [Endless] Difficulty
        Set Dialog_Button[4] = (Last created dialog Button)
        Dialog - Create a dialog button for Dialog labelled Medium [Endless] Difficulty
        Set Dialog_Button[5] = (Last created dialog Button)
        Dialog - Create a dialog button for Dialog labelled Hard [Endless] Difficulty
        Set Dialog_Button[6] = (Last created dialog Button)
        Set MainLeader = Player 4 (Purple)
        Dialog - Show Dialog for MainLeader
      Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Player 5 (Yellow) controller) Equal to User
          Then - Actions
            Game - Display to (All players) the text: Player 5 has to select a difficulty to begin the game.
            Dialog - Clear Dialog
            Dialog - Change the title of Dialog to Please choose difficulty.
            Dialog - Create a dialog button for Dialog labelled Easy Difficulty
            Set Dialog_Button[1] = (Last created dialog Button)
            Dialog - Create a dialog button for Dialog labelled Normal Difficulty
            Set Dialog_Button[2] = (Last created dialog Button)
            Dialog - Create a dialog button for Dialog labelled Hard Difficulty
            Set Dialog_Button[3] = (Last created dialog Button)
            Dialog - Create a dialog button for Dialog labelled Easy [Endless] Difficulty
            Set Dialog_Button[4] = (Last created dialog Button)
            Dialog - Create a dialog button for Dialog labelled Medium [Endless] Difficulty
            Set Dialog_Button[5] = (Last created dialog Button)
            Dialog - Create a dialog button for Dialog labelled Hard [Endless] Difficulty
            Set Dialog_Button[6] = (Last created dialog Button)
            Set MainLeader = Player 5 (Yellow)
            Dialog - Show Dialog for MainLeader
          Else - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                (Player 6 (Orange) controller) Equal to User
              Then - Actions
                Game - Display to (All players) the text: Player 6 has to select a difficulty to begin the game.
                Dialog - Clear Dialog
                Dialog - Change the title of Dialog to Please choose difficulty.
                Dialog - Create a dialog button for Dialog labelled Easy Difficulty
                Set Dialog_Button[1] = (Last created dialog Button)
                Dialog - Create a dialog button for Dialog labelled Normal Difficulty
                Set Dialog_Button[2] = (Last created dialog Button)
                Dialog - Create a dialog button for Dialog labelled Hard Difficulty
                Set Dialog_Button[3] = (Last created dialog Button)
                Dialog - Create a dialog button for Dialog labelled Easy [Endless] Difficulty
                Set Dialog_Button[4] = (Last created dialog Button)
                Dialog - Create a dialog button for Dialog labelled Medium [Endless] Difficulty
                Set Dialog_Button[5] = (Last created dialog Button)
                Dialog - Create a dialog button for Dialog labelled Hard [Endless] Difficulty
                Set Dialog_Button[6] = (Last created dialog Button)
                Set MainLeader = Player 6 (Orange)
                Dialog - Show Dialog for MainLeader
              Else - Actions
Button Response
  Events
    Dialog - A dialog button is clicked for Dialog
  Conditions
  Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Clicked dialog button) Equal to Dialog_Button[1]
      Then - Actions
        Trigger - Run Difficulty_Easy <gen> (ignoring conditions)
        Game - Display to (All players) the text: ((Name of MainLeader) + has chosen Easy Difficulty!)
        Trigger - Run Dialog_2 <gen> (ignoring conditions)
      Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Clicked dialog button) Equal to Dialog_Button[2]
          Then - Actions
            Trigger - Run Difficulty_Normal <gen> (ignoring conditions)
            Game - Display to (All players) the text: ((Name of MainLeader) + has chosen Normal Difficulty!)
            Trigger - Run Dialog_2 <gen> (ignoring conditions)
          Else - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                (Clicked dialog button) Equal to Dialog_Button[3]
              Then - Actions
                Trigger - Run Difficulty_Hard <gen> (ignoring conditions)
                Game - Display to (All players) the text: ((Name of MainLeader) + has chosen Hard Difficulty!)
                Trigger - Run Dialog_2 <gen> (ignoring conditions)
              Else - Actions
                Game - Display to (All players) the text: Remember to save the replay of the match and show them at Hive Workshop thread and get a chance to enter HALL OF FAME.
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  If - Conditions
                    (Clicked dialog button) Equal to Dialog_Button[4]
                  Then - Actions
                    Game - Unpause the game
                    Trigger - Run Difficulty_Easy_Endless <gen> (ignoring conditions)
                    Game - Display to (All players) the text: ((Name of MainLeader) + has chosen Easy Endless Difficulty!)
                    Trigger - Run Opening01 <gen> (ignoring conditions)
                    Trigger - Run AI_Auto_Agree <gen> (ignoring conditions)
                    Trigger - Turn on Skip_Cinematic_Vote <gen>
                  Else - Actions
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      If - Conditions
                        (Clicked dialog button) Equal to Dialog_Button[5]
                      Then - Actions
                        Game - Unpause the game
                        Trigger - Run Difficulty_Normal_Endless <gen> (ignoring conditions)
                        Game - Display to (All players) the text: ((Name of MainLeader) + has chosen Medium Endless Difficulty!)
                        Trigger - Run Opening01 <gen> (ignoring conditions)
                        Trigger - Run AI_Auto_Agree <gen> (ignoring conditions)
                        Trigger - Turn on Skip_Cinematic_Vote <gen>
                      Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          If - Conditions
                            (Clicked dialog button) Equal to Dialog_Button[6]
                          Then - Actions
                            Game - Unpause the game
                            Trigger - Run Difficulty_Hard_Endless <gen> (ignoring conditions)
                            Game - Display to (All players) the text: ((Name of MainLeader) + has chosen Hard Endless Difficulty!)
                            Trigger - Run Opening01 <gen> (ignoring conditions)
                            Trigger - Run AI_Auto_Agree <gen> (ignoring conditions)
                            Trigger - Turn on Skip_Cinematic_Vote <gen>
                          Else - Actions
Dialog 2
  Events
  Conditions
  Actions
    Game - Display to (All players) the text: ((Name of MainLeader) + has to choose a time to defend Kel'thuzad)
    Dialog - Clear ZDialog
    Dialog - Change the title of ZDialog to Choose the duration of defending...
    Dialog - Create a dialog button for ZDialog labelled 15 Minutes
    Set ZDialog_Button[1] = (Last created dialog Button)
    Dialog - Create a dialog button for ZDialog labelled 30 Minutes
    Set ZDialog_Button[2] = (Last created dialog Button)
    Dialog - Create a dialog button for ZDialog labelled 45 Minutes
    Set ZDialog_Button[3] = (Last created dialog Button)
    Dialog - Create a dialog button for ZDialog labelled 60 Minutes
    Set ZDialog_Button[4] = (Last created dialog Button)
    Dialog - Create a dialog button for ZDialog labelled 75 Minutes
    Set ZDialog_Button[5] = (Last created dialog Button)
    Dialog - Create a dialog button for ZDialog labelled 90 Minutes
    Set ZDialog_Button[6] = (Last created dialog Button)
    Dialog - Show ZDialog for MainLeader
Response 2
  Events
    Dialog - A dialog button is clicked for ZDialog
  Conditions
  Actions
    Game - Unpause the game
    For each (Integer A) from 1 to 6, do (Actions)
      Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Clicked dialog button) Equal to ZDialog_Button[(Integer A)]
          Then - Actions
            Set SummoningDuration = (900.00 x (Real((Integer A))))
            Game - Display to (All players) the text: ((Name of MainLeader) + ( has chosen to summon Archimonde in + ((String(SummoningDuration)) + seconds)))
          Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Clicked dialog button) Equal to ZDialog_Button[1]
      Then - Actions
        Player Group - Pick every player in (All players) and do (Actions)
          Loop - Actions
            Player - Set the current research level of Rume (techcode) to 1 for (Picked player)
            Player - Set the current research level of Rura (techcode) to 1 for (Picked player)
            Player - Set the current research level of Ruar (techcode) to 1 for (Picked player)
            Player - Set the current research level of Rucr (techcode) to 1 for (Picked player)
            Player - Set the current research level of R002 (techcode) to 1 for (Picked player)
            Player - Add 1000 to (Picked player) Current gold
            Player - Add 1000 to (Picked player) Current lumber
      Else - Actions
    Trigger - Run Opening01 <gen> (checking conditions)
    Trigger - Run AI_Auto_Agree <gen> (ignoring conditions)
    Trigger - Turn on Skip_Cinematic_Vote <gen>
Difficulty Easy
  Events
  Conditions
  Actions
    Player - Set the max research level of R004 (techcode) to 0 for Player 4 (Purple)
    Player - Set the max research level of R004 (techcode) to 0 for Player 5 (Yellow)
    Player - Set the max research level of R004 (techcode) to 0 for Player 6 (Orange)
    Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) belongs to an enemy of Player 4 (Purple)) Equal to True) and (((Matching unit) is A structure) Equal to True))) and do (Actions)
      Loop - Actions
        Set BuildingFortified = (Picked unit)
        Custom script: call CSS_AddBonus(udg_BuildingFortified, 1000, 8)
        Custom script: call CSS_AddBonus(udg_BuildingFortified, 10, 2)
    -------- Rush Timer --------
    Countdown Timer - Pause TimerRushHard
    Trigger - Turn off TimerRushHard <gen>
    -------- Handicap --------
    Player - Set Player 7 (Green) handicap to 300.00%
    Player - Set Player 1 (Red) handicap to Campaign easy handicap%
    Player - Set Player 2 (Blue) handicap to Campaign easy handicap%
    Player - Set Player 3 (Teal) handicap to Campaign easy handicap%
    Player - Set Player 8 (Pink) handicap to 45.00%
    Player - Set Neutral Hostile handicap to Campaign easy handicap%
    -------- Extra Ability for Easy --------
    Unit - Add Holy Light (Dalaran) to Archmage 0200 <gen>
    Unit - Add Holy Light (Dalaran) to Archmage 0201 <gen>
    Unit - Add Holy Light (Dalaran) to Archmage 0202 <gen>
    -------- Blue --------
    Hero - Set Archmage 0201 <gen> Hero-level to 11, Hide level-up graphics
    Hero - Disable experience gain for Archmage 0201 <gen>
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Mass Teleport
    -------- Red --------
    Hero - Set Archmage 0200 <gen> Hero-level to 6, Hide level-up graphics
    Hero - Disable experience gain for Archmage 0200 <gen>
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Summon Water Elemental
    -------- Teal --------
    Hero - Set Archmage 0202 <gen> Hero-level to 6, Hide level-up graphics
    Hero - Disable experience gain for Archmage 0202 <gen>
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Summon Water Elemental
Difficulty Normal
  Events
  Conditions
  Actions
    Player - Set the max research level of R004 (techcode) to 0 for Player 4 (Purple)
    Player - Set the max research level of R004 (techcode) to 0 for Player 5 (Yellow)
    Player - Set the max research level of R004 (techcode) to 0 for Player 6 (Orange)
    Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) belongs to an enemy of Player 4 (Purple)) Equal to True) and (((Matching unit) is A structure) Equal to True))) and do (Actions)
      Loop - Actions
        Set BuildingFortified = (Picked unit)
        Custom script: call CSS_AddBonus(udg_BuildingFortified, 3000, 8)
        Custom script: call CSS_AddBonus(udg_BuildingFortified, 30, 2)
    Player - Set Player 7 (Green) handicap to 200.00%
    Player - Set Player 8 (Pink) handicap to 60.00%
    -------- Rush Timer --------
    Countdown Timer - Pause TimerRushHard
    Trigger - Turn off TimerRushHard <gen>
    -------- Extra Ability for Normal --------
    Unit - Add Chain Lightning (Neutral Hostile) to Archmage 0200 <gen>
    Unit - Add Command Aura to Archmage 0200 <gen>
    Unit - Add Devotion Aura (Neutral Hostile) to Archmage 0201 <gen>
    Unit - Add Holy Light (Dalaran) to Archmage 0202 <gen>
    Trigger - Turn on Normal_Spellcaster <gen>
    -------- Blue --------
    Hero - Set Archmage 0201 <gen> Hero-level to 11, Hide level-up graphics
    Hero - Disable experience gain for Archmage 0201 <gen>
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Mass Teleport
    -------- Red --------
    Hero - Set Archmage 0200 <gen> Hero-level to 9, Hide level-up graphics
    Hero - Disable experience gain for Archmage 0200 <gen>
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Brilliance Aura
    -------- Teal --------
    Hero - Set Archmage 0202 <gen> Hero-level to 8, Hide level-up graphics
    Hero - Disable experience gain for Archmage 0202 <gen>
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Summon Water Elemental
Normal Spellcaster
  Events
    Unit - A unit Finishes training a unit
  Conditions
    (Race of (Triggering player)) Equal to Human
    Or - Any (Conditions) are true
      Conditions
        (Unit-type of (Trained unit)) Equal to Priest
        (Unit-type of (Trained unit)) Equal to Sorceress
  Actions
    Set AdvSoldiers = (Trained unit)
    Custom script: call CSS_AddBonus(udg_AdvSoldiers, 250, 9)
    Unit - Set mana of AdvSoldiers to 50.00%
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Unit-type of AdvSoldiers) Equal to Priest
      Then - Actions
        Unit - Add Holy Light (Dalaran) to AdvSoldiers
        Unit - Add Frost Bolt to AdvSoldiers
      Else - Actions
        Unit - Add Lightning Shield (Neutral Hostile) to AdvSoldiers
        Unit - Add Firebolt (Neutral Hostile) to AdvSoldiers
Difficulty Hard
  Events
  Conditions
  Actions
    Player - Set the max research level of R004 (techcode) to 0 for Player 4 (Purple)
    Player - Set the max research level of R004 (techcode) to 0 for Player 5 (Yellow)
    Player - Set the max research level of R004 (techcode) to 0 for Player 6 (Orange)
    Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) belongs to an enemy of Player 4 (Purple)) Equal to True) and (((Matching unit) is A structure) Equal to True))) and do (Actions)
      Loop - Actions
        Set BuildingFortified = (Picked unit)
        Custom script: call CSS_AddBonus(udg_BuildingFortified, 7500, 8)
        Custom script: call CSS_AddBonus(udg_BuildingFortified, 50, 2)
        Custom script: call CSS_AddBonus(udg_BuildingFortified, 10, 0)
    Player - Set Player 1 (Red) handicap to 150.00%
    Player - Set Player 2 (Blue) handicap to 150.00%
    Player - Set Player 3 (Teal) handicap to 150.00%
    Player - Set Player 8 (Pink) handicap to 75.00%
    -------- Rush Timer --------
    Countdown Timer - Pause TimerRushNormal
    Trigger - Turn off TimerRushNormal <gen>
    -------- Extra Ability for Hard --------
    Unit - Add Bloodlust (Neutral Hostile 1) to Archmage 0200 <gen>
    Unit - Add Chain Lightning (Neutral Hostile) to Archmage 0200 <gen>
    Unit - Add Command Aura to Archmage 0200 <gen>
    Unit - Add Bloodlust (Neutral Hostile 1) to Archmage 0201 <gen>
    Unit - Add Devotion Aura (Neutral Hostile) to Archmage 0201 <gen>
    Unit - Add Bloodlust (Neutral Hostile 1) to Archmage 0202 <gen>
    Unit - Add Holy Light (Dalaran) to Archmage 0202 <gen>
    Unit - Add Holy Light (Dalaran) to Archmage 0202 <gen>
    Custom script: call CSS_AddBonus(gg_unit_Hamg_0200, 1250, 9)
    Custom script: call CSS_AddBonus(gg_unit_Hamg_0200, 720, 8)
    Custom script: call CSS_AddBonus(gg_unit_Hamg_0201, 1250, 9)
    Custom script: call CSS_AddBonus(gg_unit_Hamg_0201, 600, 8)
    Custom script: call CSS_AddBonus(gg_unit_Hamg_0202, 1250, 9)
    Custom script: call CSS_AddBonus(gg_unit_Hamg_0202, 775, 8)
    Trigger - Turn on Hard_Spellcasters <gen>
    Trigger - Turn on Hard_Soldiers <gen>
    -------- Blue --------
    Hero - Set Archmage 0201 <gen> Hero-level to 12, Hide level-up graphics
    Hero - Disable experience gain for Archmage 0201 <gen>
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Mass Teleport
    -------- Red --------
    Hero - Set Archmage 0200 <gen> Hero-level to 11, Hide level-up graphics
    Hero - Disable experience gain for Archmage 0200 <gen>
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Mass Teleport
    -------- Teal --------
    Hero - Set Archmage 0202 <gen> Hero-level to 10, Hide level-up graphics
    Hero - Disable experience gain for Archmage 0202 <gen>
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Mass Teleport
Hard Spellcasters
  Events
    Unit - A unit Finishes training a unit
  Conditions
    (Race of (Triggering player)) Equal to Human
    Or - Any (Conditions) are true
      Conditions
        (Unit-type of (Trained unit)) Equal to Priest
        (Unit-type of (Trained unit)) Equal to Sorceress
  Actions
    Set AdvSoldiers = (Trained unit)
    Custom script: call CSS_AddBonus(udg_AdvSoldiers, 250, 9)
    Unit - Set mana of AdvSoldiers to 100.00%
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Unit-type of AdvSoldiers) Equal to Priest
      Then - Actions
        Unit - Add Holy Light (Dalaran) to AdvSoldiers
        Unit - Add Frost Bolt to AdvSoldiers
        Unit - Add Frost Nova (Neutral Hostile) to AdvSoldiers
      Else - Actions
        Unit - Add Lightning Shield (Neutral Hostile) to AdvSoldiers
        Unit - Add Firebolt (Neutral Hostile) to AdvSoldiers
        Unit - Add Rain of Fire (Neutral Hostile 1) to AdvSoldiers
Hard Soldiers
  Events
    Unit - A unit Finishes training a unit
  Conditions
    (Race of (Triggering player)) Equal to Human
    Or - Any (Conditions) are true
      Conditions
        (Unit-type of (Trained unit)) Equal to Footman
        (Unit-type of (Trained unit)) Equal to Knight
        (Unit-type of (Trained unit)) Equal to Rifleman
  Actions
    Set AdvSoldiers = (Trained unit)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Unit-type of AdvSoldiers) Equal to Rifleman
      Then - Actions
        Unit - Add Frenzy to AdvSoldiers
        Unit - Add Flame Strike (Neutral Hostile) to AdvSoldiers
        Custom script: call CSS_AddBonus(udg_AdvSoldiers, 250, 9)
        Custom script: call CSS_AddBonus(udg_AdvSoldiers, 1, 7)
      Else - Actions
        Unit - Add Faerie Fire to AdvSoldiers
        Unit - Add Firebolt (Neutral Hostile) to AdvSoldiers
        Custom script: call CSS_AddBonus(udg_AdvSoldiers, 400, 9)
        Custom script: call CSS_AddBonus(udg_AdvSoldiers, 1, 7)
    Unit - Set mana of AdvSoldiers to 100.00%
Difficulty Easy Endless
  Events
  Conditions
  Actions
    Player Group - Pick every player in (All players) and do (Actions)
      Loop - Actions
        Player - Turn Gives bounty On for (Picked player)
    Set SummoningDuration = 86400.00
    Set DifEndless = Easy
    Set EndlessMode = True
    Set EndlessHandicapIncrement = 3.00
    Set HourModifier = 1
    Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) belongs to an enemy of Player 4 (Purple)) Equal to True) and (((Matching unit) is A structure) Equal to True))) and do (Actions)
      Loop - Actions
        Unit - Make (Picked unit) Invulnerable
    Unit - Make Generator 0243 <gen> Vulnerable
    -------- Rush Timer --------
    Trigger - Run Setup_Timers <gen> (checking conditions)
    Countdown Timer - Pause TimerRushHard
    Countdown Timer - Pause TimerSummoning
    Countdown Timer - Destroy CountdownTimerWindow
    Trigger - Turn off TimerRushHard <gen>
    Trigger - Turn on Endless_Score <gen>
    -------- Handicap --------
    Player - Set Player 7 (Green) handicap to 450.00%
    Player - Set Player 1 (Red) handicap to Campaign easy handicap%
    Player - Set Player 2 (Blue) handicap to Campaign easy handicap%
    Player - Set Player 3 (Teal) handicap to Campaign easy handicap%
    Player - Set Player 4 (Purple) handicap to 125.00%
    Player - Set Player 5 (Yellow) handicap to 125.00%
    Player - Set Player 6 (Orange) handicap to 125.00%
    Player - Set Player 8 (Pink) handicap to 45.00%
    Player - Set Neutral Hostile handicap to Campaign easy handicap%
    -------- Extra Ability for Easy --------
    Unit - Add Holy Light (Dalaran) to Archmage 0200 <gen>
    Unit - Add Holy Light (Dalaran) to Archmage 0201 <gen>
    Unit - Add Holy Light (Dalaran) to Archmage 0202 <gen>
    Trigger - Turn on Endless_Challenge_Up <gen>
    -------- Blue --------
    Hero - Set Archmage 0201 <gen> Hero-level to 11, Hide level-up graphics
    Hero - Disable experience gain for Archmage 0201 <gen>
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Mass Teleport
    -------- Red --------
    Hero - Set Archmage 0200 <gen> Hero-level to 6, Hide level-up graphics
    Hero - Disable experience gain for Archmage 0200 <gen>
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Summon Water Elemental
    -------- Teal --------
    Hero - Set Archmage 0202 <gen> Hero-level to 5, Hide level-up graphics
    Hero - Disable experience gain for Archmage 0202 <gen>
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Summon Water Elemental
Difficulty Normal Endless
  Events
  Conditions
  Actions
    Player Group - Pick every player in (All players) and do (Actions)
      Loop - Actions
        Player - Turn Gives bounty On for (Picked player)
    Set SummoningDuration = 86400.00
    Set DifEndless = Normal
    Set EndlessMode = True
    Set EndlessHandicapIncrement = 4.00
    Set HourModifier = 1
    Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) belongs to an enemy of Player 4 (Purple)) Equal to True) and (((Matching unit) is A structure) Equal to True))) and do (Actions)
      Loop - Actions
        Unit - Make (Picked unit) Invulnerable
    Unit - Make Generator 0243 <gen> Vulnerable
    Trigger - Run Setup_Timers <gen> (checking conditions)
    Trigger - Turn on Endless_Score <gen>
    Player - Set Player 1 (Red) handicap to 80.00%
    Player - Set Player 2 (Blue) handicap to 80.00%
    Player - Set Player 3 (Teal) handicap to 80.00%
    Player - Set Player 7 (Green) handicap to 300.00%
    Player - Set Player 8 (Pink) handicap to 60.00%
    -------- Rush Timer --------
    Trigger - Run Setup_Timers <gen> (checking conditions)
    Countdown Timer - Pause TimerRushHard
    Countdown Timer - Pause TimerSummoning
    Countdown Timer - Destroy CountdownTimerWindow
    Trigger - Turn off TimerRushHard <gen>
    -------- Extra Ability for Normal --------
    Unit - Add Chain Lightning (Neutral Hostile) to Archmage 0200 <gen>
    Unit - Add Command Aura to Archmage 0200 <gen>
    Unit - Add Devotion Aura (Neutral Hostile) to Archmage 0201 <gen>
    Unit - Add Holy Light (Dalaran) to Archmage 0202 <gen>
    Trigger - Turn on Normal_Spellcaster <gen>
    Trigger - Turn on Endless_Challenge_Up <gen>
    -------- Blue --------
    Hero - Set Archmage 0201 <gen> Hero-level to 11, Hide level-up graphics
    Hero - Disable experience gain for Archmage 0201 <gen>
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Mass Teleport
    -------- Red --------
    Hero - Set Archmage 0200 <gen> Hero-level to 9, Hide level-up graphics
    Hero - Disable experience gain for Archmage 0200 <gen>
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Brilliance Aura
    -------- Teal --------
    Hero - Set Archmage 0202 <gen> Hero-level to 8, Hide level-up graphics
    Hero - Disable experience gain for Archmage 0202 <gen>
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Summon Water Elemental
Difficulty Hard Endless
  Events
  Conditions
  Actions
    Player Group - Pick every player in (All players) and do (Actions)
      Loop - Actions
        Player - Turn Gives bounty On for (Picked player)
    Set SummoningDuration = 86400.00
    Set DifEndless = Hard
    Set EndlessMode = True
    Set EndlessHandicapIncrement = 5.00
    Set HourModifier = 2
    Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) belongs to an enemy of Player 4 (Purple)) Equal to True) and (((Matching unit) is A structure) Equal to True))) and do (Actions)
      Loop - Actions
        Unit - Make (Picked unit) Invulnerable
    Unit - Make Generator 0243 <gen> Vulnerable
    Trigger - Run Setup_Timers <gen> (checking conditions)
    Player - Set Player 8 (Pink) handicap to 75.00%
    Player - Set Player 7 (Green) handicap to 150.00%
    -------- Rush Timer --------
    Trigger - Run Setup_Timers <gen> (checking conditions)
    Countdown Timer - Pause TimerRushNormal
    Countdown Timer - Pause TimerSummoning
    Countdown Timer - Destroy CountdownTimerWindow
    Trigger - Turn off TimerRushNormal <gen>
    Trigger - Turn off TimerRushHard <gen>
    -------- Extra Ability for Hard --------
    Unit - Add Bloodlust (Neutral Hostile 1) to Archmage 0200 <gen>
    Unit - Add Chain Lightning (Neutral Hostile) to Archmage 0200 <gen>
    Unit - Add Command Aura to Archmage 0200 <gen>
    Unit - Add Bloodlust (Neutral Hostile 1) to Archmage 0201 <gen>
    Unit - Add Devotion Aura (Neutral Hostile) to Archmage 0201 <gen>
    Unit - Add Bloodlust (Neutral Hostile 1) to Archmage 0202 <gen>
    Unit - Add Holy Light (Dalaran) to Archmage 0202 <gen>
    Unit - Add Holy Light (Dalaran) to Archmage 0202 <gen>
    Custom script: call CSS_AddBonus(gg_unit_Hamg_0200, 1250, 9)
    Custom script: call CSS_AddBonus(gg_unit_Hamg_0200, 720, 8)
    Custom script: call CSS_AddBonus(gg_unit_Hamg_0201, 1250, 9)
    Custom script: call CSS_AddBonus(gg_unit_Hamg_0201, 600, 8)
    Custom script: call CSS_AddBonus(gg_unit_Hamg_0202, 1250, 9)
    Custom script: call CSS_AddBonus(gg_unit_Hamg_0202, 775, 8)
    Trigger - Turn on Hard_Spellcasters <gen>
    Trigger - Turn on Endless_Challenge_Up <gen>
    Trigger - Turn on Endless_Score <gen>
    -------- Blue --------
    Hero - Set Archmage 0201 <gen> Hero-level to 12, Hide level-up graphics
    Hero - Disable experience gain for Archmage 0201 <gen>
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0201 <gen>: Human Archmage - Mass Teleport
    -------- Red --------
    Hero - Set Archmage 0200 <gen> Hero-level to 11, Hide level-up graphics
    Hero - Disable experience gain for Archmage 0200 <gen>
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0200 <gen>: Human Archmage - Mass Teleport
    -------- Teal --------
    Hero - Set Archmage 0202 <gen> Hero-level to 10, Hide level-up graphics
    Hero - Disable experience gain for Archmage 0202 <gen>
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Blizzard
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Brilliance Aura
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Summon Water Elemental
    Hero - Learn skill for Archmage 0202 <gen>: Human Archmage - Mass Teleport
Endless Score
  Events
    Time - Elapsed game time is 5 seconds
  Conditions
  Actions
    Leaderboard - Create a leaderboard for (All players) titled Endless Score
    Set EndlessBoard = (Last created leaderboard)
    Leaderboard - Add Player 4 (Purple) to EndlessBoard with label (Name of Player 4 (Purple)) and value 0
    Leaderboard - Add Player 5 (Yellow) to EndlessBoard with label (Name of Player 5 (Yellow)) and value 0
    Leaderboard - Add Player 6 (Orange) to EndlessBoard with label (Name of Player 6 (Orange)) and value 0
    Leaderboard - Add Player 7 (Green) to EndlessBoard with label Total Score and value 0
    Leaderboard - Add Player 9 (Gray) to EndlessBoard with label (Difficulty : + DifEndless) and value 0
    Leaderboard - Change the color of the value for Player 9 (Gray) in EndlessBoard to (0.00%, 0.00%, 0.00%) with 100.00% transparency
    Leaderboard - Show EndlessBoard
    Trigger - Turn on Endless_Score_Update <gen>
Endless Score Update
  Events
    Unit - A unit Dies
  Conditions
    (Owner of (Triggering unit)) Not equal to Player 4 (Purple)
    (Owner of (Triggering unit)) Not equal to Player 5 (Yellow)
    (Owner of (Triggering unit)) Not equal to Player 6 (Orange)
    (Owner of (Triggering unit)) Not equal to Player 7 (Green)
  Actions
    Set ScorePlayer = (Owner of (Killing unit))
    Set Score[(Player number of ScorePlayer)] = (Score[(Player number of ScorePlayer)] + ((Level of (Triggering unit)) x HourModifier))
    Leaderboard - Change the value for ScorePlayer in EndlessBoard to Score[(Player number of ScorePlayer)]
Endless Challenge Up
  Events
    Time - Every 30.00 seconds of game time
  Conditions
  Actions
    Player - Set Player 1 (Red) handicap to ((Player 1 (Red) handicap) + EndlessHandicapIncrement)%
    Player - Set Player 2 (Blue) handicap to ((Player 2 (Blue) handicap) + EndlessHandicapIncrement)%
    Player - Set Player 3 (Teal) handicap to ((Player 3 (Teal) handicap) + EndlessHandicapIncrement)%
    Player - Set Player 8 (Pink) handicap to ((Player 8 (Pink) handicap) + EndlessHandicapIncrement)%
    Player - Set Player 10 (Light Blue) handicap to ((Player 10 (Light Blue) handicap) + EndlessHandicapIncrement)%
Endless Hour
  Events
    Time - Every 3600.00 seconds of game time
  Conditions
  Actions
    Player Group - Pick every player in (All players) and do (Actions)
      Loop - Actions
        Player - Set the current research level of R005 (techcode) to ((Current research level of R005 (techcode) for (Picked player)) + 1) for (Picked player)
    Set HourModifier = (HourModifier + 1)
Paradrop Wave North
  Events
    Time - Every 300.00 seconds of game time
  Conditions
  Actions
    Quest - Display to (All players) the Quest Update message: Another Paradrop Wave incoming!
    Set tempLoc = (Position of Halls of the Dead 0211 <gen>)
    Set tempPlayer = Player 10 (Light Blue)
    For each (Integer loopIndex) from 1 to 12, do (Actions)
      Loop - Actions
        Set Pcht_dropCreateNew = True
        Set Pcht_dropUnitType = Footman
        Set Pcht_dropUnit = No unit
        Set Pcht_dropPlayer = tempPlayer
        Set Pcht_dropAngle = 0.00
        Set Pcht_dropPoint = (tempLoc offset by (Random real number between 0 and 2000.00) towards (Random angle) degrees)
        Set Pcht_dropHeight = 1200.00
        Set Pcht_dropSpeed = 5.00
        Trigger - Run Parachute_Drop <gen> (ignoring conditions)
        Custom script: call RemoveLocation(udg_Pcht_dropPoint)
    Custom script: call RemoveLocation(udg_tempLoc)
Paradrop Wave West
  Events
    Time - Every 300.00 seconds of game time
  Conditions
  Actions
    Set tempLoc = (Position of Halls of the Dead 0065 <gen>)
    Set tempPlayer = Player 10 (Light Blue)
    For each (Integer loopIndex) from 1 to 12, do (Actions)
      Loop - Actions
        Set Pcht_dropCreateNew = True
        Set Pcht_dropUnitType = Footman
        Set Pcht_dropUnit = No unit
        Set Pcht_dropPlayer = tempPlayer
        Set Pcht_dropAngle = 0.00
        Set Pcht_dropPoint = (tempLoc offset by (Random real number between 0 and 2000.00) towards (Random angle) degrees)
        Set Pcht_dropHeight = 1200.00
        Set Pcht_dropSpeed = 5.00
        Trigger - Run Parachute_Drop <gen> (ignoring conditions)
        Custom script: call RemoveLocation(udg_Pcht_dropPoint)
    Custom script: call RemoveLocation(udg_tempLoc)
Paradrop Wave East
  Events
    Time - Every 300.00 seconds of game time
  Conditions
  Actions
    Set tempLoc = (Position of Halls of the Dead 0142 <gen>)
    Set tempPlayer = Player 10 (Light Blue)
    For each (Integer loopIndex) from 1 to 12, do (Actions)
      Loop - Actions
        Set Pcht_dropCreateNew = True
        Set Pcht_dropUnitType = Footman
        Set Pcht_dropUnit = No unit
        Set Pcht_dropPlayer = tempPlayer
        Set Pcht_dropAngle = 0.00
        Set Pcht_dropPoint = (tempLoc offset by (Random real number between 0 and 2000.00) towards (Random angle) degrees)
        Set Pcht_dropHeight = 1200.00
        Set Pcht_dropSpeed = 5.00
        Trigger - Run Parachute_Drop <gen> (ignoring conditions)
        Custom script: call RemoveLocation(udg_Pcht_dropPoint)
    Custom script: call RemoveLocation(udg_tempLoc)
TimerRushNormal
  Events
    Time - TimerRushNormal expires
  Conditions
    GameOver Equal to False
  Actions
    Trigger - Turn off (This trigger)
    Quest - Display to (All players) the Warning message: Enemy air armadas detected!Enemy land batallions detected!
    AI - Send Player 1 (Red) the AI Command (0, 0)
    AI - Send Player 2 (Blue) the AI Command (0, 0)
    AI - Send Player 3 (Teal) the AI Command (0, 0)
    Trigger - Turn on Paradrop_Rush_Normal <gen>
    Trigger - Turn on Arthas02 <gen>
TimerRushHard
  Events
    Time - TimerRushHard expires
  Conditions
    GameOver Equal to False
  Actions
    Trigger - Turn off (This trigger)
    Quest - Display to (All players) the Warning message: Enemy air armadas detected!Enemy land batallions detected!
    AI - Send Player 1 (Red) the AI Command (0, 0)
    AI - Send Player 2 (Blue) the AI Command (0, 0)
    AI - Send Player 3 (Teal) the AI Command (0, 0)
    Trigger - Turn on Paradrop_Rush_Hard <gen>
    Trigger - Turn on Arthas02 <gen>
Paradrop Rush Normal
  Events
    Time - Every 5.00 seconds of game time
  Conditions
  Actions
    Set tempLoc = (Center of Dalaran_Reinforcement_Notification <gen>)
    Set tempPlayer = Player 10 (Light Blue)
    For each (Integer loopIndex) from 1 to 10, do (Actions)
      Loop - Actions
        Set Pcht_dropCreateNew = True
        Set Pcht_dropUnitType = Footman
        Set Pcht_dropUnit = No unit
        Set Pcht_dropPlayer = tempPlayer
        Set Pcht_dropAngle = 0.00
        Set Pcht_dropPoint = (tempLoc offset by (Random real number between 0 and 2000.00) towards (Random angle) degrees)
        Set Pcht_dropHeight = 1200.00
        Set Pcht_dropSpeed = 5.00
        Trigger - Run Parachute_Drop <gen> (ignoring conditions)
        Custom script: call RemoveLocation(udg_Pcht_dropPoint)
    For each (Integer loopIndex) from 1 to 10, do (Actions)
      Loop - Actions
        Set Pcht_dropCreateNew = True
        Set Pcht_dropUnitType = Priest
        Set Pcht_dropUnit = No unit
        Set Pcht_dropPlayer = tempPlayer
        Set Pcht_dropAngle = 0.00
        Set Pcht_dropPoint = (tempLoc offset by (Random real number between 0 and 2000.00) towards (Random angle) degrees)
        Set Pcht_dropHeight = 1200.00
        Set Pcht_dropSpeed = 5.00
        Trigger - Run Parachute_Drop <gen> (ignoring conditions)
        Custom script: call RemoveLocation(udg_Pcht_dropPoint)
    Custom script: call RemoveLocation(udg_tempLoc)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        RequestNumber Equal to 5
      Then - Actions
        Trigger - Turn off (This trigger)
      Else - Actions
        Set RequestNumber = (RequestNumber + 1)
Paradrop Rush Hard
  Events
    Time - Every 5.00 seconds of game time
  Conditions
  Actions
    Set tempLoc = (Center of Dalaran_Reinforcement_Notification <gen>)
    Set tempPlayer = Player 10 (Light Blue)
    For each (Integer loopIndex) from 1 to 3, do (Actions)
      Loop - Actions
        Set Pcht_dropCreateNew = True
        Set Pcht_dropUnitType = Knight
        Set Pcht_dropUnit = No unit
        Set Pcht_dropPlayer = tempPlayer
        Set Pcht_dropAngle = 0.00
        Set Pcht_dropPoint = (tempLoc offset by (Random real number between 0 and 2000.00) towards (Random angle) degrees)
        Set Pcht_dropHeight = 600.00
        Set Pcht_dropSpeed = 5.00
        Trigger - Run Parachute_Drop <gen> (ignoring conditions)
        Custom script: call RemoveLocation(udg_Pcht_dropPoint)
    For each (Integer loopIndex) from 1 to 4, do (Actions)
      Loop - Actions
        Set Pcht_dropCreateNew = True
        Set Pcht_dropUnitType = Sorceress
        Set Pcht_dropUnit = No unit
        Set Pcht_dropPlayer = tempPlayer
        Set Pcht_dropAngle = 0.00
        Set Pcht_dropPoint = (tempLoc offset by (Random real number between 0 and 2000.00) towards (Random angle) degrees)
        Set Pcht_dropHeight = 600.00
        Set Pcht_dropSpeed = 5.00
        Trigger - Run Parachute_Drop <gen> (ignoring conditions)
        Custom script: call RemoveLocation(udg_Pcht_dropPoint)
    For each (Integer loopIndex) from 1 to 6, do (Actions)
      Loop - Actions
        Set Pcht_dropCreateNew = True
        Set Pcht_dropUnitType = Priest
        Set Pcht_dropUnit = No unit
        Set Pcht_dropPlayer = tempPlayer
        Set Pcht_dropAngle = 0.00
        Set Pcht_dropPoint = (tempLoc offset by (Random real number between 0 and 2000.00) towards (Random angle) degrees)
        Set Pcht_dropHeight = 600.00
        Set Pcht_dropSpeed = 5.00
        Trigger - Run Parachute_Drop <gen> (ignoring conditions)
        Custom script: call RemoveLocation(udg_Pcht_dropPoint)
    Custom script: call RemoveLocation(udg_tempLoc)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        RequestNumber Equal to 5
      Then - Actions
        Trigger - Turn off (This trigger)
      Else - Actions
        Set RequestNumber = (RequestNumber + 1)
TealGold
  Events
    Player - Player 3 (Teal)'s Current gold becomes Less than or equal to 1500.00
  Conditions
  Actions
    Player - Add 1500 to Player 3 (Teal) Current gold
BlueGold
  Events
    Player - Player 2 (Blue)'s Current gold becomes Less than or equal to 1500.00
  Conditions
  Actions
    Player - Add 1500 to Player 2 (Blue) Current gold
RedGold
  Events
    Player - Player 1 (Red)'s Current gold becomes Less than or equal to 1500.00
  Conditions
  Actions
    Player - Add 1500 to Player 1 (Red) Current gold
TealLumber
  Events
    Player - Player 3 (Teal)'s Current lumber becomes Less than or equal to 1000.00
  Conditions
  Actions
    Player - Add 1000 to Player 3 (Teal) Current lumber
BlueLumber
  Events
    Player - Player 2 (Blue)'s Current lumber becomes Less than or equal to 1000.00
  Conditions
  Actions
    Player - Add 1000 to Player 2 (Blue) Current lumber
RedLumber
  Events
    Player - Player 1 (Red)'s Current lumber becomes Less than or equal to 1000.00
  Conditions
  Actions
    Player - Add 1000 to Player 1 (Red) Current lumber
Run from Map Init
Load Heroes
  Events
  Conditions
  Actions
    Trigger - Run Load_Arthas <gen> (checking conditions)
    Trigger - Run Load_KelThuzad <gen> (checking conditions)
Load Arthas
  Events
  Conditions
  Actions
    Unit - Create 1 Death Knight (Evil) for Player 4 (Purple) at (Center of ArthasStart <gen>) facing 90.00 degrees
    Set Arthas = (Last created unit)
    Hero - Set Arthas Hero-level to 8, Hide level-up graphics
    Hero - Learn skill for Arthas: Death Coil
    Hero - Learn skill for Arthas: Death Coil
    Hero - Learn skill for Arthas: Death Coil
    Hero - Learn skill for Arthas: Empower the Scourge
    Hero - Learn skill for Arthas: Empower the Scourge
    Hero - Learn skill for Arthas: Unholy Aura
    Hero - Learn skill for Arthas: Unholy Aura
    Hero - Learn skill for Arthas: Animate Dead
    Hero - Learn skill for Undead Captain 0231 <gen>: Corruption Blow
    Hero - Learn skill for Undead Captain 0231 <gen>: Corruption Blow
    Hero - Learn skill for Undead Captain 0231 <gen>: Corruption Blow
Load KelThuzad
  Events
  Conditions
  Actions
    Unit - Create 1 Lich (Lich) for Player 7 (Green) at (Center of KelThuzadStart <gen>) facing 90.00 degrees
    Set KelThuzad = (Last created unit)
    Hero - Set KelThuzad Hero-level to 7, Hide level-up graphics
Next Level Run
  Events
  Conditions
  Actions
    Game - Victory Player 4 (Purple) (Skip dialogs, Show scores)
    Game - Victory Player 5 (Yellow) (Skip dialogs, Show scores)
    Game - Victory Player 6 (Orange) (Skip dialogs, Show scores)
Max Level Hit
  Events
    Unit - A unit Gains a level
  Conditions
    (Hero level of (Triggering unit)) Equal to 10
  Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        EndlessMode Equal to False
      Then - Actions
        Hero - Disable experience gain for (Triggering unit)
      Else - Actions
    Hero - Modify Strength of (Triggering unit): Add 3
    Hero - Modify Agility of (Triggering unit): Add 3
    Hero - Modify Intelligence of (Triggering unit): Add 3
OpeningCancelled
  Events
  Conditions
  Actions
    Trigger - Turn off (This trigger)
    Set OpeningCancelled = True
    Cinematic - Fade in over 0.00 seconds using texture White Mask and color (0%, 0%, 0%) with 0% transparency
    Camera - Reset camera for Player 4 (Purple) to standard game-view over 0.00 seconds
    Camera - Reset camera for Player 5 (Yellow) to standard game-view over 0.00 seconds
    Camera - Reset camera for Player 6 (Orange) to standard game-view over 0.00 seconds
    Camera - Pan camera for Player 4 (Purple) to (Center of KelThuzadPost <gen>) over 0 seconds
    Camera - Pan camera for Player 5 (Yellow) to (Center of KelThuzadPost <gen>) over 0 seconds
    Camera - Pan camera for Player 6 (Orange) to (Center of KelThuzadPost <gen>) over 0 seconds
    Camera - Set a spacebar-point for Player 4 (Purple) at (Center of Archimonde <gen>)
    Camera - Set a spacebar-point for Player 5 (Yellow) at (Center of Archimonde <gen>)
    Camera - Set a spacebar-point for Player 6 (Orange) at (Center of Archimonde <gen>)
    Environment - Set sky to None
    Sound - Stop the currently playing music theme
    -------- *********************** --------
    Unit - Move KelThuzad instantly to (Center of KelThuzadPost <gen>)
    Unit - Remove Tichondrius from the game
    Unit - Make KelThuzad face 90.00 over 0 seconds
    Animation - Play KelThuzad's stand channel animation
    -------- *********************** --------
    Destructible - Open Gate 0074 <gen>
    Special Effect - Destroy DarkSummonMissile
    Trigger - Run Shades <gen> (checking conditions)
    Player - For Player 8 (Pink), turn Shared vision Off toward Player 4 (Purple)
    Player - For Player 8 (Pink), turn Shared vision Off toward Player 5 (Yellow)
    Player - For Player 8 (Pink), turn Shared vision Off toward Player 6 (Orange)
    Player - Make Player 8 (Pink) treat Player 4 (Purple) as an Enemy
    Player - Make Player 8 (Pink) treat Player 5 (Yellow) as an Enemy
    Player - Make Player 8 (Pink) treat Player 6 (Orange) as an Enemy
    Player - Make Player 4 (Purple) treat Player 8 (Pink) as an Enemy
    Player - Make Player 5 (Yellow) treat Player 8 (Pink) as an Enemy
    Player - Make Player 6 (Orange) treat Player 8 (Pink) as an Enemy
    Unit - Change ownership of KelThuzad to Player 7 (Green) and Change color
    Unit - Order KelThuzad to Hold Position
    Unit Group - Pick every unit in CinematicUnitGroup and do (Remove (Picked unit) from the game)
    Trigger - Run Setup_ComputerPlayers <gen> (checking conditions)
    Trigger - Run Start_Campaign_AI <gen> (checking conditions)
    Trigger - Run MiningAcolytes <gen> (checking conditions)
    Cinematic - Turn cinematic mode Off for (All players)
    Selection - Select Arthas for Player 4 (Purple)
    Selection - Select Undead Captain 0231 <gen> for Player 6 (Orange)
    Selection - Select Cultist 0284 <gen> for Player 5 (Yellow)
    -------- *********************** --------
    Player - Make Player 1 (Red) treat Player 4 (Purple) as an Enemy
    Player - Make Player 1 (Red) treat Player 7 (Green) as an Enemy
    Player - Make Player 4 (Purple) treat Player 1 (Red) as an Enemy
    -------- *********************** --------
    Trigger - Turn on KelThuzad_Animation_Resets <gen>
    Trigger - Turn on Periodic_Spawn <gen>
    Wait 5.00 seconds
    -------- Quest --------
    Quest - Display to (All players) the Quest Discovered message: |cffffcc00MAIN QUEST|rArchimonde - Kel'Thuzad must survive
    Quest - Mark QuestSummoning as Discovered
    Wait 5.00 seconds
    Quest - Display to (All players) the Hint message: Each player has unique units in their arsenal, in addition to old units being buffed with new abilities! Quickly adapt to react against enemy massive assaults!
    -------- *********************** --------
    Set Temp_Group = (Units owned by Player 10 (Light Blue))
    Unit Group - Pick every unit in Temp_Group and do (Actions)
      Loop - Actions
        Unit - Order (Picked unit) to Attack-Move To (Center of Archimonde <gen>)
    Custom script: call DestroyGroup(udg_Temp_Group)
    Trigger - Turn on Periodic_Spawn <gen>
    Trigger - Run Hero_MtP <gen> (ignoring conditions)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        EndlessMode Equal to False
      Then - Actions
        Trigger - Run Setup_Timers <gen> (checking conditions)
      Else - Actions
Opening01
  Events
  Conditions
  Actions
    Cinematic - Turn cinematic mode On for (All players)
    Player - For Player 8 (Pink), turn Shared vision On toward Player 5 (Yellow)
    Animation - Play the death animation for all doodads of type YOtf (doodadcode) within KelThuzadPost <gen>
    -------- Opening Gryphons --------
    Sound - Add WaterLakeLoop1 <gen> across LakeLoop01 <gen>
    Sound - Add WaterLakeLoop1 <gen> across LakeLoop02 <gen>
    Sound - Add WaterLakeLoop1 <gen> across LakeLoop03 <gen>
    Sound - Add WaterLakeLoop1 <gen> across LakeLoop04 <gen>
    Sound - Add WaterLakeLoop1 <gen> across LakeLoop05 <gen>
    Sound - Add WaterLakeLoop1 <gen> across LakeLoop06 <gen>
    Sound - Add WaterLakeLoop1 <gen> across LakeLoop07 <gen>
    Sound - Add WaterLakeLoop1 <gen> across LakeLoop08 <gen>
    Sound - Add WaterLakeLoop1 <gen> across LakeLoop09 <gen>
    Sound - Add WaterLakeLoop1 <gen> across LakeLoop10 <gen>
    Sound - Add WaterLakeLoop1 <gen> across LakeLoop11 <gen>
    Sound - Add WaterLakeLoop1 <gen> across LakeLoop12 <gen>
    Sound - Add WaterLakeLoop1 <gen> across LakeLoop13 <gen>
    Unit - Order Gryphon Rider 0018 <gen> to Move To (Center of Region_025 <gen>)
    Unit - Order Gryphon Rider 0022 <gen> to Move To (Center of Region_023 <gen>)
    Unit - Order Gryphon Rider 0019 <gen> to Move To (Center of Region_024 <gen>)
    Unit - Order Gryphon Rider 0020 <gen> to Move To (Center of Region_026 <gen>)
    Cinematic - Fade in over 6.00 seconds using texture White Mask and color (0%, 0%, 0%) with 0% transparency
    Camera - Apply gg_cam_OpeningGryphons01 for Player 4 (Purple) over 0.00 seconds
    Camera - Apply gg_cam_OpeningGryphons01 for Player 5 (Yellow) over 0.00 seconds
    Camera - Apply gg_cam_OpeningGryphons01 for Player 6 (Orange) over 0.00 seconds
    Camera - Apply gg_cam_OpeningGryphons02 for Player 4 (Purple) over 8.00 seconds
    Camera - Apply gg_cam_OpeningGryphons02 for Player 5 (Yellow) over 8.00 seconds
    Camera - Apply gg_cam_OpeningGryphons02 for Player 6 (Orange) over 8.00 seconds
    -------- Music --------
    Sound - Clear the music list
    Wait 0.01 seconds
    Sound - Play Dark Agents
    Sound - Set the music list to Music, starting with song 1
    -------- NOW SKIPPABLE --------
    Trigger - Turn on OpeningCancelled <gen>
    -------- ********* --------
    Wait 2.00 seconds
    If (OpeningCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    Sound - Attach HippoGryphReady1 <gen> to Gryphon Rider 0019 <gen>
    Sound - Set volume of HippoGryphReady1 <gen> to 50.00%
    Sound - Play HippoGryphReady1 <gen>
    Wait 5.00 seconds
    If (OpeningCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    -------- Opening Archmage --------
    Cinematic - Fade in over 3.00 seconds using texture White Mask and color (0%, 0%, 0%) with 0% transparency
    Unit - Order Knight 0011 <gen> to Move To (Center of Knight01 <gen>)
    Unit - Order Knight 0009 <gen> to Move To (Center of Knight02 <gen>)
    Unit - Order Knight 0007 <gen> to Move To (Center of Knight03 <gen>)
    Unit - Order Knight 0005 <gen> to Move To (Center of Knight04 <gen>)
    Unit - Order Sorceress 0015 <gen> to Move To (Center of Sorc01 <gen>)
    Unit - Order Sorceress 0016 <gen> to Move To (Center of Sorc02 <gen>)
    Sound - Set position of HorseLoop2 <gen> to (Center of KnightsRun <gen>) with Z offset 0
    Sound - Set volume of HorseLoop2 <gen> to 50.00%
    Sound - Play HorseLoop2 <gen>
    Sound - Set position of KnightNoRiderWhat2 <gen> to (Center of KnightsRun <gen>) with Z offset 0
    Sound - Set volume of KnightNoRiderWhat2 <gen> to 70.00%
    Sound - Play KnightNoRiderWhat2 <gen>
    Camera - Apply gg_cam_OpeningArchmage01 for Player 4 (Purple) over 0.00 seconds
    Camera - Apply gg_cam_OpeningArchmage01 for Player 5 (Yellow) over 0.00 seconds
    Camera - Apply gg_cam_OpeningArchmage01 for Player 6 (Orange) over 0.00 seconds
    Camera - Apply gg_cam_OpeningArchmage02 for Player 4 (Purple) over 7.00 seconds
    Camera - Apply gg_cam_OpeningArchmage02 for Player 5 (Yellow) over 7.00 seconds
    Camera - Apply gg_cam_OpeningArchmage02 for Player 6 (Orange) over 7.00 seconds
    Wait 1.00 seconds
    If (OpeningCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    Unit - Make Archmage 0006 <gen> face (Center of KelThuzadPost <gen>) over 0.20 seconds
    Wait 1.00 seconds
    If (OpeningCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    Destructible - Open Gate 0074 <gen>
    Sound - Set position of LargeCityGateOpen1 <gen> to (Center of GateOpen <gen>) with Z offset 0
    Sound - Set volume of LargeCityGateOpen1 <gen> to 60.00%
    Sound - Play LargeCityGateOpen1 <gen>
    Wait 1.00 seconds
    If (OpeningCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    Cinematic - Fade out over 3.00 seconds using texture White Mask and color (0%, 0%, 0%) with 0% transparency
    -------- Opening Pan to Mountain --------
    Camera - Change camera smoothing factor to 0.00
    Camera - Reset camera smoothing factor
    Wait 3.00 seconds
    If (OpeningCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    Camera - Apply gg_cam_Opening01 for Player 4 (Purple) over 0.00 seconds
    Camera - Apply gg_cam_Opening01 for Player 5 (Yellow) over 0.00 seconds
    Camera - Apply gg_cam_Opening01 for Player 6 (Orange) over 0.00 seconds
    Camera - Apply gg_cam_Opening03 for Player 4 (Purple) over 10.25 seconds
    Camera - Apply gg_cam_Opening03 for Player 5 (Yellow) over 10.25 seconds
    Camera - Apply gg_cam_Opening03 for Player 6 (Orange) over 10.25 seconds
    Cinematic - Fade in over 5.00 seconds using texture White Mask and color (0%, 0%, 0%) with 0% transparency
    Wait 4.00 seconds
    If (OpeningCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    Player - For Player 8 (Pink), turn Shared vision Off toward Player 4 (Purple)
    Player - For Player 8 (Pink), turn Shared vision Off toward Player 5 (Yellow)
    Player - For Player 8 (Pink), turn Shared vision Off toward Player 6 (Orange)
    -------- *********************** --------
    Unit - Make Arthas face KelThuzad over 0.30 seconds
    Unit - Make KelThuzad face Arthas over 0.30 seconds
    Cinematic - Send transmission to (All players) from Arthas named Arthas: Play U08Arthas01 <gen> and display The circle of power has been prepared per your instructions, lich. Are you ready to begin the summoning?. Modify duration: Add 0 seconds and Wait
    If (OpeningCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    Cinematic - Fade in over 1.00 seconds using texture White Mask and color (0%, 0%, 0%) with 0% transparency
    Camera - Apply gg_cam_Lich for Player 4 (Purple) over 0.00 seconds
    Camera - Apply gg_cam_Lich for Player 5 (Yellow) over 0.00 seconds
    Camera - Apply gg_cam_Lich for Player 6 (Orange) over 0.00 seconds
    Camera - Apply gg_cam_Lich02 for Player 4 (Purple) over (Length of U08KelThuzad02 <gen>) seconds
    Camera - Apply gg_cam_Lich02 for Player 5 (Yellow) over (Length of U08KelThuzad02 <gen>) seconds
    Camera - Apply gg_cam_Lich02 for Player 6 (Orange) over (Length of U08KelThuzad02 <gen>) seconds
    Cinematic - Send transmission to (All players) from KelThuzad named Kel'Thuzad: Play U08KelThuzad02 <gen> and display Nearly. I've been reading through Medivh's spellbook. His knowledge of demons alone is staggering. I suspect that he was far more powerful than anyone ever realized.. Modify duration: Add 0 seconds and Wait
    If (OpeningCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    -------- *********************** --------
    Trigger - Run Opening02 <gen> (checking conditions)
Opening02
  Events
  Conditions
  Actions
    -------- Tichondrius warp in --------
    Camera - Apply gg_cam_Lich02 for Player 4 (Purple) over 0 seconds
    Camera - Apply gg_cam_Lich02 for Player 5 (Yellow) over 0 seconds
    Camera - Apply gg_cam_Lich02 for Player 6 (Orange) over 0 seconds
    Camera - Apply gg_cam_DreadLord for Player 4 (Purple) over 12.00 seconds
    Camera - Apply gg_cam_DreadLord for Player 5 (Yellow) over 12.00 seconds
    Camera - Apply gg_cam_DreadLord for Player 6 (Orange) over 12.00 seconds
    Special Effect - Create a special effect at (Center of OpeningTichondriusSpawn <gen>) using Abilities\Spells\Undead\DarkSummoning\DarkSummonTarget.mdl
    Sound - Set position of DarkSummoningTarget1 <gen> to (Center of EndingReviveArthas <gen>) with Z offset 0
    Sound - Play DarkSummoningTarget1 <gen>
    Set DarkSummonMissile = (Last created special effect)
    Wait 2 seconds
    If (OpeningCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    Unit - Create 1 Dreadlord for Player 9 (Gray) at (Center of OpeningTichondriusSpawn <gen>) facing (Position of KelThuzad)
    Set Tichondrius = (Last created unit)
    Player - Make Player 9 (Gray) treat Player 4 (Purple) as an Ally
    Player - Make Player 9 (Gray) treat Player 7 (Green) as an Ally
    Player - Make Player 4 (Purple) treat Player 9 (Gray) as an Ally
    Player - Make Player 7 (Green) treat Player 9 (Gray) as an Ally
    Hero - Create Orb of Fire and give it to Tichondrius
    Wait 0.50 seconds
    If (OpeningCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    Special Effect - Destroy DarkSummonMissile
    Unit - Make Arthas face Tichondrius over 0.30 seconds
    Unit - Make KelThuzad face Tichondrius over 0.30 seconds
    Cinematic - Send transmission to (All players) from Tichondrius named Tichondrius: Play U08Tichondrius03 <gen> and display Not powerful enough to escape death, that is for certain. Suffice to say, the work he began, we will finish... today. Let the summoning commence! . Modify duration: Add 0 seconds and Wait
    If (OpeningCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    Trigger - Run Opening03 <gen> (checking conditions)
Opening03
  Events
  Conditions
    OpeningCancelled Equal to False
  Actions
    -------- Kel'Thuzad Summoning --------
    Unit - Order KelThuzad to Move To (Center of KelThuzadPost <gen>)
    Camera - Apply gg_cam_Summoning01 for Player 4 (Purple) over 0 seconds
    Camera - Apply gg_cam_Summoning01 for Player 5 (Yellow) over 0 seconds
    Camera - Apply gg_cam_Summoning01 for Player 6 (Orange) over 0 seconds
    Camera - Apply gg_cam_Summoning02 for Player 4 (Purple) over 10.00 seconds
    Camera - Apply gg_cam_Summoning02 for Player 5 (Yellow) over 10.00 seconds
    Camera - Apply gg_cam_Summoning02 for Player 6 (Orange) over 10.00 seconds
    Unit - Make Tichondrius face (Center of KelThuzadPost <gen>) over 4.00 seconds
    Unit - Make Arthas face (Center of KelThuzadPost <gen>) over 1.00 seconds
    Wait 4.50 seconds
    If (OpeningCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    Unit - Make KelThuzad face 90.00 over 0 seconds
    Wait 0.50 seconds
    If (OpeningCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    Animation - Play KelThuzad's stand channel animation
    Sound - Add CityScapeMagicRunesLoop1 <gen> across Summoning <gen>
    Sound - Attach AntiMagicShellBirth1 <gen> to KelThuzad
    Sound - Play AntiMagicShellBirth1 <gen>
    Sound - Attach CrippleTarget1 <gen> to KelThuzad
    Sound - Play CrippleTarget1 <gen>
    Wait 1.00 seconds
    If (OpeningCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    -------- Summoning Effect --------
    Wait 2.00 seconds
    If (OpeningCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    -------- Tichondrius warps out --------
    Special Effect - Create a special effect at (Center of OpeningTichondriusSpawn <gen>) using Abilities\Spells\Undead\DarkSummoning\DarkSummonTarget.mdl
    Sound - Set position of DarkSummoningTarget1 <gen> to (Center of EndingReviveArthas <gen>) with Z offset 0
    Sound - Play DarkSummoningTarget1 <gen>
    Set DarkSummonMissile = (Last created special effect)
    Wait 2 seconds
    If (OpeningCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    Unit - Hide Tichondrius
    Wait 0.50 seconds
    If (OpeningCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    Special Effect - Destroy DarkSummonMissile
    Cinematic - Fade out over 1.00 seconds using texture White Mask and color (0%, 0%, 0%) with 0% transparency
    Wait 1.00 seconds
    If (OpeningCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    -------- *********************** --------
    -------- NO LONGER SKIPPABLE --------
    Set OpeningEnd = True
    Trigger - Turn off OpeningCancelled <gen>
    Unit - Change ownership of KelThuzad to Player 7 (Green) and Change color
    Unit - Order KelThuzad to Hold Position
    Unit - Remove Tichondrius from the game
    Unit Group - Pick every unit in CinematicUnitGroup and do (Remove (Picked unit) from the game)
    Trigger - Run Shades <gen> (checking conditions)
    -------- *********************** --------
    Camera - Reset camera for Player 4 (Purple) to standard game-view over 0.00 seconds
    Camera - Reset camera for Player 5 (Yellow) to standard game-view over 0.00 seconds
    Camera - Reset camera for Player 6 (Orange) to standard game-view over 0.00 seconds
    Cinematic - Fade in over 1.00 seconds using texture White Mask and color (0%, 0%, 0%) with 0% transparency
    Selection - Clear selection for Player 4 (Purple)
    Selection - Clear selection for Player 5 (Yellow)
    Selection - Clear selection for Player 6 (Orange)
    Selection - Select Arthas for Player 4 (Purple)
    Selection - Select Cultist 0284 <gen> for Player 5 (Yellow)
    Selection - Select Undead Captain 0231 <gen> for Player 6 (Orange)
    Player - Make Player 8 (Pink) treat Player 4 (Purple) as an Enemy
    Player - Make Player 8 (Pink) treat Player 5 (Yellow) as an Enemy
    Player - Make Player 8 (Pink) treat Player 6 (Orange) as an Enemy
    Player - Make Player 4 (Purple) treat Player 8 (Pink) as an Enemy
    Player - Make Player 5 (Yellow) treat Player 8 (Pink) as an Enemy
    Player - Make Player 6 (Orange) treat Player 8 (Pink) as an Enemy
    Camera - Set a spacebar-point for Player 4 (Purple) at (Center of Archimonde <gen>)
    Camera - Set a spacebar-point for Player 5 (Yellow) at (Center of Archimonde <gen>)
    Camera - Set a spacebar-point for Player 6 (Orange) at (Center of Archimonde <gen>)
    Cinematic - Turn cinematic mode Off for (All players)
    Environment - Set sky to None
    Trigger - Run Setup_ComputerPlayers <gen> (checking conditions)
    Trigger - Run Start_Campaign_AI <gen> (checking conditions)
    Trigger - Run MiningAcolytes <gen> (checking conditions)
    -------- *********************** --------
    Player - Make Player 1 (Red) treat Player 4 (Purple) as an Enemy
    Player - Make Player 1 (Red) treat Player 5 (Yellow) as an Enemy
    Player - Make Player 1 (Red) treat Player 6 (Orange) as an Enemy
    Player - Make Player 1 (Red) treat Player 7 (Green) as an Enemy
    Player - Make Player 4 (Purple) treat Player 1 (Red) as an Enemy
    Player - Make Player 5 (Yellow) treat Player 1 (Red) as an Enemy
    Player - Make Player 6 (Orange) treat Player 1 (Red) as an Enemy
    -------- *********************** --------
    Trigger - Turn on KelThuzad_Animation_Resets <gen>
    -------- Quest --------
    Wait 5.00 seconds
    Quest - Display to (All players) the Quest Discovered message: |cffffcc00MAIN QUEST|rArchimonde - Kel'Thuzad must survive
    Quest - Mark QuestSummoning as Discovered
    Wait 5.00 seconds
    Quest - Display to (All players) the Hint message: Each player has unique units in their arsenal, in addition to old units being buffed with new abilities! Quickly adapt to react against enemy massive assaults!
    -------- *********************** --------
    Set Temp_Group = (Units owned by Player 10 (Light Blue))
    Unit Group - Pick every unit in Temp_Group and do (Actions)
      Loop - Actions
        Unit - Order (Picked unit) to Attack-Move To (Center of Archimonde <gen>)
    Custom script: call DestroyGroup(udg_Temp_Group)
    Trigger - Turn on Periodic_Spawn <gen>
    Trigger - Run Hero_MtP <gen> (ignoring conditions)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        EndlessMode Equal to False
      Then - Actions
        Trigger - Run Setup_Timers <gen> (checking conditions)
      Else - Actions
Run from 'Opening03' and 'OpeningCancelled'
MiningAcolytes
  Events
  Conditions
  Actions
    Unit Group - Pick every unit in (Units in MiningAcolytes <gen>) and do (Order (Picked unit) to Harvest Haunted Gold Mine 0092 <gen>)
    Unit Group - Pick every unit in (Units in Harvesters <gen>) and do (Order (Picked unit) to Harvest Nearby Lumber)
    Unit Group - Pick every unit in (Units in Gold_Player_6 <gen>) and do (Order (Picked unit) to Harvest Haunted Gold Mine 0212 <gen>)
    Unit Group - Pick every unit in (Units in Lumber_Player_6 <gen>) and do (Order (Picked unit) to Harvest Nearby Lumber)
    Unit Group - Pick every unit in (Units in Gold_Player_5 <gen>) and do (Order (Picked unit) to Harvest Haunted Gold Mine 0254 <gen>)
    Unit Group - Pick every unit in (Units in Lumber_Player_5 <gen>) and do (Order (Picked unit) to Harvest Nearby Lumber)
ArthasHoldPosition
  Events
    Unit - A unit enters EndingMoveArthas <gen>
  Conditions
  Actions
    Wait 0.50 seconds
    Unit - Order Arthas to Hold Position
EndingCancelled
  Events
    Player - Player 4 (Purple) skips a cinematic sequence
    Player - Player 5 (Yellow) skips a cinematic sequence
    Player - Player 6 (Orange) skips a cinematic sequence
  Conditions
    EndingCancelled Equal to False
  Actions
    Trigger - Turn off (This trigger)
    Set EndingCancelled = True
    -------- Fade out --------
    Cinematic - Fade out over 2 seconds using texture White Mask and color (0%, 0%, 0%) with 0% transparency
    Wait 2 seconds
    Sound - Stop the currently playing music theme
    -------- Start the next level --------
    Trigger - Run Next_Level_Run <gen> (checking conditions)
Ending01
  Events
  Conditions
  Actions
    Trigger - Turn off (This trigger)
    Trigger - Turn off Paradrop_Wave_East <gen>
    Trigger - Turn off Paradrop_Wave_North <gen>
    Trigger - Turn off Paradrop_Wave_West <gen>
    Trigger - Turn off Periodic_Spawn <gen>
    -------- Cinematic Stuff --------
    Game - Turn the day/night cycle Off
    Unit - Remove All buffs from Arthas
    Unit - Remove All buffs from KelThuzad
    Unit Group - Pick every unit in (Units in (Playable map area)) and do (Hide (Picked unit))
    Unit Group - Pick every unit in (Units in (Playable map area)) and do (Make (Picked unit) Invulnerable)
    Player Group - Pick every player in (All players) and do (Actions)
      Loop - Actions
        Player - Make Player 4 (Purple) treat (Picked player) as an Ally
        Player - Make (Picked player) treat Player 4 (Purple) as an Ally
    Unit - Unhide Arthas
    Unit - Unhide KelThuzad
    If ((Arthas is dead) Equal to True) then do (Instantly revive Arthas at (Center of EndingReviveArthas <gen>), Hide revival graphics) else do (Move Arthas instantly to (Center of EndingReviveArthas <gen>))
    Unit - Pause all units
    Unit - Unpause Arthas
    Unit - Unpause KelThuzad
    Selection - Clear selection
    -------- Stop Summoning --------
    Sound - Remove CityScapeMagicRunesLoop1 <gen> across Summoning <gen>
    Trigger - Turn off KelThuzad_Animation_Resets <gen>
    Animation - Reset KelThuzad's animation
    Countdown Timer - Destroy CountdownTimerWindow
    Cinematic - Turn cinematic mode On for (All players)
    Environment - Set sky to Dalaran Sky
    Environment - Set fog to style 0 (fogstyle), z-start 500.00, z-end 7000.00, density 0 and color (35.00%, 0.00%, 15.00%)
    Unit - Make Arthas Invulnerable
    Unit - Make KelThuzad Invulnerable
    Unit - Set Arthas acquisition range to 0.00
    Trigger - Turn on ArthasHoldPosition <gen>
    -------- Cinematic Can Now Be Skipped --------
    Trigger - Turn on EndingCancelled <gen>
    -------- Archimonde Enters --------
    Camera - Apply gg_cam_ArchimondeBirth01 for Player 4 (Purple) over 0 seconds
    Camera - Apply gg_cam_ArchimondeBirth01 for Player 5 (Yellow) over 0 seconds
    Camera - Apply gg_cam_ArchimondeBirth01 for Player 6 (Orange) over 0 seconds
    Cinematic - Fade in over 5.00 seconds using texture White Mask and color (0%, 0%, 0%) with 0% transparency
    Camera - Apply gg_cam_ArchimondeBirth02 for Player 4 (Purple) over 24.00 seconds
    Camera - Apply gg_cam_ArchimondeBirth02 for Player 5 (Yellow) over 24.00 seconds
    Camera - Apply gg_cam_ArchimondeBirth02 for Player 6 (Orange) over 24.00 seconds
    Special Effect - Destroy DarkSummonMissile
    Wait 1.00 seconds
    If (EndingCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    Special Effect - Destroy DarkSummonTarget
    Wait 1.00 seconds
    If (EndingCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    Unit - Order KelThuzad to Move To (Center of EndingKelThuzadPost <gen>)
    Wait 1.50 seconds
    If (EndingCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    -------- Arthas watches --------
    Unit - Order Arthas to Move To (Center of EndingMoveArthas <gen>)
    -------- ************ --------
    Cinematic - Send transmission to (All players) from KelThuzad named Kel'Thuzad: Play U08KelThuzad18 <gen> and display Come forth, Lord Archimonde! Enter this world and let us bask in your power!. Modify duration: Add 0 seconds and Don't wait
    Wait 1.00 seconds
    If (EndingCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    Unit - Make KelThuzad face (Center of Archimonde <gen>) over 0 seconds
    Unit - Make Arthas face (Center of Archimonde <gen>) over 0 seconds
    Special Effect - Create a special effect at (Center of KelThuzadPost <gen>) using Abilities\Spells\Undead\DarkSummoning\DarkSummonTarget.mdl
    Sound - Attach DarkSummoningTarget1 <gen> to KelThuzad
    Sound - Play DarkSummoningTarget1 <gen>
    Set DarkSummonMissile = (Last created special effect)
    Wait 6.00 seconds
    If (EndingCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    Special Effect - Destroy DarkSummonMissile
    Animation - Play the stand animation for all doodads of type YOtf (doodadcode) within (Playable map area)
    Sound - Set position of BuildingDeathLargeOrc <gen> to (Center of Archimonde <gen>) with Z offset 0
    Sound - Play BuildingDeathLargeOrc <gen>
    Wait 1.00 seconds
    If (EndingCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    Animation - Play the stand animation for all doodads of type YOf2 (doodadcode) within (Playable map area)
    Animation - Play the stand animation for all doodads of type YOtf (doodadcode) within KelThuzadPost <gen>
    Sound - Set position of BuildingDeathLargeHuman <gen> to (Center of Archimonde <gen>) with Z offset 0
    Sound - Play BuildingDeathLargeHuman <gen>
    -------- Warlock appears --------
    Sound - Set position of WarlockAppears <gen> to (Center of Archimonde <gen>) with Z offset 0
    Sound - Play WarlockAppears <gen>
    -------- ********** --------
    Unit - Create 1 Warlock for Player 4 (Purple) at (Center of Archimonde <gen>) facing 90.00 degrees
    Set Archimonde = (Last created unit)
    AI - Ignore Archimonde's guard position
    Wait 1.00 seconds
    If (EndingCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    Animation - Play the death animation for all doodads of type YOf2 (doodadcode) within (Playable map area)
    Animation - Play the death animation for all doodads of type YOtf (doodadcode) within (Playable map area)
    Animation - Play Archimonde's spell inferno animation
    Wait 2 seconds
    If (EndingCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    Unit - Make Arthas face (Center of Archimonde <gen>) over 0 seconds
    Animation - Play the death animation for all doodads of type YOtf (doodadcode) within KelThuzadPost <gen>
    Animation - Play Archimonde's stand animation
    Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 1 (Red)) and do (Explode (Picked unit))
    Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 2 (Blue)) and do (Explode (Picked unit))
    Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 3 (Teal)) and do (Explode (Picked unit))
    Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 8 (Pink)) and do (Explode (Picked unit))
    Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 10 (Light Blue)) and do (Explode (Picked unit))
    Wait for U08KelThuzad18 <gen> to be 0 seconds from finished playing
    If (EndingCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    Cinematic - Send transmission to (All players) from Archimonde named Archimonde: Play U08Archimonde19 <gen> and display Tremble, mortals, and despair! Doom has come to this world!. Modify duration: Add 0 seconds and Wait
    If (EndingCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    -------- Music --------
    Sound - Play Doom
    Unit - Make Archimonde face KelThuzad over 0 seconds
    -------- Archimonde Talks --------
    Camera - Apply gg_cam_ArchimondeSpeaks for Player 4 (Purple) over 0 seconds
    Camera - Apply gg_cam_ArchimondeSpeaks for Player 5 (Yellow) over 0 seconds
    Camera - Apply gg_cam_ArchimondeSpeaks for Player 6 (Orange) over 0 seconds
    Cinematic - Fade in over 1.00 seconds using texture White Mask and color (0%, 0%, 0%) with 0% transparency
    Cinematic - Send transmission to (All players) from Archimonde named Archimonde: Play U08Archimonde20 <gen> and display You have done well, little lich. My plan worked perfectly.. Modify duration: Add 0 seconds and Don't wait
    Wait 2.00 seconds
    If (EndingCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    Special Effect - Create a special effect at (Center of OpeningTichondriusSpawn <gen>) using Abilities\Spells\Undead\DarkSummoning\DarkSummonTarget.mdl
    Sound - Set position of DarkSummoningTarget1 <gen> to (Center of OpeningTichondriusSpawn <gen>) with Z offset 0
    Sound - Play DarkSummoningTarget1 <gen>
    Set DarkSummonMissile = (Last created special effect)
    Wait 2 seconds
    If (EndingCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    -------- ************ --------
    Unit - Create 1 Dreadlord for Player 9 (Gray) at (Center of OpeningTichondriusSpawn <gen>) facing (Position of KelThuzad)
    Set Tichondrius = (Last created unit)
    Unit - Order Tichondrius to Hold Position
    Player - Make Player 9 (Gray) treat Player 4 (Purple) as an Ally
    Player - Make Player 9 (Gray) treat Player 7 (Green) as an Ally
    Player - Make Player 4 (Purple) treat Player 9 (Gray) as an Ally
    Player - Make Player 7 (Green) treat Player 9 (Gray) as an Ally
    Hero - Create Orb of Fire and give it to Tichondrius
    -------- ************ --------
    Unit - Make Tichondrius face Archimonde over 0 seconds
    Special Effect - Destroy DarkSummonMissile
    Wait 3.00 seconds
    If (EndingCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    Wait for U08Archimonde20 <gen> to be 0 seconds from finished playing
    If (EndingCancelled Equal to True) then do (Skip remaining actions) else do (Do nothing)
    Unit - Make Archimonde face Tichondrius over 0 seconds
    Camera - Apply gg_cam_TichondriusUpClose for Player 4 (Purple) over 0 seconds
    Camera - Apply gg_cam_TichondriusUpClose for Player 5 (Yellow) over 0 seconds
    Camera - Apply gg_cam_TichondriusUpClose for Player 6 (Orange) over 0 seconds
    Camera - Apply gg_cam_TichondriusUpClose for Player 4 (Purple) over (Length of U08Tichondrius21 <gen>) seconds
    Camera - Apply gg_cam_TichondriusUpClose for Player 5 (Yellow) over (Length of U08Tichondrius21 <gen>) seconds
    Camera - Apply gg_cam_TichondriusUpClose for Player 6 (Orange) over (Length of U08Tichondrius21 <gen>) seconds
    Cinematic - Send transmission to (All players) from Tichondrius named Tichondrius: Play U08Tichondrius21 <gen> and display Lord Archimonde, all the preparations have been made. . Modify duration: Add 0 seconds and Wait