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

Trigger Viewer

Elfian's Escape Maker.w3x
Variables
Items
Key
Invulnerability
Double Speed
General
Initialization
Leaver
Slide
Revive
Save Zone
Rotate Skater
Commands
Spells
Lock
Remove
Rotate Gate
Switch
Set Key
Help
Teleport
Inventory
Spell Dummy
Init
InitTriggers
If you read this, then a huge tentacle is behind you and is going to rape you if you don't turn around at once!
//TESH.scrollpos=0
//TESH.alwaysfold=0
globals
    
    real           FrameWait            =   0.01
    
    unit    array  Game_Skater[12]
    unit           Game_SaveZone
    player         Game_God             =   Player(0)
    unit           Game_Enslaver
    real    array  Game_VSpeed[12]
    boolean array  Game_IsLocked[12]
    boolean array  Game_IsDisco[12]
    boolean array  Game_IsGhost[12]
    integer array  Game_GhostAlpha[12]
    boolean array  Game_Ghost[12]
    real    array  Game_BonusSlide[12]
    texttag array  Game_HoverName[12]
    
    string  array  ColorCode 
    
    real           Config_MoveSpeed     =   270.000
    real           Config_DarkSlide     =   800.000 * FrameWait
    real           Config_IceSlide      =   400.000 * FrameWait
    real           Config_PoisonSpeed   =   130.000
    real           Config_RockyShake    =   100.000
    real           Config_LavaDamage    =   4.000 * FrameWait / 100.000
    
    integer array  Terrain_Type[6]
    string  array  Terrain_Key[6]
    
    trigger        initTrigger          =   CreateTrigger()
    trigger        leaverTrigger        =   CreateTrigger()
    trigger        slideTrigger         =   CreateTrigger()
    trigger        rotateTrigger        =   CreateTrigger()
    trigger        reviveTrigger        =   CreateTrigger()
    trigger        spellTrigger         =   CreateTrigger()
    trigger        cmdTrigger           =   CreateTrigger()
    trigger        saveTrigger          =   CreateTrigger()
    trigger        lockTrigger          =   CreateTrigger()
    trigger        removeTrigger        =   CreateTrigger()
    trigger        rotateGateTrigger    =   CreateTrigger()
    trigger        switchTrigger        =   CreateTrigger()
    trigger        helpTrigger          =   CreateTrigger()
    trigger        setkeyTrigger        =   CreateTrigger()
    trigger        setportTrigger       =   CreateTrigger()
    trigger        teleportTrigger      =   CreateTrigger()
    trigger        inventoryTrigger     =   CreateTrigger()
    trigger        spelldummyTrigger    =   CreateTrigger()
    
    string         Cmd_SpawnUnit        =   "mortarteam"
    integer        Cmd_SpawnCount       =   1
    integer        Cmd_BrushSize        =   1
    
    unit           dude
    real           passX
    real           passY
    
    boolean array  Helper_TeleportOn
    
    integer        attached_size        =   1
    unit    array  attached
    
endglobals

function StringFind takes string str, string ch returns integer

    local integer i = 0
    
    loop
        
        set i = i + 1
        exitwhen i == StringLength(str) or SubString(str, i-1, i) == ch
    
    endloop
    
    return i

endfunction

function Attach takes unit h returns integer

  local integer i = 0

    loop
        exitwhen i >= attached_size
        
        if(h == attached[i]) then
            return i
       endif
        
        set i = i + 1
    endloop
    
    set attached[i] = h
    set attached_size = attached_size + 1
    return i
    
endfunction

function noFilterFunc takes nothing returns boolean
    return true
endfunction

globals
    boolexpr noFilter
endglobals
Name Type Is Array Initial Value
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Item_Key takes item itm returns nothing
   
    local unit gate
   
    set gate = attached[GetItemUserData(itm)]
    call SetUnitAnimation(CreateUnit(GetOwningPlayer(gate), 'h002', GetUnitX(gate), GetUnitY(gate), GetUnitFacing(gate)), "Alternate Death")
   
    call RemoveUnit(gate)
    call RemoveItem(itm)
   
    set gate = null

endfunction
   
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Item_Invulnerability takes item itm returns nothing
   
    local real x = GetItemX(itm)
    local real y = GetItemY(itm)
   
    call UnitAddItem(dude, itm)
    call UnitUseItem(dude, itm)
    call CreateItem('I001', x, y)

endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Item_DoubleSpeed_Actions takes nothing returns nothing

    local integer i = GetPlayerId(GetOwningPlayer(GetManipulatingUnit()))
   
    set Game_BonusSlide[i] = 2.000
    call TriggerSleepAction(4.00)
    set Game_BonusSlide[i] = 1.000

endfunction

function Item_DoubleSpeed takes item itm returns nothing
   
    local trigger trig = CreateTrigger()
   
    call TriggerAddAction(trig, function Item_DoubleSpeed_Actions)
    call TriggerRegisterUnitEvent(trig, dude, EVENT_UNIT_USE_ITEM)
   
    call CreateItem('I002', GetItemX(itm), GetItemY(itm))
   
    call UnitAddItem(dude, itm)
    call UnitUseItem(dude, itm)

    call TriggerClearActions(trig)
    call DestroyTrigger(trig)
   
    set trig = null
   
