1. Are you planning to upload your awesome map to Hive? Please review the rules here.
    Dismiss Notice
  2. Seek unity between the elements in the 22nd Terraining Contest Poll.
    Dismiss Notice
  3. Seize the moment! The 18th Mini Mapping Contest has commenced.
    Dismiss Notice
  4. The heavens smile on the old faithful. The 16th Techtree Contest has begun.
    Dismiss Notice
  5. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Trigger Viewer

THW.TC15.KelThuzad v1.8.w3x
Variables
Initialization
Melee Initialization
-- Kelthuzad Commander --
KelThuzad
KelThuzad Initialization
---------------------------
Requirements
KT Altar Build
KT Altar Destroy
---------------------------
Skeletons
KT Undying Fury
KT Merge Skeletons
KT Undead Essence
Bonecaster
KT Bone Shield
Plague Wagon
KT Plague Wagon Attack
KT Plague Wagon Death
KT Zombie
Carrion Bird
KT Carrion Bird Move
Butcher
KT Consume
KT Consume Loop
Bone Breaker
KT Raze
KT Resilient Bones
Sky Darkener
KT Darkening Bolt
Banisher
KT Banishing Nova
KT Banishing Nova Cancel
KT Banishing Nova End
Cold Wraith
KT Absorption
KT Cold Embrace
KT Frostguard
KT Frostguard Loop
Necrolyte
KT Necrotic Connection
KT Necrotic Connection End
KT Raise Dead Stop
KT Food Requirement
Gravekeeper
KT Gravekeeper Wards
KT Gravekeeper Wards Death
KT Blight Cauldron
KT Unholy Orb
Blight Spreader
KT Spread Blight
KT Blinding Fog
Shadewyrm
KT Fade
KT Fade Loop
KT Fade Mana
---------------------------
Items
KT Necrolytes Dagger
KT Orb of Reanimation
---------------------------
Channeling and Rally
KT Cultist Rally
KT Channel Order
KT Channel Dredge
KT Channel Dredge Death
KT Channel Cancel
KT Channel Death
KT Channel Ressurection
KT Channel Frost Spire
Kel'Thuzad Ressurection
KT Resurrection Loop
KT KelThuzad Death
---------------------------
Hero Abilities
KT Cold Dark Mastery
KT Cold Dark Mastery Loop
---------------------------
KT Frost Bolt
KT Frost Volley
KT Frost Bolt I Frost Volley Loop
KT Frost Blast
KT Frost Blast Loop
---------------------------
KT Freezing Strike
KT Chilling Strike
KT Glacial Strike
---------------------------
KT Sacrificial Pact
---------------------------
KT Sapphiron
KT Sapphiron Attack
KT Frozen Shell
KT Frozen Shell Damage
KT Frozen Shell Loop
---------------------------
KT Call of the Archlich
KT Call of the Archlich Loop
KT Shade of Naxxramas
---------------------------
Ability Upgrades
KT Ability Upgrade
KT Talent Point
KT Learn Ability
---------------------------
KelThuzad Sounds
GDD [Weep]
GDD Variable Creator
GUI Friendly Damage Detection
Unit Indexer
Unit Indexer
//===========================================================================
// Counts key structures owned by a player and his or her allies, including
// structures currently upgrading or under construction.
//
// Key structures: Town Hall, Great Hall, Tree of Life, Necropolis
//

function LivingPlayerHallsFilter takes nothing returns boolean
    return (IsUnitAliveBJ(GetFilterUnit()) and IsUnitType(GetFilterUnit(),UNIT_TYPE_TOWNHALL))
endfunction

function CountLivingPlayerTownHalls takes player whichPlayer returns integer
    local group g
    local integer matchedCount
    local boolexpr b=Filter(function LivingPlayerHallsFilter)

    set g = CreateGroup()
    call GroupEnumUnitsOfPlayer(g, whichPlayer, b)
    set matchedCount = CountUnitsInGroup(g)
    call DestroyGroup(g)
    call DestroyBoolExpr(b)
    set b=null
    set g=null

    return matchedCount
endfunction

function Custom_MeleeGetAllyKeyStructureCount takes player whichPlayer returns integer
    local integer    playerIndex
    local player     indexPlayer
    local integer    keyStructs

    // Count the number of buildings controlled by all not-yet-defeated co-allies.
    set keyStructs = 0
    set playerIndex = 0
    loop
        set indexPlayer = Player(playerIndex)
        if (PlayersAreCoAllied(whichPlayer, indexPlayer)) then
            set keyStructs = keyStructs + CountLivingPlayerTownHalls(indexPlayer)
        //    set keyStructs = keyStructs + GetPlayerTypedUnitCount(indexPlayer, "townhall", true, true)
        //    set keyStructs = keyStructs + GetPlayerTypedUnitCount(indexPlayer, "greathall", true, true)
        //    set keyStructs = keyStructs + GetPlayerTypedUnitCount(indexPlayer, "treeoflife", true, true)
        //    set keyStructs = keyStructs + GetPlayerTypedUnitCount(indexPlayer, "necropolis", true, true)
        //    set keyStructs = keyStructs + GetPlayerTypedUnitCount(indexPlayer, "custom_h030", true, true)
        //    set keyStructs = keyStructs + GetPlayerTypedUnitCount(indexPlayer, "custom_h01C", true, true)
        //    set keyStructs = keyStructs + GetPlayerTypedUnitCount(indexPlayer, "custom_h012", true, true)
        //    set keyStructs = keyStructs + GetPlayerTypedUnitCount(indexPlayer, "custom_h013", true, true)
        //    set keyStructs = keyStructs + CountLivingPlayerUnitsOfTypeId('h013',indexPlayer)//Never use group functions for this, just count living units for player. Much better idea.
        //    set keyStructs = keyStructs + CountLivingPlayerUnitsOfTypeId('h014',indexPlayer)
        //    set keyStructs = keyStructs + CountLivingPlayerUnitsOfTypeId('h015',indexPlayer)
        //    set keyStructs = keyStructs + CountLivingPlayerUnitsOfTypeId('h01C',indexPlayer)
        //    set keyStructs = keyStructs + CountLivingPlayerUnitsOfTypeId('h01E',indexPlayer)
        //    set keyStructs = keyStructs + CountLivingPlayerUnitsOfTypeId('h01F',indexPlayer)
        //    set keyStructs = keyStructs + CountLivingPlayerUnitsOfTypeId('h012',indexPlayer)
        //    set keyStructs = keyStructs + CountLivingPlayerUnitsOfTypeId('h02F',indexPlayer)
        //    set keyStructs = keyStructs + CountLivingPlayerUnitsOfTypeId('h02J',indexPlayer)
        //    set keyStructs = keySructs + CountLivingPlayerUnitsOfTypeId('h030',indexPlayer)
			
        //    set keyStructs = keyStructs + CountLivingPlayerUnitsOfTypeId('h000',indexPlayer)//Non-modded human custom ids
        //    set keyStructs = keyStructs + CountLivingPlayerUnitsOfTypeId('h00D',indexPlayer)
        //    set keyStructs = keyStructs + CountLivingPlayerUnitsOfTypeId('h00E',indexPlayer)
			
        //    set keyStructs = keyStructs + CountLivingPlayerUnitsOfTypeId('o00C',indexPlayer)//Non-modded orc custom ids
        //    set keyStructs = keyStructs + CountLivingPlayerUnitsOfTypeId('o00D',indexPlayer)
        //    set keyStructs = keyStructs + CountLivingPlayerUnitsOfTypeId('o00E',indexPlayer)
			
        //    set keyStructs = keyStructs + CountLivingPlayerUnitsOfTypeId('e00M',indexPlayer)//Non-modded night elf custom ids
        //    set keyStructs = keyStructs + CountLivingPlayerUnitsOfTypeId('e00N',indexPlayer)
        //    set keyStructs = keyStructs + CountLivingPlayerUnitsOfTypeId('e00O',indexPlayer)
			
        //    set keyStructs = keyStructs + CountLivingPlayerUnitsOfTypeId('u00C',indexPlayer)//Non-modded undead custom ids
        //    set keyStructs = keyStructs + CountLivingPlayerUnitsOfTypeId('u00D',indexPlayer)
        //    set keyStructs = keyStructs + CountLivingPlayerUnitsOfTypeId('u00E',indexPlayer)
        endif
            
        set playerIndex = playerIndex + 1
        exitwhen playerIndex == bj_MAX_PLAYERS
    endloop

    return keyStructs
endfunction







//===========================================================================
function Custom_MeleePlayerIsCrippled takes player whichPlayer returns boolean
    local integer allyStructures    = MeleeGetAllyStructureCount(whichPlayer)
    local integer allyKeyStructures = Custom_MeleeGetAllyKeyStructureCount(whichPlayer)

    // Dead teams are not considered to be crippled.
    return (allyStructures > 0) and (allyKeyStructures <= 0)
endfunction



//===========================================================================
// Test each player to determine if anyone has become crippled.
//
function Custom_MeleeCheckForCrippledPlayers takes nothing returns nothing
    local integer    playerIndex
    local player     indexPlayer
    local force      crippledPlayers = CreateForce()
    local boolean    isNowCrippled
    local race       indexRace

    // The "finish soon" exposure of all players overrides any "crippled" exposure
    if bj_finishSoonAllExposed then
        return
    endif

    // Check each player to see if he or she has been crippled or uncrippled.
    set playerIndex = 0
    loop
        set indexPlayer = Player(playerIndex)
        set isNowCrippled = Custom_MeleePlayerIsCrippled(indexPlayer)

        if (not bj_playerIsCrippled[playerIndex] and isNowCrippled) then

            // Player became crippled; start their cripple timer.
            set bj_playerIsCrippled[playerIndex] = true
            call TimerStart(bj_crippledTimer[playerIndex], bj_MELEE_CRIPPLE_TIMEOUT, false, function MeleeCrippledPlayerTimeout)

            if (GetLocalPlayer() == indexPlayer) then
                // Use only local code (no net traffic) within this block to avoid desyncs.

                // Show the timer window.
                call TimerDialogDisplay(bj_crippledTimerWindows[playerIndex], true)

                // Display a warning message.
                call DisplayTimedTextToPlayer(indexPlayer, 0, 0, bj_MELEE_CRIPPLE_MSG_DURATION, "|cffffcc00"+udg_RevealWarning+"|r")
            endif

        elseif (bj_playerIsCrippled[playerIndex] and not isNowCrippled) then

            // Player became uncrippled; stop their cripple timer.
            set bj_playerIsCrippled[playerIndex] = false
            call PauseTimer(bj_crippledTimer[playerIndex])

            if (GetLocalPlayer() == indexPlayer) then
                // Use only local code (no net traffic) within this block to avoid desyncs.

                // Hide the timer window for this player.
                call TimerDialogDisplay(bj_crippledTimerWindows[playerIndex], false)

                // Display a confirmation message if the player's team is still alive.
                if (MeleeGetAllyStructureCount(indexPlayer) > 0) then
                    if (bj_playerIsExposed[playerIndex]) then
                        call DisplayTimedTextToPlayer(indexPlayer, 0, 0, bj_MELEE_CRIPPLE_MSG_DURATION, GetLocalizedString("CRIPPLE_UNREVEALED"))
                    else
                        call DisplayTimedTextToPlayer(indexPlayer, 0, 0, bj_MELEE_CRIPPLE_MSG_DURATION, GetLocalizedString("CRIPPLE_UNCRIPPLED"))
                    endif
                endif
            endif

            // If the player granted shared vision, deny that vision now.
            call MeleeExposePlayer(indexPlayer, false)

        endif
            
        set playerIndex = playerIndex + 1
        exitwhen playerIndex == bj_MAX_PLAYERS
    endloop
endfunction

//===========================================================================
// Determine if the lost unit should result in any defeats or victories.
//
function Custom_MeleeCheckLostUnit takes unit lostUnit returns nothing
    local player lostUnitOwner = GetOwningPlayer(lostUnit)

    // We only need to check for mortality if this was the last building.
    if (GetPlayerStructureCount(lostUnitOwner, true) <= 0) then
        call MeleeCheckForLosersAndVictors()
    endif

    // Check if the lost unit has crippled or uncrippled the player.
    // (A team with 0 units is dead, and thus considered uncrippled.)
    call Custom_MeleeCheckForCrippledPlayers()
endfunction

//===========================================================================
// Determine if the gained unit should result in any defeats, victories,
// or cripple-status changes.
//
function Custom_MeleeCheckAddedUnit takes unit addedUnit returns nothing
    local player addedUnitOwner = GetOwningPlayer(addedUnit)

    // If the player was crippled, this unit may have uncrippled him/her.
    if (bj_playerIsCrippled[GetPlayerId(addedUnitOwner)]) then
        call Custom_MeleeCheckForCrippledPlayers()
    endif
endfunction

//===========================================================================
function Custom_MeleeTriggerActionConstructCancel takes nothing returns nothing
    call Custom_MeleeCheckLostUnit(GetCancelledStructure())
endfunction

//===========================================================================
function Custom_MeleeTriggerActionUnitDeath takes nothing returns nothing
    if (IsUnitType(GetDyingUnit(), UNIT_TYPE_STRUCTURE)) then
        call Custom_MeleeCheckLostUnit(GetDyingUnit())
    endif
endfunction

//===========================================================================
function Custom_MeleeTriggerActionUnitConstructionStart takes nothing returns nothing
    call Custom_MeleeCheckAddedUnit(GetConstructingStructure())
endfunction

//===========================================================================
function Custom_MeleeTriggerActionAllianceChange takes nothing returns nothing
    call MeleeCheckForLosersAndVictors()
    call Custom_MeleeCheckForCrippledPlayers()
endfunction

//===========================================================================
function MeleeInitVictoryDefeatCustomized takes nothing returns nothing
    local trigger trig
    local integer index
    local player indexPlayer

    // Create a timer window for the "finish soon" timeout period, it has no timer
    // because it is driven by real time (outside of the game state to avoid desyncs)
    set bj_finishSoonTimerDialog = CreateTimerDialog(null)

    // Set a trigger to fire when we receive a "finish soon" game event
    set trig = CreateTrigger()
    call TriggerRegisterGameEvent(trig , EVENT_GAME_TOURNAMENT_FINISH_SOON)
    call TriggerAddAction(trig , function MeleeTriggerTournamentFinishSoon)

    // Set a trigger to fire when we receive a "finish now" game event
    set trig = CreateTrigger()
    call TriggerRegisterGameEvent(trig , EVENT_GAME_TOURNAMENT_FINISH_NOW)
    call TriggerAddAction(trig , function MeleeTriggerTournamentFinishNow)

    // Set up each player's mortality code.
    set index = 0
    loop
        set indexPlayer = Player(index)

        // Make sure this player slot is playing.
        if ( GetPlayerSlotState(indexPlayer) == PLAYER_SLOT_STATE_PLAYING ) then
            set bj_meleeDefeated[index]=false
            set bj_meleeVictoried[index]=false

            // Create a timer and timer window in case the player is crippled.
            set bj_playerIsCrippled[index]=false
            set bj_playerIsExposed[index]=false
            set bj_crippledTimer[index]=CreateTimer()
            set bj_crippledTimerWindows[index]=CreateTimerDialog(bj_crippledTimer[index])
            call TimerDialogSetTitle(bj_crippledTimerWindows[index] , MeleeGetCrippledTimerMessage(indexPlayer))

            // Set a trigger to fire whenever a building is cancelled for this player.
            set trig = CreateTrigger()
            call TriggerRegisterPlayerUnitEvent(trig , indexPlayer , EVENT_PLAYER_UNIT_CONSTRUCT_CANCEL , null)
            call TriggerAddAction(trig , function Custom_MeleeTriggerActionConstructCancel)

            // Set a trigger to fire whenever a unit dies for this player.
            set trig = CreateTrigger()
            call TriggerRegisterPlayerUnitEvent(trig , indexPlayer , EVENT_PLAYER_UNIT_DEATH , null)
            call TriggerAddAction(trig , function Custom_MeleeTriggerActionUnitDeath)

            // Set a trigger to fire whenever a unit begins construction for this player
            set trig = CreateTrigger()
            call TriggerRegisterPlayerUnitEvent(trig , indexPlayer , EVENT_PLAYER_UNIT_CONSTRUCT_START , null)
            call TriggerAddAction(trig , function Custom_MeleeTriggerActionUnitConstructionStart)

            // Set a trigger to fire whenever this player defeats-out
            set trig = CreateTrigger()
            call TriggerRegisterPlayerEvent(trig , indexPlayer , EVENT_PLAYER_DEFEAT)
            call TriggerAddAction(trig , function MeleeTriggerActionPlayerDefeated)

            // Set a trigger to fire whenever this player leaves
            set trig = CreateTrigger()
            call TriggerRegisterPlayerEvent(trig , indexPlayer , EVENT_PLAYER_LEAVE)
            call TriggerAddAction(trig , function MeleeTriggerActionPlayerLeft)

            // Set a trigger to fire whenever this player changes his/her alliances.
            set trig = CreateTrigger()
            call TriggerRegisterPlayerAllianceChange(trig , indexPlayer , ALLIANCE_PASSIVE)
            call TriggerRegisterPlayerStateEvent(trig , indexPlayer , PLAYER_STATE_ALLIED_VICTORY , EQUAL , 1)
            call TriggerAddAction(trig , function Custom_MeleeTriggerActionAllianceChange)
        else
            set bj_meleeDefeated[index]=true
            set bj_meleeVictoried[index]=false

            // Handle leave events for observers
            if ( IsPlayerObserver(indexPlayer) ) then
                // Set a trigger to fire whenever this player leaves
                set trig = CreateTrigger()
                call TriggerRegisterPlayerEvent(trig , indexPlayer , EVENT_PLAYER_LEAVE)
                call TriggerAddAction(trig , function MeleeTriggerActionPlayerLeft)
            endif
        endif

        set index = index + 1
        exitwhen index == bj_MAX_PLAYERS
    endloop

    // Test for victory / defeat at startup, in case the user has already won / lost.
    // Allow for a short time to pass first, so that the map can finish loading.
    call TimerStart(CreateTimer() , 2.0 , false , function Custom_MeleeTriggerActionAllianceChange)