endfunction
//TESH.scrollpos=45
//TESH.alwaysfold=0
function Trig_Initialization_Actions takes nothing returns nothing

    local integer i = 0
    local integer ptr
   
    call FogEnable(false)
    call FogMaskEnable(false)
   
    set Terrain_Type[0] = 'Isnw'
    set Terrain_Type[1] = 'Ibsq'
    set Terrain_Type[2] = 'Iice'
    set Terrain_Type[3] = 'Idki'
    set Terrain_Type[4] = 'Dlvc'
    set Terrain_Type[5] = 'Cpos'
    set Terrain_Type[6] = 'Nsnr'
   
    set Terrain_Key[0] = "Q"
    set Terrain_Key[1] = "W"
    set Terrain_Key[2] = "E"
    set Terrain_Key[3] = "R"
    set Terrain_Key[4] = "A"
    set Terrain_Key[5] = "S"
    set Terrain_Key[6] = "D"
   
    set ColorCode[0] = "FF0202"
    set ColorCode[1] = "0041FF"
    set ColorCode[2] = "1BE5B8"
    set ColorCode[3] = "530080"
    set ColorCode[4] = "FFFC00"
    set ColorCode[5] = "FE890D"
    set ColorCode[6] = "1FBF00"
    set ColorCode[7] = "E45AAF"
    set ColorCode[8] = "949596"
    set ColorCode[9] = "7DBEF1"
    set ColorCode[10] = "0F6145"
    set ColorCode[11] = "4D2903"
   
    set Game_Enslaver = CreateUnit(Player(0), 'H000', GetRectCenterX(bj_mapInitialPlayableArea), GetRectCenterY(bj_mapInitialPlayableArea), GetRandomReal(0, 360))
    call TriggerRegisterUnitEvent(spellTrigger, Game_Enslaver, ConvertUnitEvent(291))
    set Game_SaveZone = CreateUnit(Player(15), 'n000', GetRectCenterX(bj_mapInitialPlayableArea), GetRectCenterY(bj_mapInitialPlayableArea), GetRandomReal(0, 360))
    call SetUnitPathing(Game_Enslaver, false)
   
    call SetTerrainType(GetRectCenterX(bj_mapInitialPlayableArea), GetRectCenterY(bj_mapInitialPlayableArea), 'Ibsq', -1, 3, 1)
    call PanCameraToTimed(GetRectCenterX(bj_mapInitialPlayableArea), GetRectCenterY(bj_mapInitialPlayableArea), 0.01)
   
    loop
       
        if(GetPlayerController(Player(i)) == MAP_CONTROL_USER and GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING) then
       
            set Game_Skater[i] = CreateUnit(Player(i), 'E000', GetRectCenterX(bj_mapInitialPlayableArea), GetRectCenterY(bj_mapInitialPlayableArea), GetRandomReal(0, 360))
            call TriggerRegisterUnitEvent(rotateTrigger, Game_Skater[i], EVENT_UNIT_ISSUED_POINT_ORDER)
            call SetUnitPathing(Game_Skater[i], false)
            call TriggerRegisterPlayerChatEvent(cmdTrigger, Player(i), "", false)
           
            call SetPlayerAlliance(Player(0), Player(i), ALLIANCE_PASSIVE, true)
            call SetPlayerAlliance(Player(0), Player(i), ALLIANCE_HELP_REQUEST, true)
            call SetPlayerAlliance(Player(0), Player(i), ALLIANCE_HELP_RESPONSE, true)
            call SetPlayerAlliance(Player(0), Player(i), ALLIANCE_SHARED_XP, true)
            call SetPlayerAlliance(Player(0), Player(i), ALLIANCE_SHARED_SPELLS, true)
           
            call SetPlayerAlliance(Player(i), Player(0), ALLIANCE_PASSIVE, true)
            call SetPlayerAlliance(Player(i), Player(0), ALLIANCE_HELP_REQUEST, true)
            call SetPlayerAlliance(Player(i), Player(0), ALLIANCE_HELP_RESPONSE, true)
            call SetPlayerAlliance(Player(i), Player(0), ALLIANCE_SHARED_XP, true)
            call SetPlayerAlliance(Player(i), Player(0), ALLIANCE_SHARED_SPELLS, true)
           
            set Game_HoverName[i] = CreateTextTag()
            call SetTextTagText(Game_HoverName[i], "|c00" + ColorCode[i] + GetPlayerName(Player(i)) + "|r", 0.023)
           
        endif
       
        set Helper_TeleportOn[i] = true
        set Game_BonusSlide[i] = 1.000
       
        set i = i + 1
        exitwhen i == 13
   
    endloop
   
    set i = 0
   
    call DestroyTrigger(initTrigger)
    set initTrigger = null
   
endfunction

 
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Leaver_Actions takes nothing returns nothing
   
    local integer i = GetPlayerId(GetTriggerPlayer())
   
    call ClearTextMessages()
    call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "[|c00" + ColorCode[i] + GetPlayerName(GetTriggerPlayer()) + "|r] has left the game!")
    call DestroyTextTag(Game_HoverName[i])
    call RemoveUnit(Game_Skater[i])
   
    set Game_Skater[i] = null
    set Game_HoverName[i] = null
   
endfunction
//TESH.scrollpos=72
//TESH.alwaysfold=0
function Trig_Slide_Items takes nothing returns nothing
   
    local item itm = GetEnumItem()
    local integer plr = GetPlayerId(GetOwningPlayer(dude))
   
    if(GetItemTypeId(itm) == 'I000') then
        call Item_Key(itm)
    elseif(GetItemTypeId(itm) == 'I001' and not (GetUnitAbilityLevel(dude, 'B003') > 0)) then
        call Item_Invulnerability(itm)
    elseif(GetItemTypeId(itm) == 'I002' and not (GetUnitAbilityLevel(dude, 'B001') > 0)) then
        call Item_DoubleSpeed(itm)
    endif
   
    set itm = null