endfunction

Name Type Is Array Initial Value
AE_TmpAbility abilcode No
AE_TmpDamage real Yes
AE_TmpForce force Yes
AE_TmpGroup group Yes
AE_TmpHandle handle No
AE_TmpInteger integer Yes
AE_TmpPoint location Yes
AE_TmpReal real Yes
AE_TmpSound sound Yes
AE_TmpUnit unit Yes
CorpsesAmount integer Yes
CorpsesMultiboard multiboard Yes
GDD__Integers integer Yes
GDD__LeftMapGroup group No
GDD__TriggerArray trigger Yes
GDD__UnitArray unit Yes
GDD_Damage real No
GDD_DamagedUnit unit No
GDD_DamageSource unit No
GDD_Event real No
HashtableGroup group No
IsUnitPreplaced boolean Yes
KT_AltarRequirement unit Yes
KT_BanishHashtable hashtable No
KT_ColdDarkGroup group No
KT_ColdDarkHashtable hashtable No
KT_ColdEmbraceGroup group No
KT_ConsumeGroup group No
KT_CotAGroup group No
KT_CotAHashtable hashtable No
KT_DockedUnit1 unit Yes
KT_DockedUnit2 unit Yes
KT_DockedUnit3 unit Yes
KT_DockGroup group Yes
KT_DockHashtable hashtable No
KT_DockTarget unit Yes
KT_DredgeGroup1 group Yes
KT_DredgeGroup2 group Yes
KT_DredgeGroup3 group Yes
KT_FadeGroup group No
KT_FoodRequirement unit Yes
KT_FrostBlastGroup group No
KT_FrostBoltGroup group No
KT_FrostBoltHashtable hashtable No
KT_FrostguardGroup group No
KT_FrostguardHashtable hashtable No
KT_FrozenShellGroup group No
KT_FrozenShellHashtable hashtable No
KT_Handle handle No
KT_KelThuzadDummy unit Yes
KT_KelThuzadResurrection real Yes
KT_KelThuzadTarget unit Yes
KT_NecrolyteGroup group Yes
KT_PlagueHashtable hashtable No
KT_TalentGroup group No
RevealWarning string No You will be revealed unless you build a town hall.
UDex integer No
UDexGen integer No
UDexNext integer Yes
UDexPrev integer Yes
UDexRecycle integer No
UDexUnits unit Yes
UDexWasted integer No
UnitIndexerEnabled boolean No
UnitIndexEvent real No
Default melee game initialization for all players
Melee Initialization
  Events
    Map initialization
  Conditions
  Actions
    Sound - Play 21_lotus_clan___perversion <gen>
    Melee Game - Use melee time of day (for all players)
    Melee Game - Limit Heroes to 1 per Hero-type (for all players)
    Melee Game - Give trained Heroes a Scroll of Town Portal (for all players)
    Melee Game - Set starting resources (for all players)
    Melee Game - Remove creeps and critters from used start locations (for all players)
    Melee Game - Create starting units (for all players)
    Melee Game - Run melee AI scripts (for computer players)
    Custom script: call MeleeInitVictoryDefeatCustomized()
    Player Group - Pick every player in (All players controlled by a User player) and do (Actions)
      Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Race of (Picked player)) Equal to Undead
            ((Picked player) handicap) Equal to 90.00
          Then - Actions
            Player - Set (Picked player) handicap to 100%
            Unit Group - Pick every unit in (Units owned by (Picked player) of type Acolyte) and do (Actions)
              Loop - Actions
                Unit - Replace (Picked unit) with a Cultist using The new unit's default life and mana
            Unit Group - Pick every unit in (Units owned by (Picked player) of type Ghoul) and do (Actions)
              Loop - Actions
                Unit - Remove (Picked unit) from the game
            Unit Group - Pick every unit in (Units owned by (Picked player) of type Necropolis) and do (Actions)
              Loop - Actions
                Unit - Replace (Picked unit) with a Archlich Hall using The new unit's default life and mana
                Unit - Create 1.Catacomb for (Owner of (Last replaced unit)) at ((Position of (Last replaced unit)) offset by 128.00 towards (Random angle) degrees.) facing 270.00 degrees
            Unit Group - Pick every unit in (Units owned by (Picked player) of type Haunted Gold Mine) and do (Actions)
              Loop - Actions
                Unit - Kill (Picked unit)
          Else - Actions
KelThuzad Initialization
  Events
    Time - Elapsed game time is 1.00 seconds
  Conditions
  Actions
    Quest - Create a Required quest titled Credits with the description Credits:Summerwildpantsguessname, Blizzard Entertainment, Ujimasa Hojo, Stefan.K, UgoUgo, MasterHaosis, Mister_Haudrauf, -Grendel, Korija2029, Thrikodius, WhiteDeath, Hate, viiva, Edge45, Marcos DAB, BLazeKraze, JollyD, Chen, San, Null, GooS, Hellx-Magnus, The_Silent, -Berz-, CRAZYRUSSIAN, darkdeathknight, Anachron, EvilCryptLord, stan0033, and infrenus., using icon path ReplaceableTextures\CommandButtons\BTNGargoyle.blp
    Hashtable - Create a hashtable
    Set VariableSet KT_DockHashtable = (Last created hashtable)
    Hashtable - Create a hashtable
    Set VariableSet KT_FrostBoltHashtable = (Last created hashtable)
    Hashtable - Create a hashtable
    Set VariableSet KT_PlagueHashtable = (Last created hashtable)
    Hashtable - Create a hashtable
    Set VariableSet KT_FrostguardHashtable = (Last created hashtable)
    Hashtable - Create a hashtable
    Set VariableSet KT_BanishHashtable = (Last created hashtable)
    Hashtable - Create a hashtable
    Set VariableSet KT_ColdDarkHashtable = (Last created hashtable)
    Hashtable - Create a hashtable
    Set VariableSet KT_FrozenShellHashtable = (Last created hashtable)
    Hashtable - Create a hashtable
    Set VariableSet KT_CotAHashtable = (Last created hashtable)
    Player Group - Pick every player in (All players) and do (Actions)
      Loop - Actions
        Player - Limit training of Archlich to 1 for (Picked player)
        Player - Limit training of Blight Spreader to 1 for (Picked player)
        Unit - Create 1.No Altar for (Picked player) at ((Picked player) start location) facing Default building facing degrees
        Set VariableSet KT_AltarRequirement[(Player number of (Picked player))] = (Last created unit)
        Player - Disable Greater Frost Bolt (Upgrade) for (Picked player)
        Player - Disable Frost Blast (Upgrade) for (Picked player)
        Player - Disable Frost Volley (Upgrade) for (Picked player)
        Player - Disable Glacial Strike (Upgrade) for (Picked player)
        Player - Disable Greater Freezing Strike (Upgrade) for (Picked player)
        Player - Disable Chilling Strike (Upgrade) for (Picked player)
        Player - Disable Sacrificial Pact (Upgrade) for (Picked player)
        Player - Disable Dark Sacrifice (Upgrade) for (Picked player)
        Player - Disable Greater Dark Ritual (Upgrade) for (Picked player)
KT Altar Build
  Events
    Unit - A unit Begins construction
  Conditions
    (Unit-type of (Constructing structure)) Equal to Altar of the Archlich
  Actions
    Unit - Kill KT_AltarRequirement[(Player number of (Owner of (Triggering unit)))]
KT Altar Destroy
  Events
    Unit - A unit Dies
    Unit - A unit Cancels construction
  Conditions
    (Unit-type of (Triggering unit)) Equal to Altar of the Archlich
  Actions
    Set VariableSet AE_TmpPoint[0] = (Position of (Triggering unit))
    Unit - Create 1.No Altar for (Owner of (Triggering unit)) at AE_TmpPoint[0] facing Default building facing degrees
    Set VariableSet KT_AltarRequirement[(Player number of (Owner of (Triggering unit)))] = (Last created unit)
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
KT Undying Fury
  Events
    Unit - A unit Dies
  Conditions
    (Unit-type of (Dying unit)) Equal to Shambler
    (Current research level of R000 (techcode) for (Owner of (Dying unit))) Greater than 0
    (Killing unit) Not equal to No unit
    ((Killing unit) belongs to an ally of (Owner of (Dying unit)).) Equal to False
  Actions
    Unit - Replace (Dying unit) with a Shambler using The new unit's default life and mana
    Set VariableSet AE_TmpPoint[0] = (Position of (Last replaced unit))
    Unit - Add Undying Fury (Morph) to (Last replaced unit)
    Unit - Add a 10.00 second Generic expiration timer to (Last replaced unit)
    Special Effect - Create a special effect at AE_TmpPoint[0] using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
    Special Effect - Destroy (Last created special effect)
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
KT Merge Skeletons
  Events
    Unit - A unit Starts the effect of an ability
  Conditions
    Or - Any (Conditions) are true
      Conditions
        (Ability being cast) Equal to Merge Sky Darkener
        (Ability being cast) Equal to Merge Bone Breaker
        (Ability being cast) Equal to Merge Banisher
  Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Ability being cast) Equal to Merge Bone Breaker
      Then - Actions
        Set VariableSet AE_TmpPoint[0] = (Position of (Triggering unit))
        Set VariableSet AE_TmpGroup[0] = (Units within 250.00 of AE_TmpPoint[0] matching ((((Matching unit) is alive) Equal to True) and (((Owner of (Matching unit)) Equal to (Owner of (Casting unit))) and ((Unit-type of (Matching unit)) Equal to (Unit-type of (Casting unit))))).)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Number of units in AE_TmpGroup[0]) Greater than or equal to 4
          Then - Actions
            Set VariableSet AE_TmpInteger[0] = 0
            Set VariableSet AE_TmpReal[0] = 0.00
            Unit - Create 1.Bone Breaker for (Owner of (Triggering unit)) at AE_TmpPoint[0] facing (Random angle) degrees
            Animation - Play (Last created unit)'s birth (animationname) animation
            Animation - Queue (Last created unit)'s stand (animationname) animation
            Unit Group - Pick every unit in AE_TmpGroup[0] and do (Actions)
              Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  If - Conditions
                    AE_TmpInteger[0] Less than 4
                  Then - Actions
                    Set VariableSet AE_TmpInteger[0] = (AE_TmpInteger[0] + 1)
                    Set VariableSet AE_TmpReal[0] = (AE_TmpReal[0] + ((Percentage life of (Picked unit)) / 4.00))
                    Unit - Kill (Picked unit)
                  Else - Actions
            Unit - Set life of (Last created unit) to AE_TmpReal[0]%
          Else - Actions
        Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
        Custom script: call DestroyGroup (udg_AE_TmpGroup[0])
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Ability being cast) Equal to Merge Sky Darkener
      Then - Actions
        Set VariableSet AE_TmpPoint[0] = (Position of (Triggering unit))
        Set VariableSet AE_TmpGroup[0] = (Units within 250.00 of AE_TmpPoint[0] matching ((((Matching unit) is alive) Equal to True) and (((Owner of (Matching unit)) Equal to (Owner of (Casting unit))) and ((Unit-type of (Matching unit)) Equal to (Unit-type of (Casting unit))))).)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Number of units in AE_TmpGroup[0]) Greater than or equal to 2
          Then - Actions
            Set VariableSet AE_TmpInteger[0] = 0
            Set VariableSet AE_TmpReal[0] = 0.00
            Unit - Create 1.Sky Darkener for (Owner of (Triggering unit)) at AE_TmpPoint[0] facing (Random angle) degrees
            Animation - Play (Last created unit)'s birth (animationname) animation
            Animation - Queue (Last created unit)'s stand (animationname) animation
            Unit Group - Pick every unit in AE_TmpGroup[0] and do (Actions)
              Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  If - Conditions
                    AE_TmpInteger[0] Less than 2
                  Then - Actions
                    Set VariableSet AE_TmpInteger[0] = (AE_TmpInteger[0] + 1)
                    Set VariableSet AE_TmpReal[0] = (AE_TmpReal[0] + ((Percentage life of (Picked unit)) / 2.00))
                    Unit - Kill (Picked unit)
                  Else - Actions
            Unit - Set life of (Last created unit) to AE_TmpReal[0]%
          Else - Actions
        Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
        Custom script: call DestroyGroup (udg_AE_TmpGroup[0])
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Ability being cast) Equal to Merge Banisher
      Then - Actions
        Set VariableSet AE_TmpPoint[0] = (Position of (Triggering unit))
        Set VariableSet AE_TmpGroup[0] = (Units within 250.00 of AE_TmpPoint[0] matching ((((Matching unit) is alive) Equal to True) and (((Owner of (Matching unit)) Equal to (Owner of (Casting unit))) and ((Unit-type of (Matching unit)) Equal to (Unit-type of (Casting unit))))).)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Number of units in AE_TmpGroup[0]) Greater than or equal to 2
          Then - Actions
            Set VariableSet AE_TmpInteger[0] = 0
            Set VariableSet AE_TmpReal[0] = 0.00
            Unit - Create 1.Banisher for (Owner of (Triggering unit)) at AE_TmpPoint[0] facing (Random angle) degrees
            Animation - Play (Last created unit)'s birth (animationname) animation
            Animation - Queue (Last created unit)'s stand (animationname) animation
            Unit Group - Pick every unit in AE_TmpGroup[0] and do (Actions)
              Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  If - Conditions
                    AE_TmpInteger[0] Less than 2
                  Then - Actions
                    Set VariableSet AE_TmpInteger[0] = (AE_TmpInteger[0] + 1)
                    Set VariableSet AE_TmpReal[0] = (AE_TmpReal[0] + ((Percentage life of (Picked unit)) / 2.00))
                    Unit - Kill (Picked unit)
                  Else - Actions
            Unit - Set life of (Last created unit) to AE_TmpReal[0]%
          Else - Actions
        Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
        Custom script: call DestroyGroup (udg_AE_TmpGroup[0])
      Else - Actions
KT Undead Essence
  Events
    Time - Every 1.00 seconds of game time
  Conditions
  Actions
    Custom script: set bj_wantDestroyGroup = true
    Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) is alive) Equal to True) and ((Level of Undead Essence for (Matching unit)) Greater than 0))) and do (Actions)
      Loop - Actions
        Set VariableSet AE_TmpPoint[0] = (Position of (Picked unit))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            Or - Any (Conditions) are true
              Conditions
                (AE_TmpPoint[0] is blighted) Equal to True
                ((Picked unit) has buff Longevity) Equal to True
                ((Picked unit) has buff Scroll of Undeath) Equal to True
            (Level of Undead Essence (Effect) for (Picked unit)) Less than or equal to 0
          Then - Actions
            Unit - Pause the expiration timer for (Picked unit).
            Unit - Add Undead Essence (Effect) to (Picked unit)
          Else - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                (AE_TmpPoint[0] is blighted) Equal to False
                ((Picked unit) has buff Longevity) Equal to False
                ((Picked unit) has buff Scroll of Undeath) Equal to False
                (Level of Undead Essence (Effect) for (Picked unit)) Greater than 0
              Then - Actions
                Unit - Unpause the expiration timer for (Picked unit).
                Unit - Remove Undead Essence (Effect) from (Picked unit)
              Else - Actions
        Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
KT Bone Shield
  Events
    Game - GDD_Event becomes Equal to 0
  Conditions
    (GDD_DamagedUnit has buff Unholy Armor) Equal to True
  Actions
    Unit - Set life of GDD_DamagedUnit to ((Life of GDD_DamagedUnit) + (GDD_Damage x 0.50))
KT Plague Wagon Attack
  Events
    Unit - A unit enters (Playable map area)
  Conditions
    (Unit-type of (Entering unit)) Equal to Plague Cloud
  Actions
    Trigger - Turn off (This trigger)
    Set VariableSet AE_TmpPoint[0] = (Position of (Entering unit))
    Unit - Create 1.Plague Cloud (Dummy) for (Owner of (Entering unit)) at AE_TmpPoint[0] facing Default building facing degrees
    Unit - Add a 4.00 second Generic expiration timer to (Last created unit)
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
    Trigger - Turn on (This trigger)