endfunction

function Trig_Slide_JumpPads_Condition takes nothing returns boolean
    return GetUnitTypeId(GetFilterUnit()) == 'h003'
endfunction

globals

    group jumppads = CreateGroup()
    boolexpr jumppad_cnd

endglobals

function Trig_Slide_Actions takes nothing returns nothing

    local integer i = 0
    local real x = 0
    local real y = 0
    local rect r
    local integer d
   
    loop
       
        if(Game_Skater[i] != null) then
           
            set x = GetUnitX(Game_Skater[i])
            set y = GetUnitY(Game_Skater[i])
            set d = GetUnitUserData(Game_Skater[i])
           
            set r = Rect(x - 80, y - 80, x + 80, y + 80)
           
            call SetUnitFlyHeight(Game_Skater[i], GetUnitFlyHeight(Game_Skater[i]) + Game_VSpeed[i], 0)
            set Game_VSpeed[i] = Game_VSpeed[i] - 0.1
           
            if(GetUnitFlyHeight(Game_Skater[i]) < 1) then
               
                call PauseUnit(Game_Skater[i], false)
               
                if(GetTerrainType(x, y) == 'Isnw') then
                    call KillUnit(Game_Skater[i])
                elseif(GetTerrainType(x, y) == 'Ibsq') then
                    call SetUnitMoveSpeed(Game_Skater[i], Config_MoveSpeed)
                elseif(GetTerrainType(x, y) == 'Iice') then
                    call SetUnitPosition(Game_Skater[i], x + Config_IceSlide * Game_BonusSlide[i] * Cos(GetUnitFacing(Game_Skater[i]) * bj_DEGTORAD), y + Config_IceSlide * Game_BonusSlide[i] * Sin(GetUnitFacing(Game_Skater[i]) * bj_DEGTORAD))
                elseif(GetTerrainType(x, y) == 'Idki') then
                    call SetUnitPosition(Game_Skater[i], x + Config_DarkSlide * Game_BonusSlide[i] * Cos(GetUnitFacing(Game_Skater[i]) * bj_DEGTORAD), y + Config_DarkSlide * Game_BonusSlide[i] * Sin(GetUnitFacing(Game_Skater[i]) * bj_DEGTORAD))
                elseif(GetTerrainType(x, y) == 'Dlvc') then
                    call UnitDamageTarget(Game_Skater[i], Game_Skater[i], Config_LavaDamage, false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
                elseif(GetTerrainType(x, y) == 'Cpos') then
                    call SetUnitMoveSpeed(Game_Skater[i], Config_PoisonSpeed)
                elseif(GetTerrainType(x, y) == 'Nsnr') then
                    if(GetLocalPlayer() == GetOwningPlayer(Game_Skater[i])) then
                        call CameraSetTargetNoise(Config_RockyShake, Config_RockyShake * 50)
                    endif
                endif
               
                call GroupEnumUnitsInRange(jumppads, x, y, 80, jumppad_cnd)
               
                if(FirstOfGroup(jumppads) != null) then
                    set Game_VSpeed[i] = GetUnitUserData(FirstOfGroup(jumppads))
                    call SetUnitAnimation(FirstOfGroup(jumppads), "birth")
                    call QueueUnitAnimation(FirstOfGroup(jumppads), "stand")
                endif
               
                call GroupClear(jumppads)
               
                if(GetUnitState(Game_Skater[i], UNIT_STATE_LIFE) > 0) then
                    set dude = Game_Skater[i]
                    call EnumItemsInRect(r, noFilter, function Trig_Slide_Items)
                endif
               
            else
               
                call PauseUnit(Game_Skater[i], true)
                call SetUnitPosition(Game_Skater[i], x + 6 * Cos(GetUnitFacing(Game_Skater[i]) * bj_DEGTORAD), y + 6 * Sin(GetUnitFacing(Game_Skater[i]) * bj_DEGTORAD))
               
            endif
           
            if(GetTerrainType(x, y) != 'Nsnr' and GetLocalPlayer() == GetOwningPlayer(Game_Skater[i]) or GetUnitFlyHeight(Game_Skater[i]) > 1) then
                call CameraSetTargetNoise(0, 0)
            endif
           
            call SetTextTagPosUnit(Game_HoverName[i], Game_Skater[i], 0.00)
           
            if(Game_Ghost[i]) then
                set Game_GhostAlpha[i] = Game_GhostAlpha[i] - 1
            else
                set Game_GhostAlpha[i] = Game_GhostAlpha[i] + 1
            endif
           
            if(Game_GhostAlpha[i] == 0) then
                set Game_Ghost[i] = false
            elseif(Game_GhostAlpha[i] == 255) then
                set Game_Ghost[i] = true
            endif
           
            if(Game_IsGhost[i]) then
                call SetUnitVertexColor(Game_Skater[i], 255, 255, 255, Game_GhostAlpha[i])
            endif
           
            if(Game_IsDisco[i] and d > 20) then
                call SetUnitColor(Game_Skater[i], ConvertPlayerColor(GetRandomInt(0, 12)))
                call SetUnitUserData(Game_Skater[i], 0)
            else
                call SetUnitUserData(Game_Skater[i], d + 1)
            endif
       
        endif
       
        set i = i + 1
        exitwhen i == 12
   
    endloop
   
    call RemoveRect(r)
    set r = null
   
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Revive_Actions takes nothing returns nothing

    local unit u = GetDyingUnit()
   
    if(GetUnitTypeId(u) == 'E000') then

        call TriggerSleepAction(2.50)
        call ReviveHero(u, GetUnitX(Game_SaveZone), GetUnitY(Game_SaveZone), true)
       
        if(GetLocalPlayer() == GetOwningPlayer(u)) then
            call ClearSelection()
            call SelectUnit(u, true)
        endif
   
    endif
   
    set u = null
   
endfunction
//TESH.scrollpos=5
//TESH.alwaysfold=0
function Trig_SaveZone_Filter takes nothing returns boolean

    return (GetUnitTypeId(GetFilterUnit()) == 'n000')
   
endfunction

function Trig_SaveZone_Actions takes nothing returns nothing

    local group g = CreateGroup()
    local integer i = 0
    local unit u = GetTriggerUnit()
    local boolexpr cnd = Condition(function Trig_SaveZone_Filter)
   
    if(GetUnitTypeId(u) == 'E000') then
       
        call GroupEnumUnitsInRange(g, GetUnitX(u), GetUnitY(u), 250.000, cnd)
       
        if not(FirstOfGroup(g) == Game_SaveZone) then

            set Game_SaveZone = FirstOfGroup(g)
           
            loop
           
                call SetUnitPosition(Game_Skater[i], GetUnitX(Game_SaveZone), GetUnitY(Game_SaveZone))
                set i = i + 1
                exitwhen i == 12
       
            endloop
           
        endif
       
    endif
   
    call DestroyBoolExpr(cnd)
    call DestroyGroup(g)
   
    set g = null
    set u = null
    set cnd = null
   
endfunction
 
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Rotate_Actions takes nothing returns nothing
   
    if(GetUnitFlyHeight(GetOrderedUnit()) < 1) then
        call SetUnitFacing(GetOrderedUnit(), bj_RADTODEG * Atan2(GetOrderPointY() - GetUnitY(GetOrderedUnit()), GetOrderPointX() - GetUnitX(GetOrderedUnit())))
    endif
   
endfunction
//TESH.scrollpos=84
//TESH.alwaysfold=0
function Trig_Cmds_Actions takes nothing returns nothing
   
    local string raw = GetEventPlayerChatString()
    local integer pos = StringFind(raw, ":")
    local string txt = SubString(raw, 0, pos-1)
    local string param = SubString(raw, pos, StringLength(raw))
    local integer iparam
    local group s = CreateGroup()
    local unit pick = null
    local integer plr = GetPlayerId(GetTriggerPlayer())
   
    local dialog kickDialog = DialogCreate()
    local integer i = 0
   
    if(txt == "disco") then
   
        if(param == "on") then
            set Game_IsDisco[plr] = true
        elseif(param == "off") then
            set Game_IsDisco[plr] = false
            call SetUnitColor(Game_Skater[i], ConvertPlayerColor(i))
        endif
       
    elseif(txt == "ghost") then
   
        if(param == "on") then
            set Game_IsGhost[plr] = true
        elseif(param == "off") then
            set Game_IsGhost[plr] = false
            call SetUnitVertexColor(Game_Skater[plr], 255, 255, 255, 255)
        endif
       
    elseif(txt == "color") then
       
        set iparam = S2I(param)
       
        if(iparam <= 12 and iparam >= 1) then
            call SetUnitColor(Game_Skater[plr], ConvertPlayerColor(iparam - 1))
        endif
       
    elseif(txt == "alpha") then
   
        call SetUnitVertexColor(Game_Skater[plr], 255, 255, 255, S2I(param))
       
    endif
   
    if(GetTriggerPlayer() == Game_God) then
   
        if(txt == "kill") then
           
            loop
               
                if(GetPlayerName(Player(i)) == param) then
                    call DialogSetMessage(kickDialog, "You have been killed! |nYou can still observe the game, though.")
                    call DialogAddButton(kickDialog, "Ok!", 'Q')
                    call DialogDisplay(Player(i), kickDialog, true)
                    call SetUnitExploded(Game_Skater[i], true)
                    call DisableTrigger(reviveTrigger)
                    call KillUnit(Game_Skater[i])
                    call EnableTrigger(reviveTrigger)
                    call EnableUserUI(false)
                    call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "[|c00" + ColorCode[i] + param + "|r] has been killed!")
                    call DestroyTextTag(Game_HoverName[i])
                    set Game_Skater[i] = null
                    set Game_HoverName[i] = null
                endif
               
                set i = i + 1
                exitwhen i == 12
           
            endloop
       
        elseif(txt == "kick") then
       
            loop
               
                if(GetPlayerName(Player(i)) == param) then
                    call RemovePlayer(Player(i), PLAYER_GAME_RESULT_DEFEAT)
                    call DialogSetMessage(kickDialog, "\n\nYou have been kicked!\n\n")
                    call DialogDisplay(Player(i), kickDialog, true)
                    if(GetLocalPlayer() == Player(i)) then
                        call EndGame(false)
                    endif
                    call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "[|c00" + ColorCode[i] + param + "|r] has been kicked!")
                    call RemoveUnit(Game_Skater[i])
                    call DestroyTextTag(Game_HoverName[i])
                    set Game_Skater[i] = null
                    set Game_HoverName[i] = null
                endif
               
                set i = i + 1
                exitwhen i == 12
           
            endloop
       
        elseif(txt == "unittype") then
       
            set Cmd_SpawnUnit = param
       
        elseif(txt == "unitcount") then
       
            set Cmd_SpawnCount = S2I(param)
       
        elseif(txt == "brushsize") then
       
            set Cmd_BrushSize = S2I(param)
           
        elseif(txt == "maker") then
       
            loop
               
                if(GetPlayerName(Player(i)) == param) then
                    set Game_God = Player(i)
                    call SetUnitOwner(Game_Enslaver, Game_God, true)
                endif
               
                set i = i + 1
                exitwhen i == 12
           
            endloop
       
        elseif(txt == "movespeed") then
       
            set Config_MoveSpeed = S2R(param)
       
        elseif(txt == "icespeed") then
       
            set Config_IceSlide = S2R(param) * FrameWait
           
        elseif(txt == "darkspeed") then
       
            set Config_DarkSlide = S2R(param) * FrameWait
       
        elseif(txt == "lavadamage") then
       
            set Config_LavaDamage = S2R(param) * FrameWait / 100.000
           
        elseif(txt == "poisonspeed") then
       
            set Config_PoisonSpeed = S2R(param)
           
        elseif(txt == "rockyshake") then
       
            set Config_RockyShake = S2R(param)
       
        elseif(txt == "jumppower") then
       
            call SyncSelections()
            call GroupEnumUnitsSelected(s, Game_God, noFilter)
           
            loop
                set pick = FirstOfGroup(s)
                exitwhen pick == null
                call GroupRemoveUnit(s, pick)
                call SetUnitUserData(pick, S2I(param))
            endloop
       
        elseif(txt == "unitspeed") then
           
            call SyncSelections()
            call GroupEnumUnitsSelected(s, Game_God, noFilter)
           
            loop
                set pick = FirstOfGroup(s)
                exitwhen pick == null
                call GroupRemoveUnit(s, pick)
                call SetUnitMoveSpeed(pick, S2R(param))
            endloop
           
        elseif(txt == "casttime") then
           
            call SyncSelections()
            call GroupEnumUnitsSelected(s, Game_God, noFilter)
           
            loop
                set pick = FirstOfGroup(s)
                exitwhen pick == null
                call GroupRemoveUnit(s, pick)
               
                if(GetUnitTypeId(pick) == 'n002') then
                    call SetUnitUserData(pick, R2I(S2R(param) * 1000))
                endif
               
            endloop
           
        endif
       
    endif
   
    call DialogDestroy(kickDialog)
    call DestroyGroup(s)
   
    set kickDialog = null
    set s = null