KT Plague Wagon Death
  Events
    Unit - A unit Dies
  Conditions
    ((Dying unit) is A structure) Equal to False
    ((Dying unit) is A Hero) Equal to False
    ((Dying unit) is Summoned) Equal to False
    ((Dying unit) is Magic Immune) Equal to False
    ((Dying unit) is A sapper) Equal to False
    ((Dying unit) is A flying unit) Equal to False
  Actions
    Set VariableSet AE_TmpPoint[0] = (Position of (Dying unit))
    Set VariableSet AE_TmpGroup[0] = (Units within 200.00 of AE_TmpPoint[0] matching (((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of (Dying unit)).) Equal to True)) and ((Unit-type of (Matching unit)) Equal to Plague Cloud (Dummy))).)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Number of units in AE_TmpGroup[0]) Greater than 0
      Then - Actions
        Unit - Create 1.Zombie for (Owner of (Random unit from AE_TmpGroup[0])) at AE_TmpPoint[0] facing (Facing of (Dying unit)) degrees
        Set VariableSet AE_TmpPoint[1] = (Position of (Last created unit))
        Unit - Add a 30.00 second Generic expiration timer to (Last created unit)
        Special Effect - Create a special effect at AE_TmpPoint[1] using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
        Special Effect - Destroy (Last created special effect)
        Unit - Remove (Dying unit) from the game
        Custom script: call RemoveLocation (udg_AE_TmpPoint[1])
      Else - Actions
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
KT Zombie
  Events
    Unit - A unit Dies
  Conditions
    (Unit-type of (Killing unit)) Equal to Zombie
    ((Dying unit) belongs to an enemy of (Owner of (Killing unit)).) Equal to True
    ((Dying unit) is A structure) Equal to False
    ((Dying unit) is Mechanical) Equal to False
    ((Dying unit) is An Ancient) Equal to False
    ((Dying unit) is Summoned) Equal to False
    ((Dying unit) is A flying unit) Equal to False
    ((Dying unit) is A Hero) Equal to False
  Actions
    Unit - Replace (Dying unit) with a Zombie using The new unit's default life and mana
    Unit - Add a 30.00 second Generic expiration timer to (Last replaced unit)
    Unit - Change ownership of (Last replaced unit) to (Owner of (Killing unit)) and Change color
    Set VariableSet AE_TmpPoint[0] = (Position of (Last replaced unit))
    Special Effect - Create a special effect at AE_TmpPoint[0] using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
    Special Effect - Destroy (Last created special effect)
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
KT Carrion Bird Move
  Events
    Time - Every 0.03 seconds of game time
  Conditions
  Actions
    Custom script: set bj_wantDestroyGroup = true
    Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) is alive) Equal to True) and (((Unit-type of (Matching unit)) Equal to Carrion Bird) or ((Unit-type of (Matching unit)) Equal to u00R)))) and do (Actions)
      Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            Or - Any (Conditions) are true
              Conditions
                (Current order of (Picked unit)) Equal to (Order(attack))
                (Current order of (Picked unit)) Equal to (Order(move))
                (Current order of (Picked unit)) Equal to (Order(patrol))
                (Current order of (Picked unit)) Equal to (Order(smart))
          Then - Actions
            Set VariableSet AE_TmpUnit[0] = (Picked unit)
            Set VariableSet AE_TmpPoint[0] = (Position of (Picked unit))
            Set VariableSet AE_TmpPoint[1] = (AE_TmpPoint[0] offset by 7.00 towards (Facing of (Picked unit)) degrees.)
            Custom script: call SetUnitX(udg_AE_TmpUnit[0],GetLocationX(udg_AE_TmpPoint[1]))
            Custom script: call SetUnitY(udg_AE_TmpUnit[0],GetLocationY(udg_AE_TmpPoint[1]))
            Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
            Custom script: call RemoveLocation (udg_AE_TmpPoint[1])
          Else - Actions
            Set VariableSet AE_TmpUnit[0] = (Picked unit)
            Set VariableSet AE_TmpPoint[0] = (Position of (Picked unit))
            Set VariableSet AE_TmpPoint[1] = (AE_TmpPoint[0] offset by 7.00 towards (Facing of (Picked unit)) degrees.)
            Custom script: call SetUnitX(udg_AE_TmpUnit[0],GetLocationX(udg_AE_TmpPoint[1]))
            Custom script: call SetUnitY(udg_AE_TmpUnit[0],GetLocationY(udg_AE_TmpPoint[1]))
            Unit - Make (Picked unit) face ((Facing of (Picked unit)) + 20.00) over 0.10 seconds
            Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
            Custom script: call RemoveLocation (udg_AE_TmpPoint[1])
KT Consume
  Events
    Unit - A unit Starts the effect of an ability
  Conditions
    (Ability being cast) Equal to Consume
  Actions
    Hashtable - Save 20.00 as 0 of (Key (Casting unit).) in KT_PlagueHashtable.
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Level of Consume (Regen Effect) for (Casting unit)) Equal to 0
        (Level of Consume (Speed Effect) for (Casting unit)) Equal to 0
      Then - Actions
        Unit - Add Consume (Regen Effect) to (Triggering unit)
        Unit - Add Consume (Speed Effect) to (Triggering unit)
      Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Level of Consume (Regen Effect) for (Casting unit)) Less than 5
            (Level of Consume (Speed Effect) for (Casting unit)) Less than 5
          Then - Actions
            Unit - Set level of Consume (Regen Effect) for (Triggering unit) to ((Level of Consume (Regen Effect) for (Triggering unit)) + 1)
            Unit - Set level of Consume (Speed Effect) for (Triggering unit) to ((Level of Consume (Speed Effect) for (Triggering unit)) + 1)
          Else - Actions
    Set VariableSet AE_TmpReal[0] = (100.00 + (5.00 x (Real((Level of Consume (Speed Effect) for (Casting unit))))))
    Animation - Change (Casting unit)'s size to (AE_TmpReal[0]%, AE_TmpReal[0]%, AE_TmpReal[0]%) of its original size
    Unit Group - Add (Triggering unit) to KT_ConsumeGroup
KT Consume Loop
  Events
    Time - Every 1.00 seconds of game time
  Conditions
  Actions
    Unit Group - Pick every unit in KT_ConsumeGroup and do (Actions)
      Loop - Actions
        Set VariableSet AE_TmpReal[0] = (Load 0 of (Key (Picked unit).) from KT_PlagueHashtable.)
        Set VariableSet AE_TmpReal[0] = (AE_TmpReal[0] - 1)
        Hashtable - Save AE_TmpReal[0] as 0 of (Key (Picked unit).) in KT_PlagueHashtable.
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            AE_TmpReal[0] Less than or equal to 0.00
          Then - Actions
            Set VariableSet AE_TmpPoint[0] = (Position of (Picked unit))
            Special Effect - Create a special effect at AE_TmpPoint[0] using Objects\Spawnmodels\Human\HumanLargeDeathExplode\HumanLargeDeathExplode.mdl
            Special Effect - Destroy (Last created special effect)
            Animation - Change (Picked unit)'s size to (100.00%, 100.00%, 100.00%) of its original size
            Unit - Set level of Consume (Regen Effect) for (Picked unit) to 1
            Unit - Set level of Consume (Speed Effect) for (Picked unit) to 1
            Unit - Remove Consume (Regen Effect) from (Picked unit)
            Unit - Remove Consume (Speed Effect) from (Picked unit)
            Unit Group - Remove (Picked unit) from KT_ConsumeGroup.
            Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
          Else - Actions
KT Raze
  Events
    Unit - A unit Is attacked
  Conditions
    (Unit-type of (Attacking unit)) Equal to Bone Breaker
    ((Attacked unit) is A structure) Equal to True
    (Current research level of R00G (techcode) for (Owner of (Attacking unit))) Greater than 0
  Actions
    Set VariableSet AE_TmpPoint[0] = (Position of (Attacking unit))
    Unit - Create 1.Dummy for (Owner of (Attacking unit)) at AE_TmpPoint[0] facing Default building facing degrees
    Unit - Add Raze (Effect) to (Last created unit)
    Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
    Unit - Order (Last created unit) to Human Priest - Inner Fire.(Attacked unit)
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
KT Resilient Bones
  Events
    Game - GDD_Event becomes Equal to 0
  Conditions
    (Unit-type of GDD_DamagedUnit) Equal to Bone Breaker
    (Current research level of R004 (techcode) for (Owner of GDD_DamagedUnit)) Greater than 0
  Actions
    Unit - Set life of GDD_DamagedUnit to ((Life of GDD_DamagedUnit) + (GDD_Damage x 0.20))
KT Darkening Bolt
  Events
    Game - GDD_Event becomes Equal to 0
  Conditions
    (Unit-type of GDD_DamageSource) Equal to Sky Darkener
    (Current research level of R00H (techcode) for (Owner of GDD_DamageSource)) Greater than 0
  Actions
    Trigger - Turn off (This trigger)
    Set VariableSet AE_TmpPoint[0] = (Position of GDD_DamageSource)
    Set VariableSet AE_TmpPoint[1] = (Position of GDD_DamagedUnit)
    Set VariableSet AE_TmpReal[0] = ((Distance between AE_TmpPoint[0] and AE_TmpPoint[1]) x 0.07)
    Set VariableSet AE_TmpReal[1] = ((Distance between AE_TmpPoint[0] and AE_TmpPoint[1]) x 0.05)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Random integer number between 1 and 100) Less than or equal to (Integer(AE_TmpReal[1]))
      Then - Actions
        Unit - Set life of GDD_DamagedUnit to ((Life of GDD_DamagedUnit) + GDD_Damage)
        Floating Text - Create floating text that reads miss above GDD_DamagedUnit with Z offset 0, using font size 10, color (100%, 0.00%, 0.00%), and 0% transparency
        Floating Text - Hide (Last created floating text) for (All players)
        Floating Text - Show (Last created floating text) for (All allies of (Owner of GDD_DamageSource).)
        Floating Text - Show (Last created floating text) for (All allies of (Owner of GDD_DamagedUnit).)
        Floating Text - Set the velocity of (Last created floating text) to 64 towards 90 degrees
        Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
        Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
        Floating Text - Change (Last created floating text): Disable permanence
      Else - Actions
        Unit - Cause GDD_DamageSource to damage GDD_DamagedUnit, dealing AE_TmpReal[0] damage of attack type Pierce and damage type Normal
        Floating Text - Create floating text that reads ((String((Integer((GDD_Damage + AE_TmpReal[0]))))) + !) above GDD_DamagedUnit with Z offset 0, using font size 10, color (100%, 0.00%, 0.00%), and 0% transparency
        Floating Text - Hide (Last created floating text) for (All players)
        Floating Text - Show (Last created floating text) for (All allies of (Owner of GDD_DamageSource).)
        Floating Text - Show (Last created floating text) for (All allies of (Owner of GDD_DamagedUnit).)
        Floating Text - Set the velocity of (Last created floating text) to 64 towards 90 degrees
        Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
        Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
        Floating Text - Change (Last created floating text): Disable permanence
    Trigger - Turn on (This trigger)
KT Banishing Nova
  Events
    Unit - A unit Begins channeling an ability
  Conditions
    (Ability being cast) Equal to Banishing Nova
  Actions
    Set VariableSet AE_TmpPoint[0] = (Position of (Triggering unit))
    Set VariableSet AE_TmpPoint[1] = (Target point of ability being cast)
    Unit - Create 1.Banishing Nova for (Owner of (Triggering unit)) at AE_TmpPoint[0] facing (Angle from AE_TmpPoint[0] to AE_TmpPoint[1]) degrees
    Hashtable - Save Handle Of(Last created unit) as 0 of (Key (Casting unit).) in KT_BanishHashtable.
    Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
    Unit - Order (Last created unit) to Move To.AE_TmpPoint[1]
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
    Custom script: call RemoveLocation (udg_AE_TmpPoint[1])
KT Banishing Nova Cancel
  Events
    Unit - A unit Stops casting an ability
  Conditions
    (Ability being cast) Equal to Banishing Nova
  Actions
    Set VariableSet AE_TmpPoint[0] = (Position of (Load 0 of (Key (Triggering unit).) in KT_BanishHashtable.))
    Unit - Remove (Load 0 of (Key (Triggering unit).) in KT_BanishHashtable.) from the game
    Special Effect - Create a special effect at AE_TmpPoint[0] using Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl
    Special Effect - Destroy (Last created special effect)
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
KT Banishing Nova End
  Events
    Unit - A unit Dies
  Conditions
    (Unit-type of (Dying unit)) Equal to Banishing Nova
  Actions
    Set VariableSet AE_TmpPoint[0] = (Position of (Dying unit))
    Special Effect - Create a special effect at AE_TmpPoint[0] using war3mapImported\NecroticBlast.mdx
    Special Effect - Destroy (Last created special effect)
    Unit Group - Pick every unit in (Units within 160.00 of AE_TmpPoint[0] matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is A flying unit) Equal to False) and (((Matching unit) is Magic Immune) Equal to False)))).) and do (Actions)
      Loop - Actions
        Unit - Remove All buffs from (Picked unit)
        Set VariableSet AE_TmpPoint[1] = (Position of (Dying unit))
        Unit - Create 1.Dummy for (Owner of (Dying unit)) at AE_TmpPoint[1] facing Default building facing degrees
        Unit - Add Banishing Nova (Effect) to (Last created unit)
        Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
        Unit - Order (Last created unit) to Human Blood Mage - Banish.(Picked unit)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            ((Picked unit) is Summoned) Equal to True
          Then - Actions
            Unit - Cause (Dying unit) to damage (Picked unit), dealing 500 damage of attack type Spells and damage type Normal
          Else - Actions
        Custom script: call RemoveLocation (udg_AE_TmpPoint[1])
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
KT Absorption
  Events
    Game - GDD_Event becomes Equal to 0
  Conditions
    (Unit-type of GDD_DamagedUnit) Equal to Cold Wraith
  Actions
    Unit - Set mana of GDD_DamagedUnit to ((Mana of GDD_DamagedUnit) + (GDD_Damage x 0.20))
KT Cold Embrace
  Events
    Time - Every 1.00 seconds of game time
  Conditions
  Actions
    Custom script: set bj_wantDestroyGroup = true
    Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) has buff Cold Embrace) Equal to True))) and do (Actions)
      Loop - Actions
        Unit Group - Add (Picked unit) to KT_ColdEmbraceGroup
        Unit - Add Cold Embrace (Effect) to (Picked unit)
    Unit Group - Pick every unit in KT_ColdEmbraceGroup and do (Actions)
      Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            ((Picked unit) has buff Cold Embrace) Equal to False
          Then - Actions
            Unit Group - Remove (Picked unit) from KT_ColdEmbraceGroup.
            Unit - Remove Cold Embrace (Effect) from (Picked unit)
          Else - Actions
KT Frostguard
  Events
    Unit - A unit Starts the effect of an ability
  Conditions
    (Ability being cast) Equal to Cold Embrace
    (Current research level of R00B (techcode) for (Owner of (Triggering unit))) Greater than 0
  Actions
    Hashtable - Save 60.00 as 0 of (Key (Casting unit).) in KT_FrostguardHashtable.
    Unit - Increase level of Frostguard for (Casting unit)
    Unit Group - Add (Casting unit) to KT_FrostguardGroup
    Trigger - Turn on KT_Frostguard_Loop <gen>
KT Frostguard Loop
  Events
    Time - Every 1.00 seconds of game time
  Conditions
  Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Number of units in KT_FrostguardGroup) Greater than 0
      Then - Actions
        Unit Group - Pick every unit in KT_FrostguardGroup and do (Actions)
          Loop - Actions
            Set VariableSet AE_TmpReal[0] = (Load 0 of (Key (Picked unit).) from KT_FrostguardHashtable.)
            Set VariableSet AE_TmpReal[0] = (AE_TmpReal[0] - 1)
            Hashtable - Save AE_TmpReal[0] as 0 of (Key (Picked unit).) in KT_FrostguardHashtable.
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                AE_TmpReal[0] Less than or equal to 0.00
              Then - Actions
                Unit - Set level of Frostguard for (Picked unit) to 1
                Unit Group - Remove (Picked unit) from KT_FrostguardGroup.
              Else - Actions
      Else - Actions
        Trigger - Turn off (This trigger)
KT Necrotic Connection
  Events
    Unit - A unit Spawns a summoned unit
  Conditions
    (Unit-type of (Summoning unit)) Equal to Necrolyte
  Actions
    Unit Group - Add (Summoned unit) to KT_NecrolyteGroup[(Custom value of (Summoning unit))]
    Unit - Enable supply usage for (Summoned unit).
    Unit - Order (Summoned unit) to Neutral Sea Witch - Activate Frost Arrows.
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Unit-type of (Summoned unit)) Equal to Shambler
      Then - Actions
        Floating Text - Create floating text that reads |cffffcc00-75 above (Summoned unit) with Z offset 0, using font size 10, color (100%, 100%, 100%), and 0% transparency
        Floating Text - Hide (Last created floating text) for (All players)
        Floating Text - Show (Last created floating text) for (Player group((Owner of (Triggering unit))))
        Floating Text - Set the velocity of (Last created floating text) to 64 towards 90 degrees
        Floating Text - Change (Last created floating text): Disable permanence
        Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
        Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
      Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Unit-type of (Summoned unit)) Equal to Marksman
          Then - Actions
            Floating Text - Create floating text that reads |cffffcc00-100|cFF68D54D-20 above (Summoned unit) with Z offset 0, using font size 10, color (100%, 100%, 100%), and 0% transparency
            Floating Text - Hide (Last created floating text) for (All players)
            Floating Text - Show (Last created floating text) for (Player group((Owner of (Triggering unit))))
            Floating Text - Set the velocity of (Last created floating text) to 64 towards 90 degrees
            Floating Text - Change (Last created floating text): Disable permanence
            Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
            Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
          Else - Actions
            Floating Text - Create floating text that reads |cffffcc00-125|cFF68D54D-40 above (Summoned unit) with Z offset 0, using font size 10, color (100%, 100%, 100%), and 0% transparency
            Floating Text - Hide (Last created floating text) for (All players)
            Floating Text - Show (Last created floating text) for (Player group((Owner of (Triggering unit))))
            Floating Text - Set the velocity of (Last created floating text) to 64 towards 90 degrees
            Floating Text - Change (Last created floating text): Disable permanence
            Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
            Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
KT Necrotic Connection End
  Events
    Unit - A unit Dies
  Conditions
    (Unit-type of (Dying unit)) Equal to Necrolyte
  Actions
    Unit Group - Pick every unit in KT_NecrolyteGroup[(Custom value of (Dying unit))] and do (Actions)
      Loop - Actions
        Unit - Kill (Picked unit)
KT Raise Dead Stop
  Events
    Unit - A unit Begins casting an ability
  Conditions
    Or - Any (Conditions) are true
      Conditions
        (Ability being cast) Equal to Raise Marksman
        (Ability being cast) Equal to Raise Shambler
        (Ability being cast) Equal to Raise Bonecaster
  Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Ability being cast) Equal to Raise Shambler
      Then - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            ((Owner of (Casting unit)) Current gold) Less than 75
          Then - Actions
            Unit - Order (Casting unit) to Stop.
          Else - Actions
            Player - Add -75 to (Owner of (Triggering unit)).Current gold
      Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Ability being cast) Equal to Raise Marksman
          Then - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                ((Owner of (Casting unit)) Current gold) Less than 100
                ((Owner of (Casting unit)) Current lumber) Less than 20
              Then - Actions
                Unit - Order (Casting unit) to Stop.
              Else - Actions
                Player - Add -100 to (Owner of (Triggering unit)).Current gold
                Player - Add -20 to (Owner of (Triggering unit)).Current lumber
          Else - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                (Ability being cast) Equal to Raise Bonecaster
              Then - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  If - Conditions
                    ((Owner of (Casting unit)) Current gold) Less than 125
                    ((Owner of (Casting unit)) Current lumber) Less than 40
                  Then - Actions
                    Unit - Order (Casting unit) to Stop.
                  Else - Actions
                    Player - Add -125 to (Owner of (Triggering unit)).Current gold
                    Player - Add -40 to (Owner of (Triggering unit)).Current lumber
              Else - Actions
KT Food Requirement
  Events
    Time - Every 1.00 seconds of game time
  Conditions
  Actions
    Player Group - Pick every player in (All players) and do (Actions)
      Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            ((Picked player) Food used) Less than ((Picked player) Food cap)
          Then - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                KT_FoodRequirement[(Player number of (Picked player))] Equal to No unit
              Then - Actions
                Set VariableSet AE_TmpPoint[0] = ((Picked player) start location)
                Unit - Create 1.Available supply for (Picked player) at AE_TmpPoint[0] facing Default building facing degrees
                Set VariableSet KT_FoodRequirement[(Player number of (Picked player))] = (Last created unit)
                Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
              Else - Actions
          Else - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                KT_FoodRequirement[(Player number of (Picked player))] Not equal to No unit
              Then - Actions
                Unit - Remove KT_FoodRequirement[(Player number of (Picked player))] from the game
                Set VariableSet KT_FoodRequirement[(Player number of (Picked player))] = No unit
              Else - Actions
KT Gravekeeper Wards
  Events
    Unit - A unit Starts the effect of an ability
  Conditions
    Or - Any (Conditions) are true
      Conditions
        (Ability being cast) Equal to Blight Cauldron
        (Ability being cast) Equal to Summon Grave
        (Ability being cast) Equal to Unholy Orb
  Actions
    Set VariableSet AE_TmpPoint[0] = (Target point of ability being cast)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Ability being cast) Equal to Summon Grave
      Then - Actions
        Unit - Create 1.Grave for (Owner of (Triggering unit)) at AE_TmpPoint[0] facing Default building facing degrees
        Set VariableSet AE_TmpPoint[1] = (Position of (Last created unit))
        Special Effect - Create a special effect at AE_TmpPoint[1] using Abilities\Spells\Undead\RaiseSkeletonWarrior\RaiseSkeleton.mdl
        Special Effect - Destroy (Last created special effect)
        Unit - Add a 40.00 second Generic expiration timer to (Last created unit)
        Custom script: call RemoveLocation (udg_AE_TmpPoint[1])
      Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Ability being cast) Equal to Blight Cauldron
          Then - Actions
            Unit - Create 1.Blight Cauldron for (Owner of (Triggering unit)) at AE_TmpPoint[0] facing Default building facing degrees
            Set VariableSet AE_TmpPoint[1] = (Position of (Last created unit))
            Special Effect - Create a special effect at AE_TmpPoint[1] using Abilities\Spells\Undead\RaiseSkeletonWarrior\RaiseSkeleton.mdl
            Special Effect - Destroy (Last created special effect)
            Unit - Add a 30.00 second Generic expiration timer to (Last created unit)
            Custom script: call RemoveLocation (udg_AE_TmpPoint[1])
          Else - Actions
            Unit - Create 1.Unholy Orb for (Owner of (Triggering unit)) at AE_TmpPoint[0] facing Default building facing degrees
            Set VariableSet AE_TmpPoint[1] = (Position of (Last created unit))
            Special Effect - Create a special effect at AE_TmpPoint[1] using Objects\Spawnmodels\Undead\UDeathSmall\UDeathSmall.mdl
            Special Effect - Destroy (Last created special effect)
            Unit - Add a 30.00 second Generic expiration timer to (Last created unit)
            Custom script: call RemoveLocation (udg_AE_TmpPoint[1])
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
KT Gravekeeper Wards Death
  Events
    Unit - A unit Dies
  Conditions
    Or - Any (Conditions) are true
      Conditions
        (Unit-type of (Dying unit)) Equal to Grave
        (Unit-type of (Dying unit)) Equal to Blight Cauldron
        (Unit-type of (Dying unit)) Equal to Tree of Woe
  Actions
    Set VariableSet AE_TmpPoint[0] = (Position of (Dying unit))
    Special Effect - Create a special effect at AE_TmpPoint[0] using Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl
    Special Effect - Destroy (Last created special effect)
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
KT Blight Cauldron
  Events
    Time - Every 0.50 seconds of game time
  Conditions
  Actions
    Custom script: set bj_wantDestroyGroup = true
    Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) is alive) Equal to True) and (((Unit-type of (Matching unit)) Equal to Tree of Woe) or ((Unit-type of (Matching unit)) Equal to Blight Cauldron)))) and do (Actions)
      Loop - Actions
        Set VariableSet AE_TmpPoint[0] = (Position of (Picked unit))
        Set VariableSet AE_TmpPoint[1] = (AE_TmpPoint[0] offset by (Random real number between 0 and 300.00) towards (Random angle) degrees.)
        Environment - Create Blight for (Owner of (Picked unit)) from AE_TmpPoint[1] to a radius of 128.00.
        Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
        Custom script: call RemoveLocation (udg_AE_TmpPoint[1])
KT Unholy Orb
  Events
    Unit - A unit Starts the effect of an ability
  Conditions
    (Ability being cast) Equal to Unholy Orb (Ability)
  Actions
    Set VariableSet AE_TmpPoint[0] = (Position of (Triggering unit))
    Unit - Create 1.Dummy for (Owner of (Casting unit)) at AE_TmpPoint[0] facing Default building facing degrees
    Unit - Add Unholy Orb (Lightning) to (Last created unit)
    Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
    Unit - Order (Last created unit) to Special Archimonde - Finger Of Death.(Target unit of ability being cast)
    Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) + 50.00)
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
KT Spread Blight
  Events
    Time - Every 0.50 seconds of game time
  Conditions
  Actions
    Custom script: set bj_wantDestroyGroup = true
    Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) has buff Spread Blight) Equal to True))) and do (Actions)
      Loop - Actions
        Set VariableSet AE_TmpPoint[0] = (Position of (Picked unit))
        Environment - Create Blight for (Owner of (Picked unit)) from AE_TmpPoint[0] to a radius of 256.00.
        Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
KT Blinding Fog
  Events
    Unit - A unit Starts the effect of an ability
  Conditions
    (Ability being cast) Equal to Blinding Fog
  Actions
    Set VariableSet AE_TmpPoint[0] = (Target point of ability being cast)
    Unit - Create 1.Dummy for (Owner of (Casting unit)) at AE_TmpPoint[0] facing Default building facing degrees
    Unit - Add Blinding Fog (Effect) to (Last created unit)
    Unit - Order (Last created unit) to Human Dragonhawk Rider - Cloud.AE_TmpPoint[0]
    Unit - Add a 20.00 second Generic expiration timer to (Last created unit)
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
KT Fade
  Events
    Unit - A unit Is issued an order with no target
  Conditions
    (Issued order) Equal to (Order(immolation))
    (Unit-type of (Triggering unit)) Equal to Shadewyrm
  Actions
    Unit - Add Fade (Effect) to (Triggering unit)
    Unit Group - Add (Triggering unit) to KT_FadeGroup
    Trigger - Turn on KT_Fade_Loop <gen>
KT Fade Loop
  Events
    Time - Every 0.50 seconds of game time
  Conditions
  Actions
    Unit Group - Pick every unit in KT_FadeGroup and do (Actions)
      Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            ((Picked unit) has buff Fade) Equal to False
          Then - Actions
            Unit Group - Remove (Picked unit) from KT_FadeGroup.
            Unit - Remove Fade (Effect) from (Picked unit)
          Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Number of units in KT_FadeGroup) Equal to 0
      Then - Actions
        Trigger - Turn off (This trigger)
      Else - Actions
KT Fade Mana
  Events
    Game - GDD_Event becomes Equal to 0
  Conditions
    (GDD_DamageSource has buff Fade) Equal to True
  Actions
    Unit - Set mana of GDD_DamageSource to ((Mana of GDD_DamageSource) - (GDD_Damage x 0.10))
KT Necrolytes Dagger
  Events
    Unit - A unit Starts the effect of an ability
  Conditions
    (Ability being cast) Equal to Necrolyte's Dagger
  Actions
    Unit - Kill (Target unit of ability being cast)
    Set VariableSet AE_TmpPoint[0] = (Position of (Target unit of ability being cast))
    Custom script: set bj_wantDestroyGroup = true
    Unit Group - Pick every unit in (Units within 500.00 of AE_TmpPoint[0] matching (((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((Max mana of (Matching unit)) Greater than 0.00))) and (((Matching unit) belongs to an ally of (Owner of (Casting unit)).) Equal to True)).) and do (Actions)
      Loop - Actions
        Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) + 75.00)
        Special Effect - Create a special effect attached to the origin (attachpoint) of (Picked unit) using Abilities\Spells\Items\AIma\AImaTarget.mdl
        Special Effect - Destroy (Last created special effect)
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
KT Orb of Reanimation
  Events
    Unit - A unit Is attacked
  Conditions
    ((Attacking unit) has (Item carried by (Attacking unit) of type Orb of Reanimation)) Equal to True
  Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Random integer number between 1 and 100) Less than or equal to 22
      Then - Actions
        Set VariableSet AE_TmpPoint[0] = (Position of (Attacking unit))
        Unit - Create 1.Dummy for (Owner of (Attacking unit)) at AE_TmpPoint[0] facing Default building facing degrees
        Unit - Add Orb of Reanimation (Effect) to (Last created unit)
        Unit - Order (Last created unit) to Neutral - Animate Dead.
        Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
        Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
      Else - Actions
KT Cultist Rally
  Events
    Unit - A unit Finishes training a unit
  Conditions
    (Trained unit-type) Equal to Cultist
    (Rally-Point of (Triggering unit) as a unit) Not equal to No unit
  Actions
    Trigger - Turn off (This trigger)
    Unit - Order (Trained unit) to Right-Click.(Rally-Point of (Triggering unit) as a unit)
    Trigger - Turn on (This trigger)
KT Channel Order
  Events
    Unit - A unit Is issued an order targeting an object
  Conditions
    (Issued order) Equal to (Order(smart))
    (Level of Blight Dispel Small for (Target unit of issued order)) Equal to 0
    (Unit-type of (Ordered unit)) Equal to Cultist
    Or - Any (Conditions) are true
      Conditions
        (Unit-type of (Target unit of issued order)) Equal to Catacomb
        (Unit-type of (Target unit of issued order)) Equal to Altar of the Archlich
        (Unit-type of (Target unit of issued order)) Equal to Frost Spire
  Actions
    Unit - Order (Ordered unit) to Neutral - Firebolt.(Target unit of issued order)