endfunction
//TESH.scrollpos=39
//TESH.alwaysfold=0
function Trig_Spells_Actions takes nothing returns nothing
   
    local unit caster = GetSpellAbilityUnit()
    local integer id = GetSpellAbilityId()
    local location loc = GetSpellTargetLoc()
    local real x = GetLocationX(loc)
    local real y = GetLocationY(loc)
    local unit u = GetSpellTargetUnit()
    local integer plr = GetPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))
    local integer i = 0
   
    call IssueImmediateOrder(caster, "stop")
   
    if(id == 'A003') then
        call SetTerrainType(x, y, Terrain_Type[0], -1, Cmd_BrushSize, 1)
        call ForceUIKey(Terrain_Key[0])
    elseif(id == 'A004') then
        call SetTerrainType(x, y, Terrain_Type[1], -1, Cmd_BrushSize, 1)
        call ForceUIKey(Terrain_Key[1])
    elseif(id == 'A009') then
        call SetTerrainType(x, y, Terrain_Type[2], -1, Cmd_BrushSize, 1)
        call ForceUIKey(Terrain_Key[2])
    elseif(id == 'A002') then
        call SetTerrainType(x, y, Terrain_Type[3], -1, Cmd_BrushSize, 1)
        call ForceUIKey(Terrain_Key[3])
    elseif(id == 'A00C') then
        call SetTerrainType(x, y, Terrain_Type[4], -1, Cmd_BrushSize, 1)
        call ForceUIKey(Terrain_Key[4])
    elseif(id == 'A00E') then
        call SetTerrainType(x, y, Terrain_Type[5], -1, Cmd_BrushSize, 1)
        call ForceUIKey(Terrain_Key[5])
    elseif(id == 'A00W') then
        call SetTerrainType(x, y, Terrain_Type[6], -1, Cmd_BrushSize, 1)
        call ForceUIKey(Terrain_Key[6])
    elseif(id == 'A005') then
        call SetTerrainType(x, y, Terrain_Type[1], -1, 3, 1)
        set u = CreateUnit(Player(15), 'n000', x, y, GetRandomReal(0, 360))
        call TriggerRegisterUnitInRange(saveTrigger, u, 200.000, null)
    elseif(id == 'A00F') then
        set u = CreateUnit(Game_God, 'n001', x, y, GetRandomReal(0, 360))
        call TriggerRegisterUnitInRange(teleportTrigger, u, 100.000, null)
        call UnitAddAbility(u, 'A007')
        call UnitAddAbility(u, 'A00D')
    elseif(id == 'A00X') then
        set u = CreateUnit(Game_God, 'h003', x, y, 0)
        call SetUnitUserData(u, 8)
    elseif(id == 'A000') then
        loop
            exitwhen i >= Cmd_SpawnCount
            set i = i + 1
            set u = CreateUnitByName(Game_God, Cmd_SpawnUnit, x, y, GetRandomReal(0, 360))
            call UnitAddAbility(u, 'A007')
            call UnitAddAbility(u, 'A00B')
            call UnitAddAbility(u, 'A006')
            call SetUnitPathing(u, false)
            call SetUnitInvulnerable(u, true)
            call IssueImmediateOrder(u, "immolation")
        endloop
    elseif(id == 'A00G') then
        call CreateItem('I000', x, y)
    elseif(id == 'A00H') then
        call SetUnitUserData(CreateUnit(Game_God, 'h001', x, y, 90), 0)
    elseif(id == 'A00N') then
        call CreateItem('I001', x, y)
    elseif(id == 'A00Q') then
        call CreateItem('I002', x, y)
    elseif(id == 'A00T') then
        call SetUnitUserData(CreateUnit(Game_God, 'n002', x, y, GetRandomReal(0, 360)), 5000)
    endif
   
    call RemoveLocation(loc)
   
    set loc = null
    set caster = null
    set u = null

endfunction
 
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Lock_Actions takes nothing returns nothing

    local integer p = GetPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))
   
    if(GetSpellAbilityId() == 'A00A') then
        if not(Game_IsLocked[p]) then
            if(GetLocalPlayer() == Player(p)) then
                call SetCameraTargetController(GetSpellAbilityUnit(), 0, 0, true)
            endif
            set Game_IsLocked[p] = true
        else
            if(GetLocalPlayer() == Player(p)) then
                call ResetToGameCamera(0.00)
            endif
            set Game_IsLocked[p] = false
        endif
    endif

endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Remove_Actions takes nothing returns nothing

    if(GetSpellAbilityId() == 'A007') then
        call RemoveUnit(GetSpellAbilityUnit())
    endif

endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_RotateGate_Actions takes nothing returns nothing
   
    local unit caster
    local unit new
    local player p
    local integer u
   
    if(GetSpellAbilityId() == 'A00I') then
   
        set caster = GetSpellAbilityUnit()
        set p = GetOwningPlayer(caster)
        set u = GetUnitTypeId(caster)
        set new = CreateUnit(p, u, GetUnitX(caster), GetUnitY(caster), GetUnitFacing(caster) + 90)
       
        if(u == 'h002') then
            call SetUnitAnimation(new, "Alternate Death")
        endif
       
        if(GetLocalPlayer() == p) then
            call SelectUnit(new, true)
        endif
       
        call RemoveUnit(caster)
       
    endif
   
    set caster = null
    set new = null
    set p = null