KT Channel Dredge
  Events
    Unit - A unit Starts the effect of an ability
  Conditions
    (Ability being cast) Equal to Channel (Necrolyte)
    (Unit-type of (Target unit of ability being cast)) Equal to Catacomb
  Actions
    Unit - Remove classification of A peon-type unit from (Casting unit)
    Set VariableSet AE_TmpUnit[0] = (Casting unit)
    Set VariableSet KT_DockTarget[(Custom value of (Casting unit))] = (Target unit of ability being cast)
    Set VariableSet AE_TmpInteger[0] = (Custom value of (Target unit of ability being cast))
    Set VariableSet AE_TmpPoint[0] = (Position of (Target unit of ability being cast))
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        KT_DockedUnit1[AE_TmpInteger[0]] Equal to No unit
      Then - Actions
        Set VariableSet KT_DockedUnit1[AE_TmpInteger[0]] = (Casting unit)
        Set VariableSet AE_TmpPoint[1] = (AE_TmpPoint[0] offset by 160.00 towards 90.00 degrees.)
      Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            KT_DockedUnit2[AE_TmpInteger[0]] Equal to No unit
          Then - Actions
            Set VariableSet KT_DockedUnit2[AE_TmpInteger[0]] = (Casting unit)
            Set VariableSet AE_TmpPoint[1] = (AE_TmpPoint[0] offset by 160.00 towards 215.00 degrees.)
          Else - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                KT_DockedUnit3[AE_TmpInteger[0]] Equal to No unit
              Then - Actions
                Set VariableSet KT_DockedUnit3[AE_TmpInteger[0]] = (Casting unit)
                Set VariableSet AE_TmpPoint[1] = (AE_TmpPoint[0] offset by 180.00 towards 330.00 degrees.)
              Else - Actions
                Set VariableSet KT_DockTarget[(Custom value of (Casting unit))] = No unit
                Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
                Skip remaining actions
    Set VariableSet AE_TmpPoint[2] = (AE_TmpPoint[0] offset by 200.00 towards 270.00 degrees.)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        KT_DockedUnit1[AE_TmpInteger[0]] Equal to (Casting unit)
      Then - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Number of units in KT_DredgeGroup1[AE_TmpInteger[0]]) Less than 2
          Then - Actions
            Unit Group - Pick every unit in KT_DredgeGroup1[AE_TmpInteger[0]] and do (Kill (Picked unit))
            For each (Integer A) from 1 to 2, do (Actions)
              Loop - Actions
                Unit - Create 1.Dredge for (Owner of (Casting unit)) at AE_TmpPoint[2] facing Default building facing degrees
                Unit - Add a 30.00 second Generic expiration timer to (Last created unit)
                Unit - Pause the expiration timer for (Last created unit).
                Set VariableSet AE_TmpPoint[3] = (Position of (Last created unit))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  If - Conditions
                    (Rally-Point of KT_DockTarget[(Custom value of AE_TmpUnit[0])] as a unit) Not equal to No unit
                  Then - Actions
                    Unit - Order (Last created unit) to Right-Click.(Rally-Point of KT_DockTarget[(Custom value of AE_TmpUnit[0])] as a unit)
                  Else - Actions
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      If - Conditions
                        (Rally-Point of KT_DockTarget[(Custom value of AE_TmpUnit[0])] as a destructible) Not equal to No destructible
                      Then - Actions
                        Unit - Order (Last created unit) to Right-Click.(Rally-Point of KT_DockTarget[(Custom value of AE_TmpUnit[0])] as a destructible)
                      Else - Actions
                        Unit - Order (Last created unit) to Move To.(Rally-Point of KT_DockTarget[(Custom value of AE_TmpUnit[0])] as a point)
                Unit Group - Add (Last created unit) to KT_DredgeGroup1[AE_TmpInteger[0]]
                Animation - Play (Last created unit)'s birth (animationname) animation
                Animation - Queue (Last created unit)'s stand (animationname) animation
                Special Effect - Create a special effect at AE_TmpPoint[3] using Abilities\Spells\Undead\RaiseSkeletonWarrior\RaiseSkeleton.mdl
                Special Effect - Destroy (Last created special effect)
                Custom script: call RemoveLocation (udg_AE_TmpPoint[3])
          Else - Actions
            Unit Group - Pick every unit in KT_DredgeGroup1[AE_TmpInteger[0]] and do (Pause the expiration timer for (Picked unit).)
      Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            KT_DockedUnit2[AE_TmpInteger[0]] Equal to (Casting unit)
          Then - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                (Number of units in KT_DredgeGroup2[AE_TmpInteger[0]]) Less than 2
              Then - Actions
                Unit Group - Pick every unit in KT_DredgeGroup2[AE_TmpInteger[0]] and do (Kill (Picked unit))
                For each (Integer A) from 1 to 2, do (Actions)
                  Loop - Actions
                    Unit - Create 1.Dredge for (Owner of (Casting unit)) at AE_TmpPoint[2] facing Default building facing degrees
                    Unit - Add a 30.00 second Generic expiration timer to (Last created unit)
                    Unit - Pause the expiration timer for (Last created unit).
                    Set VariableSet AE_TmpPoint[3] = (Position of (Last created unit))
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      If - Conditions
                        (Rally-Point of KT_DockTarget[(Custom value of AE_TmpUnit[0])] as a unit) Not equal to No unit
                      Then - Actions
                        Unit - Order (Last created unit) to Right-Click.(Rally-Point of KT_DockTarget[(Custom value of AE_TmpUnit[0])] as a unit)
                      Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          If - Conditions
                            (Rally-Point of KT_DockTarget[(Custom value of AE_TmpUnit[0])] as a destructible) Not equal to No destructible
                          Then - Actions
                            Unit - Order (Last created unit) to Right-Click.(Rally-Point of KT_DockTarget[(Custom value of AE_TmpUnit[0])] as a destructible)
                          Else - Actions
                            Unit - Order (Last created unit) to Move To.(Rally-Point of KT_DockTarget[(Custom value of AE_TmpUnit[0])] as a point)
                    Unit Group - Add (Last created unit) to KT_DredgeGroup2[AE_TmpInteger[0]]
                    Animation - Play (Last created unit)'s birth (animationname) animation
                    Animation - Queue (Last created unit)'s stand (animationname) animation
                    Special Effect - Create a special effect at AE_TmpPoint[3] using Abilities\Spells\Undead\RaiseSkeletonWarrior\RaiseSkeleton.mdl
                    Special Effect - Destroy (Last created special effect)
                    Custom script: call RemoveLocation (udg_AE_TmpPoint[3])
              Else - Actions
                Unit Group - Pick every unit in KT_DredgeGroup2[AE_TmpInteger[0]] and do (Pause the expiration timer for (Picked unit).)
          Else - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                KT_DockedUnit3[AE_TmpInteger[0]] Equal to (Casting unit)
              Then - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  If - Conditions
                    (Number of units in KT_DredgeGroup3[AE_TmpInteger[0]]) Less than 2
                  Then - Actions
                    Unit Group - Pick every unit in KT_DredgeGroup3[AE_TmpInteger[0]] and do (Kill (Picked unit))
                    For each (Integer A) from 1 to 2, do (Actions)
                      Loop - Actions
                        Unit - Create 1.Dredge for (Owner of (Casting unit)) at AE_TmpPoint[2] facing Default building facing degrees
                        Unit - Add a 30.00 second Generic expiration timer to (Last created unit)
                        Unit - Pause the expiration timer for (Last created unit).
                        Set VariableSet AE_TmpPoint[3] = (Position of (Last created unit))
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          If - Conditions
                            (Rally-Point of KT_DockTarget[(Custom value of AE_TmpUnit[0])] as a unit) Not equal to No unit
                          Then - Actions
                            Unit - Order (Last created unit) to Right-Click.(Rally-Point of KT_DockTarget[(Custom value of AE_TmpUnit[0])] as a unit)
                          Else - Actions
                            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                              If - Conditions
                                (Rally-Point of KT_DockTarget[(Custom value of AE_TmpUnit[0])] as a destructible) Not equal to No destructible
                              Then - Actions
                                Unit - Order (Last created unit) to Right-Click.(Rally-Point of KT_DockTarget[(Custom value of AE_TmpUnit[0])] as a destructible)
                              Else - Actions
                                Unit - Order (Last created unit) to Move To.(Rally-Point of KT_DockTarget[(Custom value of AE_TmpUnit[0])] as a point)
                        Unit Group - Add (Last created unit) to KT_DredgeGroup3[AE_TmpInteger[0]]
                        Animation - Play (Last created unit)'s birth (animationname) animation
                        Animation - Queue (Last created unit)'s stand (animationname) animation
                        Special Effect - Create a special effect at AE_TmpPoint[3] using Abilities\Spells\Undead\RaiseSkeletonWarrior\RaiseSkeleton.mdl
                        Special Effect - Destroy (Last created special effect)
                        Custom script: call RemoveLocation (udg_AE_TmpPoint[3])
                  Else - Actions
                    Unit Group - Pick every unit in KT_DredgeGroup3[AE_TmpInteger[0]] and do (Pause the expiration timer for (Picked unit).)
              Else - Actions
    Unit - Add Ghost (Visible) to (Casting unit)
    Custom script: call SetUnitX(udg_AE_TmpUnit[0],GetLocationX(udg_AE_TmpPoint[1]))
    Custom script: call SetUnitY(udg_AE_TmpUnit[0],GetLocationY(udg_AE_TmpPoint[1]))
    Unit - Make (Casting unit) face AE_TmpPoint[0] over 0.10 seconds
    Unit - Order (Casting unit) to Hold Position.
    Animation - Add the work (animationname) animation tag to (Casting unit)
    Unit Group - Add (Casting unit) to KT_DockGroup[AE_TmpInteger[0]]
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
    Custom script: call RemoveLocation (udg_AE_TmpPoint[1])
    Custom script: call RemoveLocation (udg_AE_TmpPoint[2])
KT Channel Dredge Death
  Events
    Unit - A unit Dies
  Conditions
    (Unit-type of (Dying unit)) Equal to Dredge
  Actions
    For each (Integer B) from 1 to 1000, do (Actions)
      Loop - Actions
        Unit Group - Remove (Dying unit) from KT_DredgeGroup1[(Integer B)].
        Unit Group - Remove (Dying unit) from KT_DredgeGroup2[(Integer B)].
        Unit Group - Remove (Dying unit) from KT_DredgeGroup3[(Integer B)].
KT Channel Cancel
  Events
    Unit - A unit Is issued an order targeting an object
    Unit - A unit Is issued an order targeting a point
    Unit - A unit Is issued an order with no target
    Unit - A unit Dies
  Conditions
    Or - Any (Conditions) are true
      Conditions
        (Issued order) Not equal to (Order(firebolt))
        (Unit-type of (Dying unit)) Equal to Cultist
    KT_DockTarget[(Custom value of (Triggering unit))] Not equal to No unit
    (Unit-type of (Triggering unit)) Equal to Cultist
  Actions
    Unit - Add classification of A peon-type unit to (Triggering unit)
    Set VariableSet AE_TmpUnit[0] = KT_DockTarget[(Custom value of (Triggering unit))]
    Set VariableSet AE_TmpUnit[1] = AE_TmpUnit[0]
    Set VariableSet AE_TmpInteger[0] = (Custom value of AE_TmpUnit[0])
    Unit - Remove Ghost (Visible) from (Triggering unit)
    Animation - Remove the work (animationname) animation tag to (Triggering unit)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        ((Triggering unit) is in KT_DockGroup[AE_TmpInteger[0]].) Equal to True
      Then - Actions
        Unit Group - Remove (Triggering unit) from KT_DockGroup[AE_TmpInteger[0]].
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            KT_DockedUnit1[AE_TmpInteger[0]] Equal to (Triggering unit)
          Then - Actions
            Set VariableSet KT_DockedUnit1[AE_TmpInteger[0]] = No unit
            Unit Group - Pick every unit in KT_DredgeGroup1[AE_TmpInteger[0]] and do (Actions)
              Loop - Actions
                Unit - Unpause the expiration timer for (Picked unit).
          Else - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                KT_DockedUnit2[AE_TmpInteger[0]] Equal to (Triggering unit)
              Then - Actions
                Set VariableSet KT_DockedUnit2[AE_TmpInteger[0]] = No unit
                Unit Group - Pick every unit in KT_DredgeGroup2[AE_TmpInteger[0]] and do (Actions)
                  Loop - Actions
                    Unit - Unpause the expiration timer for (Picked unit).
              Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  If - Conditions
                    KT_DockedUnit3[AE_TmpInteger[0]] Equal to (Triggering unit)
                  Then - Actions
                    Set VariableSet KT_DockedUnit3[AE_TmpInteger[0]] = No unit
                    Unit Group - Pick every unit in KT_DredgeGroup3[AE_TmpInteger[0]] and do (Actions)
                      Loop - Actions
                        Unit - Unpause the expiration timer for (Picked unit).
                  Else - Actions
      Else - Actions
    Unit - Remove Channeling Frost buff from AE_TmpUnit[1]
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Number of units in KT_DockGroup[AE_TmpInteger[0]]) Equal to 0
      Then - Actions
        Unit - Set level of Channeling Frost for AE_TmpUnit[1] to 1
        Animation - Remove the work (animationname) animation tag to AE_TmpUnit[1]
        Animation - Remove the work (animationname) animation tag to AE_TmpUnit[1]
        Animation - Remove the work upgrade first (animationname) animation tag to AE_TmpUnit[1]
        Animation - Remove the work upgrade second (animationname) animation tag to AE_TmpUnit[1]
      Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Number of units in KT_DockGroup[AE_TmpInteger[0]]) Equal to 1
          Then - Actions
            Unit - Set level of Channeling Frost for AE_TmpUnit[1] to 2
            Animation - Remove the work upgrade first (animationname) animation tag to AE_TmpUnit[1]
            Animation - Remove the work upgrade second (animationname) animation tag to AE_TmpUnit[1]
            Animation - Add the work (animationname) animation tag to AE_TmpUnit[1]
          Else - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                (Number of units in KT_DockGroup[AE_TmpInteger[0]]) Equal to 2
              Then - Actions
                Unit - Set level of Channeling Frost for AE_TmpUnit[1] to 3
                Animation - Remove the work (animationname) animation tag to AE_TmpUnit[1]
                Animation - Remove the work upgrade second (animationname) animation tag to AE_TmpUnit[1]
                Animation - Add the work upgrade first (animationname) animation tag to AE_TmpUnit[1]
              Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  If - Conditions
                    (Number of units in KT_DockGroup[AE_TmpInteger[0]]) Greater than or equal to 3
                  Then - Actions
                    Unit - Set level of Channeling Frost for AE_TmpUnit[1] to 4
                    Animation - Remove the work (animationname) animation tag to AE_TmpUnit[1]
                    Animation - Remove the work upgrade first (animationname) animation tag to AE_TmpUnit[1]
                    Animation - Add the work upgrade second (animationname) animation tag to AE_TmpUnit[1]
                  Else - Actions
KT Channel Death
  Events
    Unit - A unit Dies
  Conditions
    Or - Any (Conditions) are true
      Conditions
        (Unit-type of (Dying unit)) Equal to Necrolyte
        (Unit-type of (Dying unit)) Equal to Altar of the Archlich
        (Unit-type of (Dying unit)) Equal to Catacomb
  Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Unit-type of (Dying unit)) Equal to Necrolyte
        KT_DockTarget[(Custom value of (Dying unit))] Not equal to No unit
      Then - Actions
        Set VariableSet AE_TmpUnit[0] = KT_DockTarget[(Custom value of (Dying unit))]
        Set VariableSet AE_TmpInteger[0] = (Custom value of AE_TmpUnit[0])
        Unit - Remove Ghost (Visible) from (Dying unit)
        Unit Group - Pick every unit in KT_DredgeGroup1[(Custom value of (Dying unit))] and do (Actions)
          Loop - Actions
            Unit - Kill (Picked unit)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            ((Dying unit) is in KT_DockGroup[AE_TmpInteger[0]].) Equal to True
          Then - Actions
            Unit Group - Remove (Dying unit) from KT_DockGroup[AE_TmpInteger[0]].
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                KT_DockedUnit1[AE_TmpInteger[0]] Equal to (Dying unit)
              Then - Actions
                Set VariableSet KT_DockedUnit1[AE_TmpInteger[0]] = No unit
              Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  If - Conditions
                    KT_DockedUnit2[AE_TmpInteger[0]] Equal to (Dying unit)
                  Then - Actions
                    Set VariableSet KT_DockedUnit2[AE_TmpInteger[0]] = No unit
                  Else - Actions
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      If - Conditions
                        KT_DockedUnit3[AE_TmpInteger[0]] Equal to (Dying unit)
                      Then - Actions
                        Set VariableSet KT_DockedUnit3[AE_TmpInteger[0]] = No unit
                      Else - Actions
          Else - Actions
      Else - Actions
        Unit Group - Pick every unit in KT_DockGroup[(Custom value of (Dying unit))] and do (Actions)
          Loop - Actions
            Unit - Order (Picked unit) to Stop.
KT Channel Ressurection
  Events
    Unit - A unit Starts the effect of an ability
  Conditions
    (Ability being cast) Equal to Channel (Necrolyte)
    (Unit-type of (Target unit of ability being cast)) Equal to Altar of the Archlich
  Actions
    Set VariableSet AE_TmpUnit[0] = (Casting unit)
    Set VariableSet KT_DockTarget[(Custom value of (Casting unit))] = (Target unit of ability being cast)
    Set VariableSet AE_TmpInteger[0] = (Custom value of (Target unit of ability being cast))
    Set VariableSet AE_TmpPoint[0] = (Position of (Target unit of ability being cast))
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        KT_DockedUnit1[AE_TmpInteger[0]] Equal to No unit
      Then - Actions
        Set VariableSet KT_DockedUnit1[AE_TmpInteger[0]] = (Casting unit)
        Set VariableSet AE_TmpPoint[1] = (AE_TmpPoint[0] offset by 180.00 towards 90.00 degrees.)
      Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            KT_DockedUnit2[AE_TmpInteger[0]] Equal to No unit
          Then - Actions
            Set VariableSet KT_DockedUnit2[AE_TmpInteger[0]] = (Casting unit)
            Set VariableSet AE_TmpPoint[1] = (AE_TmpPoint[0] offset by 180.00 towards 215.00 degrees.)
          Else - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                KT_DockedUnit3[AE_TmpInteger[0]] Equal to No unit
              Then - Actions
                Set VariableSet KT_DockedUnit3[AE_TmpInteger[0]] = (Casting unit)
                Set VariableSet AE_TmpPoint[1] = (AE_TmpPoint[0] offset by 200.00 towards 330.00 degrees.)
              Else - Actions
                Set VariableSet KT_DockTarget[(Custom value of (Casting unit))] = No unit
                Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
                Skip remaining actions
    Set VariableSet AE_TmpPoint[2] = (AE_TmpPoint[0] offset by 200.00 towards 270.00 degrees.)
    Unit - Add Ghost (Visible) to (Casting unit)
    Custom script: call SetUnitX(udg_AE_TmpUnit[0],GetLocationX(udg_AE_TmpPoint[1]))
    Custom script: call SetUnitY(udg_AE_TmpUnit[0],GetLocationY(udg_AE_TmpPoint[1]))
    Unit - Make (Casting unit) face AE_TmpPoint[0] over 0.10 seconds
    Unit - Order (Casting unit) to Hold Position.
    Animation - Add the work (animationname) animation tag to (Casting unit)
    Unit Group - Add (Casting unit) to KT_DockGroup[AE_TmpInteger[0]]
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Number of units in KT_DockGroup[AE_TmpInteger[0]]) Greater than or equal to 3
        (KT_KelThuzadTarget[(Player number of (Owner of AE_TmpUnit[0]))] is dead) Equal to True
      Then - Actions
        Unit Group - Pick every unit in KT_DockGroup[AE_TmpInteger[0]] and do (Actions)
          Loop - Actions
            Set VariableSet AE_TmpPoint[3] = (Position of (Picked unit))
            Unit - Kill (Picked unit)
            Special Effect - Create a special effect at AE_TmpPoint[3] using Objects\Spawnmodels\Undead\UndeadDissipate\UndeadDissipate.mdl
            Special Effect - Destroy (Last created special effect)
            Custom script: call RemoveLocation (udg_AE_TmpPoint[3])
        Set VariableSet KT_KelThuzadResurrection[(Player number of (Owner of AE_TmpUnit[0]))] = (KT_KelThuzadResurrection[(Player number of (Owner of AE_TmpUnit[0]))] - 20.00)
      Else - Actions
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
    Custom script: call RemoveLocation (udg_AE_TmpPoint[1])
    Custom script: call RemoveLocation (udg_AE_TmpPoint[2])
KT Channel Frost Spire
  Events
    Unit - A unit Starts the effect of an ability
  Conditions
    (Ability being cast) Equal to Channel (Necrolyte)
    (Unit-type of (Target unit of ability being cast)) Equal to Frost Spire
  Actions
    Set VariableSet AE_TmpUnit[0] = (Casting unit)
    Set VariableSet AE_TmpUnit[1] = (Target unit of ability being cast)
    Set VariableSet KT_DockTarget[(Custom value of (Casting unit))] = (Target unit of ability being cast)
    Set VariableSet AE_TmpInteger[0] = (Custom value of (Target unit of ability being cast))
    Set VariableSet AE_TmpPoint[0] = (Position of (Target unit of ability being cast))
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        KT_DockedUnit1[AE_TmpInteger[0]] Equal to No unit
      Then - Actions
        Set VariableSet KT_DockedUnit1[AE_TmpInteger[0]] = (Casting unit)
        Set VariableSet AE_TmpPoint[1] = (AE_TmpPoint[0] offset by 180.00 towards 90.00 degrees.)
      Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            KT_DockedUnit2[AE_TmpInteger[0]] Equal to No unit
          Then - Actions
            Set VariableSet KT_DockedUnit2[AE_TmpInteger[0]] = (Casting unit)
            Set VariableSet AE_TmpPoint[1] = (AE_TmpPoint[0] offset by 180.00 towards 215.00 degrees.)
          Else - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                KT_DockedUnit3[AE_TmpInteger[0]] Equal to No unit
              Then - Actions
                Set VariableSet KT_DockedUnit3[AE_TmpInteger[0]] = (Casting unit)
                Set VariableSet AE_TmpPoint[1] = (AE_TmpPoint[0] offset by 200.00 towards 330.00 degrees.)
              Else - Actions
                Set VariableSet KT_DockTarget[(Custom value of (Casting unit))] = No unit
                Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
                Skip remaining actions
    Set VariableSet AE_TmpPoint[2] = (AE_TmpPoint[0] offset by 200.00 towards 270.00 degrees.)
    Unit - Add Ghost (Visible) to (Casting unit)
    Custom script: call SetUnitX(udg_AE_TmpUnit[0],GetLocationX(udg_AE_TmpPoint[1]))
    Custom script: call SetUnitY(udg_AE_TmpUnit[0],GetLocationY(udg_AE_TmpPoint[1]))
    Unit - Make (Casting unit) face AE_TmpPoint[0] over 0.10 seconds
    Unit - Order (Casting unit) to Hold Position.
    Animation - Add the work (animationname) animation tag to (Casting unit)
    Unit Group - Add (Casting unit) to KT_DockGroup[AE_TmpInteger[0]]
    Special Effect - Create a special effect at AE_TmpPoint[0] using Abilities\Spells\Undead\FrostNova\FrostNovaTarget.mdl
    Special Effect - Destroy (Last created special effect)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Number of units in KT_DockGroup[AE_TmpInteger[0]]) Equal to 0
      Then - Actions
        Unit - Set level of Channeling Frost for AE_TmpUnit[1] to 1
        Animation - Remove the work (animationname) animation tag to AE_TmpUnit[1]
        Animation - Remove the work upgrade first (animationname) animation tag to AE_TmpUnit[1]
        Animation - Remove the work upgrade second (animationname) animation tag to AE_TmpUnit[1]
      Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Number of units in KT_DockGroup[AE_TmpInteger[0]]) Equal to 1
          Then - Actions
            Unit - Set level of Channeling Frost for AE_TmpUnit[1] to 2
            Animation - Remove the work upgrade first (animationname) animation tag to AE_TmpUnit[1]
            Animation - Remove the work upgrade second (animationname) animation tag to AE_TmpUnit[1]
            Animation - Add the work (animationname) animation tag to AE_TmpUnit[1]
          Else - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                (Number of units in KT_DockGroup[AE_TmpInteger[0]]) Equal to 2
              Then - Actions
                Unit - Set level of Channeling Frost for AE_TmpUnit[1] to 3
                Animation - Remove the work (animationname) animation tag to AE_TmpUnit[1]
                Animation - Remove the work upgrade second (animationname) animation tag to AE_TmpUnit[1]
                Animation - Add the work upgrade first (animationname) animation tag to AE_TmpUnit[1]
              Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  If - Conditions
                    (Number of units in KT_DockGroup[AE_TmpInteger[0]]) Greater than or equal to 3
                  Then - Actions
                    Unit - Set level of Channeling Frost for AE_TmpUnit[1] to 4
                    Animation - Remove the work (animationname) animation tag to AE_TmpUnit[1]
                    Animation - Remove the work upgrade first (animationname) animation tag to AE_TmpUnit[1]
                    Animation - Add the work upgrade second (animationname) animation tag to AE_TmpUnit[1]
                  Else - Actions
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
    Custom script: call RemoveLocation (udg_AE_TmpPoint[1])
    Custom script: call RemoveLocation (udg_AE_TmpPoint[2])
KT Resurrection Loop
  Events
    Time - Every 0.25 seconds of game time
  Conditions
  Actions
    Custom script: set bj_wantDestroyGroup = true
    Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) is alive) Equal to True) and ((Unit-type of (Matching unit)) Equal to Altar of the Archlich))) and do (Actions)
      Loop - Actions
        Set VariableSet AE_TmpInteger[0] = (Custom value of (Picked unit))
        Set VariableSet AE_TmpInteger[1] = (Player number of (Owner of (Picked unit)))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            KT_KelThuzadResurrection[AE_TmpInteger[1]] Greater than 0.00
          Then - Actions
            Set VariableSet KT_KelThuzadResurrection[AE_TmpInteger[1]] = (KT_KelThuzadResurrection[AE_TmpInteger[1]] - 0.25)
          Else - Actions
            Set VariableSet AE_TmpPoint[0] = (Position of (Picked unit))
            Set VariableSet AE_TmpPoint[1] = (AE_TmpPoint[0] offset by 200.00 towards 270.00 degrees.)
            Hero - Instantly revive KT_KelThuzadTarget[(Player number of (Owner of (Picked unit)))] at AE_TmpPoint[1], Show revival graphics
            Unit - Kill KT_KelThuzadDummy[(Player number of (Owner of (Picked unit)))]
            Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
            Custom script: call RemoveLocation (udg_AE_TmpPoint[1])
KT KelThuzad Death
  Events
    Unit - A unit Dies
  Conditions
    (Unit-type of (Dying unit)) Equal to Archlich
  Actions
    Custom script: set bj_wantDestroyGroup = true
    Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) is alive) Equal to True) and ((Unit-type of (Matching unit)) Equal to Altar of the Archlich))) and do (Actions)
      Loop - Actions
        Set VariableSet AE_TmpInteger[0] = (Player number of (Owner of (Picked unit)))
        Set VariableSet AE_TmpPoint[0] = (Position of (Picked unit))
        Unit - Create 1.Kel'Thuzad (Resurrecting) for (Owner of (Dying unit)) at AE_TmpPoint[0] facing 225.00 degrees
        Animation - Change (Last created unit)'s vertex coloring to (100%, 100%, 100%) with 50.00% transparency
        Set VariableSet KT_KelThuzadDummy[AE_TmpInteger[0]] = (Last created unit)
        Set VariableSet KT_KelThuzadTarget[AE_TmpInteger[0]] = (Dying unit)
        Set VariableSet KT_KelThuzadResurrection[AE_TmpInteger[0]] = (50.00 + (10.00 x (Real((Level of (Dying unit))))))
        Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
KT Cold Dark Mastery
  Events
    Unit - A unit Dies
  Conditions
    ((Dying unit) belongs to an enemy of (Owner of (Killing unit)).) Equal to True
  Actions
    Set VariableSet AE_TmpPoint[0] = (Position of (Dying unit))
    Set VariableSet AE_TmpGroup[0] = (Units within 1500.00 of AE_TmpPoint[0] matching (((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of (Dying unit)).) Equal to True)) and ((Unit-type of (Matching unit)) Equal to Archlich)).)
    Unit Group - Pick every unit in AE_TmpGroup[0] and do (Actions)
      Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Level of Master of the Cold Dark for (Picked unit)) Less than 11
          Then - Actions
            Unit - Set level of Master of the Cold Dark for (Picked unit) to ((Level of Master of the Cold Dark for (Picked unit)) + 1)
          Else - Actions
        Set VariableSet AE_TmpReal[0] = (Load 0 of (Key (Picked unit).) from KT_ColdDarkHashtable.)
        Set VariableSet AE_TmpReal[0] = (AE_TmpReal[0] + 0.10)
        Hashtable - Save AE_TmpReal[0] as 0 of (Key (Picked unit).) in KT_ColdDarkHashtable.
        Hashtable - Save 30.00 as 1 of (Key (Picked unit).) in KT_ColdDarkHashtable.
        Unit Group - Add (Picked unit) to KT_ColdDarkGroup
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
    Trigger - Turn on KT_Cold_Dark_Mastery_Loop <gen>
KT Cold Dark Mastery Loop
  Events
    Time - Every 0.25 seconds of game time
  Conditions
  Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Number of units in KT_ColdDarkGroup) Greater than 0
      Then - Actions
        Unit Group - Pick every unit in KT_ColdDarkGroup and do (Actions)
          Loop - Actions
            Set VariableSet AE_TmpReal[0] = (Load 1 of (Key (Picked unit).) from KT_ColdDarkHashtable.)
            Set VariableSet AE_TmpReal[0] = (AE_TmpReal[0] - 0.25)
            Hashtable - Save AE_TmpReal[0] as 1 of (Key (Picked unit).) in KT_ColdDarkHashtable.
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                AE_TmpReal[0] Less than or equal to 0.00
              Then - Actions
                Hashtable - Save 0.00 as 0 of (Key (Picked unit).) in KT_ColdDarkHashtable.
                Hashtable - Save 0.00 as 1 of (Key (Picked unit).) in KT_ColdDarkHashtable.
                Unit - Set level of Master of the Cold Dark for (Picked unit) to 1
                Unit Group - Remove (Picked unit) from KT_ColdDarkGroup.
              Else - Actions
      Else - Actions
        Trigger - Turn off (This trigger)
KT Frost Bolt
  Events
    Unit - A unit Starts the effect of an ability
  Conditions
    Or - Any (Conditions) are true
      Conditions
        (Ability being cast) Equal to Frost Bolt
        (Ability being cast) Equal to Greater Frost Bolt
  Actions
    Set VariableSet AE_TmpPoint[0] = (Position of (Casting unit))
    Set VariableSet AE_TmpDamage[1] = 90.00
    Set VariableSet AE_TmpDamage[2] = 120.00
    Set VariableSet AE_TmpDamage[3] = 160.00
    Set VariableSet AE_TmpReal[0] = (AE_TmpDamage[(Level of (Ability being cast) for (Casting unit))] x (Load 0 of (Key (Casting unit).) from KT_ColdDarkHashtable.))
    Set VariableSet AE_TmpReal[1] = (AE_TmpDamage[(Level of (Ability being cast) for (Casting unit))] + AE_TmpReal[0])
    Unit - Create 1.Frost Bolt for (Owner of (Triggering unit)) at AE_TmpPoint[0] facing (Random angle) degrees
    Unit Group - Add (Last created unit) to KT_FrostBoltGroup
    Hashtable - Save Handle Of(Target unit of ability being cast) as 0 of (Key (Last created unit).) in KT_FrostBoltHashtable.
    Hashtable - Save Handle Of(Casting unit) as 1 of (Key (Last created unit).) in KT_FrostBoltHashtable.
    Hashtable - Save AE_TmpReal[1] as 2 of (Key (Last created unit).) in KT_FrostBoltHashtable.
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
    Trigger - Turn on KT_Frost_Bolt_I_Frost_Volley_Loop <gen>
KT Frost Volley
  Events
    Unit - A unit Starts the effect of an ability
  Conditions
    (Ability being cast) Equal to Frost Volley
  Actions
    Set VariableSet AE_TmpPoint[0] = (Position of (Casting unit))
    Set VariableSet AE_TmpPoint[1] = (Position of (Target unit of ability being cast))
    Set VariableSet AE_TmpDamage[1] = 30.00
    Set VariableSet AE_TmpDamage[2] = 40.00
    Set VariableSet AE_TmpDamage[3] = 53.00
    Set VariableSet AE_TmpReal[0] = (AE_TmpDamage[(Level of (Ability being cast) for (Casting unit))] x (Load 0 of (Key (Casting unit).) from KT_ColdDarkHashtable.))
    Set VariableSet AE_TmpReal[1] = (AE_TmpDamage[(Level of (Ability being cast) for (Casting unit))] + AE_TmpReal[0])
    Set VariableSet AE_TmpGroup[0] = (Units within 500.00 of AE_TmpPoint[1] matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A structure) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of (Casting unit)).) Equal to True))).)
    Set VariableSet AE_TmpInteger[0] = 0
    Unit Group - Pick every unit in AE_TmpGroup[0] and do (Actions)
      Loop - Actions
        Set VariableSet AE_TmpInteger[0] = (AE_TmpInteger[0] + 1)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            AE_TmpInteger[0] Greater than 3
          Then - Actions
            Unit Group - Remove (Triggering unit) from AE_TmpGroup[0].
          Else - Actions
            Unit - Create 1.Frost Bolt for (Owner of (Triggering unit)) at AE_TmpPoint[0] facing (Random angle) degrees
            Unit Group - Add (Last created unit) to KT_FrostBoltGroup
            Hashtable - Save Handle Of(Picked unit) as 0 of (Key (Last created unit).) in KT_FrostBoltHashtable.
            Hashtable - Save Handle Of(Casting unit) as 1 of (Key (Last created unit).) in KT_FrostBoltHashtable.
            Hashtable - Save AE_TmpReal[1] as 2 of (Key (Last created unit).) in KT_FrostBoltHashtable.
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
    Trigger - Turn on KT_Frost_Bolt_I_Frost_Volley_Loop <gen>
KT Frost Bolt I Frost Volley Loop
  Events
    Time - Every 0.02 seconds of game time
  Conditions
  Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Number of units in KT_FrostBoltGroup) Greater than 0
      Then - Actions
        Unit Group - Pick every unit in KT_FrostBoltGroup and do (Actions)
          Loop - Actions
            Set VariableSet AE_TmpUnit[0] = (Load 0 of (Key (Picked unit).) in KT_FrostBoltHashtable.)
            Set VariableSet AE_TmpUnit[1] = (Load 1 of (Key (Picked unit).) in KT_FrostBoltHashtable.)
            Set VariableSet AE_TmpPoint[0] = (Position of (Picked unit))
            Set VariableSet AE_TmpPoint[1] = (Position of AE_TmpUnit[0])
            Set VariableSet AE_TmpPoint[2] = (AE_TmpPoint[0] offset by 20.00 towards (Facing of (Picked unit)) degrees.)
            Unit - Move (Picked unit) instantly to AE_TmpPoint[2], facing (Angle from AE_TmpPoint[0] to AE_TmpPoint[1]) degrees
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                (Distance between AE_TmpPoint[0] and AE_TmpPoint[1]) Less than or equal to 128.00
              Then - Actions
                Unit Group - Remove (Picked unit) from KT_FrostBoltGroup.
                Unit - Kill (Picked unit)
                Set VariableSet AE_TmpReal[0] = (Load 2 of (Key (Picked unit).) from KT_FrostBoltHashtable.)
                Unit - Cause AE_TmpUnit[1] to damage AE_TmpUnit[0], dealing AE_TmpReal[0] damage of attack type Spells and damage type Normal
                Unit - Create 1.Dummy for (Owner of (Picked unit)) at AE_TmpPoint[2] facing Default building facing degrees
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  If - Conditions
                    (Level of Greater Frost Bolt for AE_TmpUnit[1]) Equal to 0
                  Then - Actions
                    Unit - Add Frost Bolt (Effect) to (Last created unit)
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      If - Conditions
                        (Level of Frost Volley for AE_TmpUnit[1]) Greater than 0
                      Then - Actions
                        Unit - Set level of Frost Bolt (Effect) for (Last created unit) to (Level of Frost Volley for AE_TmpUnit[1])
                      Else - Actions
                        Unit - Set level of Frost Bolt (Effect) for (Last created unit) to (Level of Frost Bolt for AE_TmpUnit[1])
                  Else - Actions
                    Unit - Add Greater Frost Bolt (Effect) to (Last created unit)
                    Unit - Set level of Greater Frost Bolt (Effect) for (Last created unit) to (Level of Greater Frost Bolt for AE_TmpUnit[1])
                Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
                Unit - Order (Last created unit) to Human Sorceress - Slow.AE_TmpUnit[0]
              Else - Actions
            Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
            Custom script: call RemoveLocation (udg_AE_TmpPoint[1])
            Custom script: call RemoveLocation (udg_AE_TmpPoint[2])
      Else - Actions
        Trigger - Turn off (This trigger)