endfunction
//TESH.scrollpos=3
//TESH.alwaysfold=0
function Trig_Switch_Actions takes nothing returns nothing

    local unit caster
    local unit new
    local real face
    local player p
   
    if(GetSpellAbilityId() == 'A00J') then
       
        set caster = GetSpellAbilityUnit()
        set face = GetUnitFacing(caster)
        set p = GetOwningPlayer(caster)
       
        if(GetUnitTypeId(caster) == 'h002') then
            set new = CreateUnit(p, 'h001', GetUnitX(caster), GetUnitY(caster), face)
            call SetUnitAnimation(new, "stand")
        else
            set new = CreateUnit(p, 'h002', GetUnitX(caster), GetUnitY(caster), face)
            call SetUnitAnimation(new, "Alternate Death")
        endif
       
        if(GetLocalPlayer() == p) then
            call SelectUnit(new, true)
        endif
       
        call RemoveUnit(caster)
   
    endif
   
    set caster = null
    set new = null
    set p = null

endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_SetKey_Actions takes nothing returns nothing

    if(GetSpellAbilityId() == 'A00K') then
        call SetItemUserData(GetSpellTargetItem(), Attach(GetSpellAbilityUnit()))
    endif

endfunction
//TESH.scrollpos=43
//TESH.alwaysfold=0
function Trig_HelpMaker_Actions takes nothing returns nothing

    local dialog dlg = GetClickedDialog()
    local trigger trg = GetTriggeringTrigger()
   
    call ClearTextMessages()
    call DisplayTimedTextToPlayer(GetTriggerPlayer(), 0, 0, 24.000, "|c0000FF00kill:Hivoyer|r ... Removes the escaper of a given player, but allows him to observe")
    call DisplayTimedTextToPlayer(GetTriggerPlayer(), 0, 0, 24.000, "|c0000FF00kick:Vakuu|r ... Removes a given player from the game instantly")
    call DisplayTimedTextToPlayer(GetTriggerPlayer(), 0, 0, 24.000, "|c0000FF00unitcount:1|r ... Specifies how many units should be spawned")
    call DisplayTimedTextToPlayer(GetTriggerPlayer(), 0, 0, 24.000, "|c0000FF00unittype:footman|r ... Specifies the unit-type of the units spawned")
    call DisplayTimedTextToPlayer(GetTriggerPlayer(), 0, 0, 24.000, "|c0000FF00brushsize:1|r ... Specifies the size of the terrain brush")
    call DisplayTimedTextToPlayer(GetTriggerPlayer(), 0, 0, 24.000, "|c0000FF00maker:Elfian|r ... Sets the maker to someone else")
    call DisplayTimedTextToPlayer(GetTriggerPlayer(), 0, 0, 24.000, "|c0000FF00movespeed:270|r ... Sets the normal movement speed of the Escapers")
    call DisplayTimedTextToPlayer(GetTriggerPlayer(), 0, 0, 24.000, "|c0000FF00icespeed:400|r ... Sets the slide speed on regular ice")
    call DisplayTimedTextToPlayer(GetTriggerPlayer(), 0, 0, 24.000, "|c0000FF00darkspeed:800|r ... Sets the slide speed on dark ice")
    call DisplayTimedTextToPlayer(GetTriggerPlayer(), 0, 0, 24.000, "|c0000FF00lavadamage:5|r ... Sets the lava's damage per second")
    call DisplayTimedTextToPlayer(GetTriggerPlayer(), 0, 0, 24.000, "|c0000FF00poisonspeed:130|r ... Sets the movement speed on poison")
    call DisplayTimedTextToPlayer(GetTriggerPlayer(), 0, 0, 24.000, "|c0000FF00rockyshake:100|r ... Sets the noise magnitute on rocky snow")
    call DisplayTimedTextToPlayer(GetTriggerPlayer(), 0, 0, 24.000, "|c0000FF00jumppower:10|r ... Sets the power of the selected jump pad")
    call DisplayTimedTextToPlayer(GetTriggerPlayer(), 0, 0, 24.000, "|c0000FF00unitspeed:512|r ... Sets the movement speed of all currently selected units")
    call DisplayTimedTextToPlayer(GetTriggerPlayer(), 0, 0, 24.000, "|c0000FF00casttime:5|r ... Sets the casting time of all currently selected spell dummies")
   
    call DialogDestroy(dlg)
    call TriggerClearActions(trg)
    call DestroyTrigger(trg)
   
    set dlg = null
    set trg = null