KT Frost Blast
  Events
    Unit - A unit Starts the effect of an ability
  Conditions
    (Ability being cast) Equal to Frost Blast
  Actions
    Set VariableSet AE_TmpPoint[0] = (Position of (Casting unit))
    Set VariableSet AE_TmpPoint[1] = (Target point of ability being cast)
    Set VariableSet AE_TmpDamage[1] = 120.00
    Set VariableSet AE_TmpDamage[2] = 150.00
    Set VariableSet AE_TmpDamage[3] = 190.00
    Set VariableSet AE_TmpReal[0] = (AE_TmpDamage[(Level of (Ability being cast) for (Casting unit))] x (Load 0 of (Key (Casting unit).) from KT_ColdDarkHashtable.))
    Set VariableSet AE_TmpReal[1] = (AE_TmpDamage[(Level of (Ability being cast) for (Casting unit))] + AE_TmpReal[0])
    Unit - Create 1.Frost Blast for (Owner of (Triggering unit)) at AE_TmpPoint[0] facing (Angle from AE_TmpPoint[0] to AE_TmpPoint[1]) degrees
    Unit Group - Add (Last created unit) to KT_FrostBlastGroup
    Hashtable - Save 900.00 as 0 of (Key (Last created unit).) in KT_FrostBoltHashtable.
    Hashtable - Save Handle Of(Casting unit) as 1 of (Key (Last created unit).) in KT_FrostBoltHashtable.
    Hashtable - Save AE_TmpReal[1] as 2 of (Key (Last created unit).) in KT_FrostBoltHashtable.
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
    Custom script: call RemoveLocation (udg_AE_TmpPoint[1])
    Trigger - Turn on KT_Frost_Blast_Loop <gen>
KT Frost Blast Loop
  Events
    Time - Every 0.02 seconds of game time
  Conditions
  Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Number of units in KT_FrostBlastGroup) Greater than 0
      Then - Actions
        Unit Group - Pick every unit in KT_FrostBlastGroup and do (Actions)
          Loop - Actions
            Set VariableSet AE_TmpUnit[1] = (Load 1 of (Key (Picked unit).) in KT_FrostBoltHashtable.)
            Set VariableSet AE_TmpPoint[0] = (Position of (Picked unit))
            Set VariableSet AE_TmpPoint[1] = (AE_TmpPoint[0] offset by 20.00 towards (Facing of (Picked unit)) degrees.)
            Set VariableSet AE_TmpReal[0] = (Load 0 of (Key (Picked unit).) from KT_FrostBoltHashtable.)
            Set VariableSet AE_TmpReal[0] = (AE_TmpReal[0] - 20.00)
            Hashtable - Save AE_TmpReal[0] as 0 of (Key (Picked unit).) in KT_FrostBoltHashtable.
            Set VariableSet AE_TmpGroup[0] = (Units within 128.00 of AE_TmpPoint[0] matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A structure) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of (Picked unit)).) Equal to True))).)
            Set VariableSet AE_TmpUnit[0] = (Random unit from AE_TmpGroup[0])
            Unit - Move (Picked unit) instantly to AE_TmpPoint[1]
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                Or - Any (Conditions) are true
                  Conditions
                    AE_TmpReal[0] Less than or equal to 0.00
                    (Number of units in AE_TmpGroup[0]) Greater than 0
              Then - Actions
                Set VariableSet AE_TmpReal[1] = (Load 2 of (Key (Picked unit).) from KT_FrostBoltHashtable.)
                Unit - Cause AE_TmpUnit[1] to damage AE_TmpUnit[0], dealing AE_TmpReal[1] damage of attack type Spells and damage type Normal
                Unit - Create 1.Dummy for (Owner of (Picked unit)) at AE_TmpPoint[0] facing Default building facing degrees
                Unit - Add Frost Blast (Effect) to (Last created unit)
                Unit - Set level of Frost Blast (Effect) for (Last created unit) to (Level of Frost Blast for AE_TmpUnit[1])
                Unit - Order (Last created unit) to Neutral - Firebolt.AE_TmpUnit[0]
                Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
                Unit Group - Remove (Picked unit) from KT_FrostBlastGroup.
                Unit - Kill (Picked unit)
              Else - Actions
            Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
            Custom script: call RemoveLocation (udg_AE_TmpPoint[1])
      Else - Actions
        Trigger - Turn off (This trigger)
KT Freezing Strike
  Events
    Unit - A unit Starts the effect of an ability
  Conditions
    Or - Any (Conditions) are true
      Conditions
        (Ability being cast) Equal to Greater Freezing Strike
        (Ability being cast) Equal to Freezing Strike
  Actions
    Set VariableSet AE_TmpAbility = (Ability being cast)
    Set VariableSet AE_TmpUnit[0] = (Casting unit)
    Set VariableSet AE_TmpPoint[0] = (Target point of ability being cast)
    Set VariableSet AE_TmpReal[0] = 0.00
    Set VariableSet AE_TmpDamage[1] = 50.00
    Set VariableSet AE_TmpDamage[2] = 100.00
    Set VariableSet AE_TmpDamage[3] = 150.00
    Set VariableSet AE_TmpReal[2] = (AE_TmpDamage[(Level of (Ability being cast) for (Casting unit))] x (Load 0 of (Key (Casting unit).) from KT_ColdDarkHashtable.))
    Set VariableSet AE_TmpReal[3] = (AE_TmpDamage[(Level of (Ability being cast) for (Casting unit))] + AE_TmpReal[0])
    Special Effect - Create a special effect at AE_TmpPoint[0] using Abilities\Spells\Undead\FrostNova\FrostNovaTarget.mdl
    Special Effect - Destroy (Last created special effect)
    For each (Integer A) from 1 to 8, do (Actions)
      Loop - Actions
        Set VariableSet AE_TmpReal[0] = (AE_TmpReal[0] + 45.00)
        Set VariableSet AE_TmpPoint[1] = (AE_TmpPoint[0] offset by 80.00 towards AE_TmpReal[0] degrees.)
        Special Effect - Create a special effect at AE_TmpPoint[1] using Abilities\Spells\Undead\FrostNova\FrostNovaTarget.mdl
        Special Effect - Destroy (Last created special effect)
        Custom script: call RemoveLocation (udg_AE_TmpPoint[1])
    Set VariableSet AE_TmpGroup[0] = (Units within 160.00 of AE_TmpPoint[0] matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is A ground unit) Equal to True) and ((((Matching unit) is Magic Immune) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of AE_TmpUnit[0]).) Equal to True))))).)
    Unit Group - Pick every unit in AE_TmpGroup[0] and do (Actions)
      Loop - Actions
        Set VariableSet AE_TmpPoint[2] = (Position of (Picked unit))
        Unit - Cause AE_TmpUnit[0] to damage (Picked unit), dealing AE_TmpReal[3] damage of attack type Spells and damage type Normal
        Unit - Create 1.Dummy for (Owner of AE_TmpUnit[0]) at AE_TmpPoint[2] facing Default building facing degrees
        Unit - Add Freezing Strike (Effect) to (Last created unit)
        Unit - Set level of Freezing Strike (Effect) for (Last created unit) to (Level of AE_TmpAbility for (Casting unit))
        Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
        Unit - Order (Last created unit) to Neutral - Firebolt.(Picked unit)
        Custom script: call RemoveLocation (udg_AE_TmpPoint[2])
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
KT Chilling Strike
  Events
    Unit - A unit Starts the effect of an ability
  Conditions
    (Ability being cast) Equal to Chilling Strike
  Actions
    Set VariableSet AE_TmpUnit[0] = (Casting unit)
    Set VariableSet AE_TmpPoint[0] = (Target point of ability being cast)
    Set VariableSet AE_TmpReal[0] = 0.00
    Set VariableSet AE_TmpDamage[1] = 50.00
    Set VariableSet AE_TmpDamage[2] = 100.00
    Set VariableSet AE_TmpDamage[3] = 150.00
    Set VariableSet AE_TmpReal[2] = (AE_TmpDamage[(Level of (Ability being cast) for (Casting unit))] x (Load 0 of (Key (Casting unit).) from KT_ColdDarkHashtable.))
    Set VariableSet AE_TmpReal[3] = (AE_TmpDamage[(Level of (Ability being cast) for (Casting unit))] + AE_TmpReal[0])
    Special Effect - Create a special effect at AE_TmpPoint[0] using Abilities\Weapons\FrostWyrmMissile\FrostWyrmMissile.mdl
    Special Effect - Destroy (Last created special effect)
    Unit - Create 1.Dummy for (Owner of AE_TmpUnit[0]) at AE_TmpPoint[0] facing Default building facing degrees
    Unit - Add Chilling Strike (Effect) to (Last created unit)
    Unit - Set level of Chilling Strike (Effect) for (Last created unit) to (Level of Chilling Strike for (Casting unit))
    Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
    Unit - Order (Last created unit) to Human Mountain King - Thunder Clap.
    Unit - Create 1.Dummy for (Owner of AE_TmpUnit[0]) at AE_TmpPoint[0] facing Default building facing degrees
    Unit - Add Chilling Strike (Effect 2) to (Last created unit)
    Unit - Set level of Chilling Strike (Effect 2) for (Last created unit) to (Level of Chilling Strike for (Casting unit))
    Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
    Unit - Order (Last created unit) to Neutral Dark Ranger - Silence.AE_TmpPoint[0]
    For each (Integer A) from 1 to 8, do (Actions)
      Loop - Actions
        Set VariableSet AE_TmpReal[0] = (AE_TmpReal[0] + 45.00)
        Set VariableSet AE_TmpPoint[1] = (AE_TmpPoint[0] offset by 80.00 towards AE_TmpReal[0] degrees.)
        Special Effect - Create a special effect at AE_TmpPoint[1] using Abilities\Weapons\FrostWyrmMissile\FrostWyrmMissile.mdl
        Special Effect - Destroy (Last created special effect)
        Custom script: call RemoveLocation (udg_AE_TmpPoint[1])
    Set VariableSet AE_TmpGroup[0] = (Units within 160.00 of AE_TmpPoint[0] matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is A ground unit) Equal to True) and ((((Matching unit) is Magic Immune) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of AE_TmpUnit[0]).) Equal to True))))).)
    Unit Group - Pick every unit in AE_TmpGroup[0] and do (Actions)
      Loop - Actions
        Unit - Cause AE_TmpUnit[0] to damage (Picked unit), dealing AE_TmpReal[3] damage of attack type Spells and damage type Normal
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
KT Glacial Strike
  Events
    Unit - A unit Starts the effect of an ability
  Conditions
    (Ability being cast) Equal to Glacial Strike
  Actions
    Set VariableSet AE_TmpUnit[0] = (Casting unit)
    Set VariableSet AE_TmpPoint[0] = (Target point of ability being cast)
    Set VariableSet AE_TmpReal[0] = 0.00
    Set VariableSet AE_TmpDamage[1] = 50.00
    Set VariableSet AE_TmpDamage[2] = 100.00
    Set VariableSet AE_TmpDamage[3] = 150.00
    Set VariableSet AE_TmpReal[2] = (AE_TmpDamage[(Level of (Ability being cast) for (Casting unit))] x (Load 0 of (Key (Casting unit).) from KT_ColdDarkHashtable.))
    Set VariableSet AE_TmpReal[3] = (AE_TmpDamage[(Level of (Ability being cast) for (Casting unit))] + AE_TmpReal[0])
    Special Effect - Create a special effect at AE_TmpPoint[0] using Abilities\Spells\Undead\FrostNova\FrostNovaTarget.mdl
    Special Effect - Destroy (Last created special effect)
    For each (Integer A) from 1 to 8, do (Actions)
      Loop - Actions
        Set VariableSet AE_TmpReal[0] = (AE_TmpReal[0] + 45.00)
        Set VariableSet AE_TmpPoint[1] = (AE_TmpPoint[0] offset by 80.00 towards AE_TmpReal[0] degrees.)
        Special Effect - Create a special effect at AE_TmpPoint[1] using Abilities\Spells\Undead\FrostNova\FrostNovaTarget.mdl
        Special Effect - Destroy (Last created special effect)
        Custom script: call RemoveLocation (udg_AE_TmpPoint[1])
    For each (Integer A) from 1 to 8, do (Actions)
      Loop - Actions
        Set VariableSet AE_TmpReal[0] = (AE_TmpReal[0] + 45.00)
        Set VariableSet AE_TmpPoint[1] = (AE_TmpPoint[0] offset by 140.00 towards AE_TmpReal[0] degrees.)
        Special Effect - Create a special effect at AE_TmpPoint[1] using Abilities\Spells\Undead\FrostNova\FrostNovaTarget.mdl
        Special Effect - Destroy (Last created special effect)
        Custom script: call RemoveLocation (udg_AE_TmpPoint[1])
    Set VariableSet AE_TmpGroup[0] = (Units within 240.00 of AE_TmpPoint[0] matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is A ground unit) Equal to True) and ((((Matching unit) is Magic Immune) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of AE_TmpUnit[0]).) Equal to True))))).)
    Unit Group - Pick every unit in AE_TmpGroup[0] and do (Actions)
      Loop - Actions
        Set VariableSet AE_TmpPoint[2] = (Position of (Picked unit))
        Unit - Cause AE_TmpUnit[0] to damage (Picked unit), dealing AE_TmpReal[3] damage of attack type Spells and damage type Normal
        Unit - Create 1.Dummy for (Owner of AE_TmpUnit[0]) at AE_TmpPoint[2] facing Default building facing degrees
        Unit - Add Glacial Strike (Effect) to (Last created unit)
        Unit - Set level of Glacial Strike (Effect) for (Last created unit) to (Level of Glacial Strike for (Casting unit))
        Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
        Unit - Order (Last created unit) to Neutral - Firebolt.(Picked unit)
        Custom script: call RemoveLocation (udg_AE_TmpPoint[2])
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
KT Sacrificial Pact
  Events
    Unit - A unit Starts the effect of an ability
  Conditions
    (Ability being cast) Equal to Sacrificial Pact
  Actions
    Set VariableSet AE_TmpReal[1] = 0.33
    Set VariableSet AE_TmpReal[2] = 0.66
    Set VariableSet AE_TmpReal[3] = 1.00
    Set VariableSet AE_TmpPoint[0] = (Position of (Casting unit))
    Set VariableSet AE_TmpGroup[0] = (Units within 500.00 of AE_TmpPoint[0] matching (((((Matching unit) is alive) Equal to True) and (((Matching unit) is Mechanical) Equal to False)) and ((((Matching unit) belongs to an ally of (Owner of (Casting unit)).) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((Max mana of (Matching unit)) Greater than 0.00)))).)
    Set VariableSet AE_TmpReal[0] = ((Life of (Target unit of ability being cast)) x AE_TmpReal[(Level of (Ability being cast) for (Casting unit))])
    Set VariableSet AE_TmpReal[0] = (AE_TmpReal[0] / (Real((Number of units in AE_TmpGroup[0]))))
    Unit Group - Pick every unit in AE_TmpGroup[0] and do (Actions)
      Loop - Actions
        Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) + AE_TmpReal[0])
        Special Effect - Create a special effect attached to the origin (attachpoint) of (Picked unit) using Abilities\Spells\Items\AIma\AImaTarget.mdl
        Special Effect - Destroy (Last created special effect)
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
KT Sapphiron
  Events
    Unit - A unit Starts the effect of an ability
  Conditions
    (Ability being cast) Equal to Summon Sapphiron
  Actions
    Set VariableSet AE_TmpPoint[0] = (Position of (Triggering unit))
    Set VariableSet AE_TmpPoint[1] = (Target point of ability being cast)
    Set VariableSet AE_TmpPoint[2] = (AE_TmpPoint[0] offset by 2000.00 towards (Angle from AE_TmpPoint[0] to AE_TmpPoint[1]) degrees.)
    Unit - Create 1.Sapphiron for (Owner of (Triggering unit)) at AE_TmpPoint[0] facing 225.00 degrees
    Sound - Play FrostwyrmWarcry1 <gen> at 100% volume, attached to (Last created unit)
    Unit - Order (Last created unit) to Move To.AE_TmpPoint[2]
    Animation - Change (Last created unit) flying height to 325.00 at 100.00
    Unit - Add a 20.00 second Generic expiration timer to (Last created unit)
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
    Custom script: call RemoveLocation (udg_AE_TmpPoint[1])
    Custom script: call RemoveLocation (udg_AE_TmpPoint[2])