endfunction

function Trig_HelpSkater_Actions takes nothing returns nothing

    local dialog dlg = GetClickedDialog()
    local trigger trg = GetTriggeringTrigger()
    local player plr = GetTriggerPlayer()
   
    call ClearTextMessages()
   
    call DisplayTimedTextToPlayer(plr, 0, 0, 24.000, "|c0000FF00disco:off|r ... Set disco to on if you feel like party")
    call DisplayTimedTextToPlayer(plr, 0, 0, 24.000, "|c0000FF00ghost:off|r ... Set this to on and become ghost")
    call DisplayTimedTextToPlayer(plr, 0, 0, 24.000, "|c0000FF00color:1|r ... Set your color to the color of another player. 1 is red, 2 is blue and so on")
    call DisplayTimedTextToPlayer(plr, 0, 0, 24.000, "|c0000FF00alpha:255|r ... Varies from 255 to 0. The less it is, the less visible you are")
   
    call DialogDestroy(dlg)
    call TriggerClearActions(trg)
    call DestroyTrigger(trg)
   
    set dlg = null
    set trg = null
    set plr = null

endfunction

function Trig_Help_Actions takes nothing returns nothing

    local dialog dlg = DialogCreate()
    local trigger cmdz = CreateTrigger()
    local trigger skillz = CreateTrigger()
   
    call DialogSetMessage(dlg, "Help?")
    call TriggerRegisterDialogButtonEvent(cmdz, DialogAddButton(dlg, "Maker Commands", 'c'))
    call TriggerRegisterDialogButtonEvent(skillz, DialogAddButton(dlg, "Skater Commands", 's'))
    call DialogAddButton(dlg, "Cancel", 'n')
    call TriggerAddAction(cmdz, function Trig_HelpMaker_Actions)
    call TriggerAddAction(skillz, function Trig_HelpSkater_Actions)
   
    call DialogDisplay(GetTriggerPlayer(), dlg, true)
   
    set dlg = null
    set cmdz = null
    set skillz = null
   
endfunction
//TESH.scrollpos=9
//TESH.alwaysfold=0
function Trig_SetTeleportLoc_Actions takes nothing returns nothing
   
    if(GetSpellAbilityId() == 'A00D') then
        call SetUnitUserData(GetSpellAbilityUnit(), Attach(GetSpellTargetUnit()))
    endif
       
endfunction

function Trig_Teleport_Filter takes nothing returns boolean

    return GetUnitTypeId(GetFilterUnit()) == 'n001'

endfunction

function Trig_Teleport_Actions takes nothing returns nothing

    local group g = CreateGroup()
    local integer i = 0
    local unit u = GetTriggerUnit()
    local integer pos = GetPlayerId(GetOwningPlayer(u))
   
    if(GetUnitTypeId(u) == 'E000' and Helper_TeleportOn[i]) then
       
        set Helper_TeleportOn[i] = false
       
        call GroupEnumUnitsInRange(g, GetUnitX(u), GetUnitY(u), 150.000, Condition(function Trig_Teleport_Filter))
           
        call SetUnitPosition(u, GetUnitX(attached[GetUnitUserData(FirstOfGroup(g))]), GetUnitY(attached[GetUnitUserData(FirstOfGroup(g))]))
        call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl", GetUnitX(attached[GetUnitUserData(FirstOfGroup(g))]), GetUnitY(attached[GetUnitUserData(FirstOfGroup(g))])))
        call TriggerSleepAction(0.00)
       
        set Helper_TeleportOn[i] = true
       
    endif
   
    call DestroyGroup(g)
   
    set g = null
    set u = null
   
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Inventory_Actions takes nothing returns nothing
   
    local item itm = GetOrderTargetItem()
    local unit u = GetOrderedUnit()
   
    if(itm != null and GetUnitTypeId(u) == 'E000') then
        call IssuePointOrder(u, "move", GetItemX(itm), GetItemY(itm))
    endif
   
    set itm = null
    set u = null
   
endfunction
//TESH.scrollpos=10
//TESH.alwaysfold=0
function Trig_SpellDummy_Actions takes nothing returns nothing
   
    local unit u = GetOrderedUnit()
    local integer order = GetIssuedOrderId()
    local real casttime = 0.000
    local real x = GetOrderPointX()
    local real y = GetOrderPointY()
       
    if(GetUnitTypeId(u) == 'n002') then
       
        if(OrderId2String(order) == "channel") then
               
            call SetUnitUserData(u, -GetUnitUserData(u))
               
        else
           
            if(GetUnitUserData(u) <= 0) then
           
                call SetUnitUserData(u, -GetUnitUserData(u))
           
            endif
           
            loop
               
                set casttime = I2R(GetUnitUserData(u)) / 1000.000
                exitwhen casttime <= 0
                   
                call TriggerSleepAction(casttime)
                call DisableTrigger(GetTriggeringTrigger())
                call IssuePointOrderById(u, order, x, y)
                call EnableTrigger(GetTriggeringTrigger())
               
            endloop
           
        endif
   
    endif
   
    set u = null

endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_InitTriggers_Actions takes nothing returns nothing
   
    local integer i = 0
   
    set noFilter = Filter(function noFilterFunc)
    set jumppad_cnd = Filter(function Trig_Slide_JumpPads_Condition)
   
    call TriggerAddAction(initTrigger, function Trig_Initialization_Actions)
    call TriggerAddAction(leaverTrigger, function Trig_Leaver_Actions)
    call TriggerAddAction(reviveTrigger, function Trig_Revive_Actions)
   
    call TriggerRegisterTimerEvent(slideTrigger, FrameWait, true)
    call TriggerAddAction(slideTrigger, function Trig_Slide_Actions)
   
    call TriggerAddAction(rotateTrigger, function Trig_Rotate_Actions)
    call TriggerAddAction(saveTrigger, function Trig_SaveZone_Actions)
    call TriggerAddAction(cmdTrigger, function Trig_Cmds_Actions)
    call TriggerAddAction(spellTrigger, function Trig_Spells_Actions)
    call TriggerAddAction(lockTrigger, function Trig_Lock_Actions)
    call TriggerAddAction(removeTrigger, function Trig_Remove_Actions)
    call TriggerAddAction(rotateGateTrigger, function Trig_RotateGate_Actions)
    call TriggerAddAction(switchTrigger, function Trig_Switch_Actions)
    call TriggerAddAction(setkeyTrigger, function Trig_SetKey_Actions)
    call TriggerAddAction(setportTrigger, function Trig_SetTeleportLoc_Actions)
    call TriggerAddAction(teleportTrigger, function Trig_Teleport_Actions)
    call TriggerAddAction(inventoryTrigger, function Trig_Inventory_Actions)
   
    loop
   
        call TriggerRegisterPlayerEvent(leaverTrigger, Player(i), EVENT_PLAYER_LEAVE)
        call TriggerRegisterPlayerChatEvent(helpTrigger, Player(i), "help", true)
        call TriggerRegisterPlayerUnitEvent(reviveTrigger, Player(i), EVENT_PLAYER_UNIT_DEATH, noFilter)
        call TriggerRegisterPlayerUnitEvent(lockTrigger, Player(i), EVENT_PLAYER_UNIT_SPELL_CAST, noFilter)
        call TriggerRegisterPlayerUnitEvent(removeTrigger, Player(i), EVENT_PLAYER_UNIT_SPELL_CAST, noFilter)
        call TriggerRegisterPlayerUnitEvent(rotateGateTrigger, Player(i), EVENT_PLAYER_UNIT_SPELL_CAST, noFilter)
        call TriggerRegisterPlayerUnitEvent(switchTrigger, Player(i), EVENT_PLAYER_UNIT_SPELL_CAST, noFilter)
        call TriggerRegisterPlayerUnitEvent(setkeyTrigger, Player(i), EVENT_PLAYER_UNIT_SPELL_CAST, noFilter)
        call TriggerRegisterPlayerUnitEvent(setportTrigger, Player(i), EVENT_PLAYER_UNIT_SPELL_CAST, noFilter)
        call TriggerRegisterPlayerUnitEvent(inventoryTrigger, Player(i), EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER, noFilter)
        call TriggerRegisterPlayerUnitEvent(spelldummyTrigger, Player(i), EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER, noFilter)
        call TriggerRegisterPlayerUnitEvent(spelldummyTrigger, Player(i), EVENT_PLAYER_UNIT_ISSUED_ORDER, noFilter)
       
        set i = i + 1
        exitwhen i == 12
       
    endloop
   
    call TriggerAddAction(helpTrigger, function Trig_Help_Actions)
    call TriggerAddAction(spelldummyTrigger, function Trig_SpellDummy_Actions)
   
    call DestroyTrigger(gg_trg_InitTriggers)
    call TriggerExecute(initTrigger)
   
    set gg_trg_InitTriggers = null
   
endfunction

function InitTrig_InitTriggers takes nothing returns nothing

    set gg_trg_InitTriggers = CreateTrigger()
    call TriggerAddAction(gg_trg_InitTriggers, function Trig_InitTriggers_Actions)
   
endfunction