KT Sapphiron Attack
  Events
    Game - GDD_Event becomes Equal to 0
  Conditions
    (Unit-type of GDD_DamageSource) Equal to Sapphiron
  Actions
    Trigger - Turn off (This trigger)
    Set VariableSet AE_TmpPoint[0] = (Position of GDD_DamagedUnit)
    Unit - Create 1.Sapphiron Attack for (Owner of GDD_DamageSource) at AE_TmpPoint[0] facing Default building facing degrees
    Unit - Order (Last created unit) to Attack.GDD_DamagedUnit
    Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
    Trigger - Turn on (This trigger)
KT Frozen Shell
  Events
    Unit - A unit Starts the effect of an ability
  Conditions
    (Ability being cast) Equal to Frozen Shell
  Actions
    Unit - Add Frozen Shell (Aura) to (Target unit of ability being cast)
    Unit Group - Add (Target unit of ability being cast) to KT_FrozenShellGroup
    Hashtable - Save 20.00 as 0 of (Key (Target unit of ability being cast).) in KT_FrozenShellHashtable.
    Hashtable - Save 500.00 as 1 of (Key (Target unit of ability being cast).) in KT_FrozenShellHashtable.
    Hashtable - Save 0.00 as 2 of (Key (Target unit of ability being cast).) in KT_FrozenShellHashtable.
KT Frozen Shell Damage
  Events
    Game - GDD_Event becomes Equal to 0
  Conditions
    (Level of Frozen Shell (Aura) for GDD_DamagedUnit) Greater than 0
  Actions
    Trigger - Turn off (This trigger)
    Set VariableSet AE_TmpGroup[0] = (Units owned by (Owner of GDD_DamagedUnit) matching ((Matching unit) Equal to GDD_DamagedUnit).)
    Set VariableSet AE_TmpHandle = (Random unit from AE_TmpGroup[0])
    Set VariableSet AE_TmpReal[0] = (Load 1 of (Key AE_TmpHandle.) from KT_FrozenShellHashtable.)
    Set VariableSet AE_TmpReal[0] = (AE_TmpReal[0] - GDD_Damage)
    Hashtable - Save AE_TmpReal[0] as 1 of (Key AE_TmpHandle.) in KT_FrozenShellHashtable.
    Set VariableSet AE_TmpReal[1] = (Load 2 of (Key AE_TmpHandle.) from KT_FrozenShellHashtable.)
    Set VariableSet AE_TmpReal[1] = (AE_TmpReal[1] + GDD_Damage)
    Hashtable - Save AE_TmpReal[1] as 2 of (Key AE_TmpHandle.) in KT_FrozenShellHashtable.
    Unit - Set life of GDD_DamagedUnit to ((Life of GDD_DamagedUnit) + GDD_Damage)
    Trigger - Turn on (This trigger)
KT Frozen Shell Loop
  Events
    Time - Every 0.25 seconds of game time
  Conditions
  Actions
    Unit Group - Pick every unit in KT_FrozenShellGroup and do (Actions)
      Loop - Actions
        Set VariableSet AE_TmpReal[0] = (Load 0 of (Key (Picked unit).) from KT_FrozenShellHashtable.)
        Set VariableSet AE_TmpReal[0] = (AE_TmpReal[0] - 0.25)
        Hashtable - Save AE_TmpReal[0] as 0 of (Key (Picked unit).) in KT_FrozenShellHashtable.
        Set VariableSet AE_TmpReal[1] = (Load 1 of (Key (Picked unit).) from KT_FrozenShellHashtable.)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            Or - Any (Conditions) are true
              Conditions
                AE_TmpReal[0] Less than or equal to 0.00
                AE_TmpReal[1] Less than or equal to 0.00
          Then - Actions
            Set VariableSet AE_TmpPoint[0] = (Position of (Picked unit))
            Set VariableSet AE_TmpUnit[0] = (Picked unit)
            Set VariableSet AE_TmpReal[2] = (Load 2 of (Key (Picked unit).) from KT_FrozenShellHashtable.)
            Set VariableSet AE_TmpReal[2] = (AE_TmpReal[2] x 0.50)
            Set VariableSet AE_TmpGroup[0] = (Units within 400.00 of AE_TmpPoint[0] matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is A ground unit) Equal to True) and ((((Matching unit) is Magic Immune) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of AE_TmpUnit[0]).) Equal to True))))).)
            Special Effect - Create a special effect at AE_TmpPoint[0] using war3mapImported\IceNova.mdx
            Special Effect - Destroy (Last created special effect)
            Special Effect - Create a special effect at AE_TmpPoint[0] using Abilities\Spells\Undead\FrostNova\FrostNovaTarget.mdl
            Special Effect - Destroy (Last created special effect)
            For each (Integer A) from 1 to 8, do (Actions)
              Loop - Actions
                Set VariableSet AE_TmpReal[0] = (AE_TmpReal[0] + 45.00)
                Set VariableSet AE_TmpPoint[1] = (AE_TmpPoint[0] offset by 80.00 towards AE_TmpReal[0] degrees.)
                Special Effect - Create a special effect at AE_TmpPoint[1] using Abilities\Spells\Undead\FrostNova\FrostNovaTarget.mdl
                Special Effect - Destroy (Last created special effect)
                Custom script: call RemoveLocation (udg_AE_TmpPoint[1])
            For each (Integer A) from 1 to 8, do (Actions)
              Loop - Actions
                Set VariableSet AE_TmpReal[0] = (AE_TmpReal[0] + 45.00)
                Set VariableSet AE_TmpPoint[1] = (AE_TmpPoint[0] offset by 140.00 towards AE_TmpReal[0] degrees.)
                Special Effect - Create a special effect at AE_TmpPoint[1] using Abilities\Spells\Undead\FrostNova\FrostNovaTarget.mdl
                Special Effect - Destroy (Last created special effect)
                Custom script: call RemoveLocation (udg_AE_TmpPoint[1])
            Unit Group - Pick every unit in AE_TmpGroup[0] and do (Actions)
              Loop - Actions
                Set VariableSet AE_TmpPoint[2] = (Position of (Picked unit))
                Unit - Cause AE_TmpUnit[0] to damage (Picked unit), dealing AE_TmpReal[2] damage of attack type Spells and damage type Normal
                Unit - Create 1.Dummy for (Owner of AE_TmpUnit[0]) at AE_TmpPoint[2] facing Default building facing degrees
                Unit - Add Frozen Shell (Effect) to (Last created unit)
                Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
                Unit - Order (Last created unit) to Neutral - Firebolt.(Picked unit)
                Custom script: call RemoveLocation (udg_AE_TmpPoint[2])
            Unit Group - Remove (Picked unit) from KT_FrozenShellGroup.
            Unit - Remove Frozen Shell (Aura) from (Picked unit)
            Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
          Else - Actions
KT Call of the Archlich
  Events
    Unit - A unit Starts the effect of an ability
  Conditions
    (Unit-type of (Casting unit)) Equal to Archlich
    (Level of Call of the Archlich (Upgrade) for (Casting unit)) Greater than 0
    Or - Any (Conditions) are true
      Conditions
        (Ability being cast) Equal to Frost Bolt
        (Ability being cast) Equal to Greater Frost Bolt
        (Ability being cast) Equal to Frost Volley
        (Ability being cast) Equal to Frost Blast
        (Ability being cast) Equal to Freezing Strike
        (Ability being cast) Equal to Greater Freezing Strike
        (Ability being cast) Equal to Glacial Strike
        (Ability being cast) Equal to Chilling Strike
        (Ability being cast) Equal to Dark Ritual
        (Ability being cast) Equal to Greater Dark Ritual
        (Ability being cast) Equal to Dark Sacrifice
        (Ability being cast) Equal to Sacrificial Pact
        (Ability being cast) Equal to Summon Sapphiron
        (Ability being cast) Equal to Frozen Shell
  Actions
    Set VariableSet AE_TmpPoint[0] = (Position of (Casting unit))
    Set VariableSet AE_TmpGroup[0] = (Units within 500.00 of AE_TmpPoint[0] matching (((((Matching unit) is alive) Equal to True) and (((Matching unit) is Mechanical) Equal to False)) and ((((Matching unit) belongs to an ally of (Owner of (Casting unit)).) Equal to True) and ((((Matching unit) is A structure) Equal to False) and (((Matching unit) is Magic Immune) Equal to False)))).)
    Unit Group - Pick every unit in AE_TmpGroup[0] and do (Actions)
      Loop - Actions
        Unit - Set life of (Picked unit) to ((Percentage life of (Picked unit)) + 5.00)%
        Special Effect - Create a special effect attached to the origin (attachpoint) of (Picked unit) using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
        Special Effect - Destroy (Last created special effect)
    Unit - Add Call of the Archlich (Aura) to (Casting unit)
    Hashtable - Save 10.00 as 0 of (Key (Casting unit).) in KT_CotAHashtable.
    Unit Group - Add (Casting unit) to KT_CotAGroup
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
    Trigger - Turn on KT_Call_of_the_Archlich_Loop <gen>
KT Call of the Archlich Loop
  Events
    Time - Every 0.25 seconds of game time
  Conditions
  Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Number of units in KT_CotAGroup) Greater than 0
      Then - Actions
        Unit Group - Pick every unit in KT_CotAGroup and do (Actions)
          Loop - Actions
            Set VariableSet AE_TmpReal[0] = (Load 0 of (Key (Picked unit).) from KT_CotAHashtable.)
            Set VariableSet AE_TmpReal[0] = (AE_TmpReal[0] - 0.25)
            Hashtable - Save AE_TmpReal[0] as 0 of (Key (Picked unit).) in KT_CotAHashtable.
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                AE_TmpReal[0] Less than or equal to 0.00
              Then - Actions
                Hashtable - Save 0.00 as 0 of (Key (Picked unit).) in KT_CotAHashtable.
                Unit - Remove Call of the Archlich (Aura) from (Picked unit)
                Unit Group - Remove (Picked unit) from KT_CotAGroup.
              Else - Actions
      Else - Actions
        Trigger - Turn off (This trigger)
KT Shade of Naxxramas
  Events
    Unit - A unit Starts the effect of an ability
  Conditions
    (Unit-type of (Casting unit)) Equal to Archlich
    (Level of Shade of Naxxramas (Upgrade) for (Casting unit)) Greater than 0
    Or - Any (Conditions) are true
      Conditions
        (Ability being cast) Equal to Frost Bolt
        (Ability being cast) Equal to Greater Frost Bolt
        (Ability being cast) Equal to Frost Volley
        (Ability being cast) Equal to Frost Blast
        (Ability being cast) Equal to Freezing Strike
        (Ability being cast) Equal to Greater Freezing Strike
        (Ability being cast) Equal to Glacial Strike
        (Ability being cast) Equal to Chilling Strike
  Actions
    Set VariableSet AE_TmpAbility = (Ability being cast)
    Set VariableSet AE_TmpPoint[0] = (Position of (Triggering unit))
    Set VariableSet AE_TmpPoint[1] = (AE_TmpPoint[0] offset by 256.00 towards (Random angle) degrees.)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        Or - Any (Conditions) are true
          Conditions
            (Ability being cast) Equal to Frost Bolt
            (Ability being cast) Equal to Greater Frost Bolt
            (Ability being cast) Equal to Frost Volley
      Then - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Random integer number between 1 and 100) Less than or equal to 33
          Then - Actions
            Set VariableSet AE_TmpGroup[0] = (Units within 1000.00 of AE_TmpPoint[1] matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is A ground unit) Equal to True) and ((((Matching unit) is Magic Immune) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of (Casting unit)).) Equal to True))))).)
            Set VariableSet AE_TmpUnit[0] = (Random unit from AE_TmpGroup[0])
            Unit - Create 1.Shade of Naxxramas for (Owner of (Casting unit)) at AE_TmpPoint[1] facing (Random angle) degrees
            Animation - Change (Last created unit)'s vertex coloring to (100%, 100%, 100%) with 50.00% transparency
            Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
            Special Effect - Create a special effect at AE_TmpPoint[0] using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
            Special Effect - Destroy (Last created special effect)
            Unit - Add AE_TmpAbility to (Last created unit)
            Unit - Set level of AE_TmpAbility for (Last created unit) to (Level of AE_TmpAbility for (Casting unit))
            Unit - Order (Last created unit) to Neutral - Firebolt.AE_TmpUnit[0]
          Else - Actions
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Ability being cast) Equal to Frost Blast
      Then - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Random integer number between 1 and 100) Less than or equal to 33
          Then - Actions
            Set VariableSet AE_TmpGroup[0] = (Units within 1000.00 of AE_TmpPoint[1] matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is A ground unit) Equal to True) and ((((Matching unit) is Magic Immune) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of (Casting unit)).) Equal to True))))).)
            Set VariableSet AE_TmpUnit[0] = (Random unit from AE_TmpGroup[0])
            Set VariableSet AE_TmpPoint[2] = (Position of AE_TmpUnit[0])
            Unit - Create 1.Shade of Naxxramas for (Owner of (Casting unit)) at AE_TmpPoint[1] facing (Random angle) degrees
            Animation - Change (Last created unit)'s vertex coloring to (100%, 100%, 100%) with 50.00% transparency
            Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
            Special Effect - Create a special effect at AE_TmpPoint[0] using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
            Special Effect - Destroy (Last created special effect)
            Unit - Add AE_TmpAbility to (Last created unit)
            Unit - Set level of AE_TmpAbility for (Last created unit) to (Level of AE_TmpAbility for (Casting unit))
            Unit - Order (Last created unit) to Orc Tauren Chieftain - Shockwave.AE_TmpPoint[2]
            Custom script: call RemoveLocation (udg_AE_TmpPoint[2])
          Else - Actions
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        Or - Any (Conditions) are true
          Conditions
            (Ability being cast) Equal to Freezing Strike
            (Ability being cast) Equal to Greater Freezing Strike
            (Ability being cast) Equal to Glacial Strike
            (Ability being cast) Equal to Chilling Strike
      Then - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Random integer number between 1 and 100) Less than or equal to 22
          Then - Actions
            Set VariableSet AE_TmpGroup[0] = (Units within 1000.00 of AE_TmpPoint[1] matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is A ground unit) Equal to True) and ((((Matching unit) is Magic Immune) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of (Casting unit)).) Equal to True))))).)
            Set VariableSet AE_TmpUnit[0] = (Random unit from AE_TmpGroup[0])
            Set VariableSet AE_TmpPoint[2] = (Position of AE_TmpUnit[0])
            Unit - Create 1.Shade of Naxxramas for (Owner of (Casting unit)) at AE_TmpPoint[1] facing (Random angle) degrees
            Animation - Change (Last created unit)'s vertex coloring to (100%, 100%, 100%) with 50.00% transparency
            Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
            Special Effect - Create a special effect at AE_TmpPoint[0] using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
            Special Effect - Destroy (Last created special effect)
            Unit - Add AE_TmpAbility to (Last created unit)
            Unit - Set level of AE_TmpAbility for (Last created unit) to (Level of AE_TmpAbility for (Casting unit))
            Unit - Order (Last created unit) to Neutral Dark Ranger - Silence.AE_TmpPoint[2]
            Custom script: call RemoveLocation (udg_AE_TmpPoint[2])
          Else - Actions
      Else - Actions
    Custom script: call RemoveLocation (udg_AE_TmpPoint[0])
    Custom script: call RemoveLocation (udg_AE_TmpPoint[1])
KT Ability Upgrade
  Events
    Unit - A unit Starts the effect of an ability
  Conditions
    Or - Any (Conditions) are true
      Conditions
        (Ability being cast) Equal to Frost Blast (Talent)
        (Ability being cast) Equal to Greater Frost Bolt (Talent)
        (Ability being cast) Equal to Frost Volley (Talent)
        (Ability being cast) Equal to Glacial Strike (Talent)
        (Ability being cast) Equal to Greater Freezing Strike (Talent)
        (Ability being cast) Equal to Chilling Strike (Talent)
        (Ability being cast) Equal to Greater Dark Ritual (Talent)
        (Ability being cast) Equal to Sacrificial Pact (Talent)
        (Ability being cast) Equal to Dark Sacrifice (Talent)
        (Ability being cast) Equal to Shade of Naxxramas (Talent)
        (Ability being cast) Equal to Call of the Archlich (Talent)
  Actions
    Set VariableSet AE_TmpUnit[0] = (Random unit from KT_TalentGroup)
    Unit Group - Remove AE_TmpUnit[0] from KT_TalentGroup.
    Unit - Remove AE_TmpUnit[0] from the game
    Game - Force (Owner of (Casting unit)) to press Escape/Cancel
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Ability being cast) Equal to Greater Frost Bolt (Talent)
      Then - Actions
        Player - Disable Greater Frost Bolt (Talent) for (Owner of (Triggering unit))
        Player - Disable Frost Blast (Talent) for (Owner of (Triggering unit))
        Player - Disable Frost Volley (Talent) for (Owner of (Triggering unit))
        Unit - Add Greater Frost Bolt (Upgrade) to (Triggering unit)
      Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Ability being cast) Equal to Frost Volley (Talent)
          Then - Actions
            Player - Disable Greater Frost Bolt (Talent) for (Owner of (Triggering unit))