//***************************************************************************************************************
//*Returns the angle between two points when you give the (X,Y) coordinates.
//*
function AngleBetweenPointsXY takes real x1, real y1, real x2, real y2 returns real
return 57.29582 * Atan2(y2 - y1, x2 - x1)
endfunction
function IsUnitFacingUnit takes unit source returns boolean
local real a = ModuloReal(AngleBetweenPoints(GetUnitLoc(source), GetUnitLoc(gg_unit_hpea_0025))+360.00,360.00)
local real chk = a - GetUnitFacing(source)
local real tol = 45
if (chk <= tol and chk >= -tol) or (chk <= (tol-360)) or (chk >= (360-tol)) then
return true
endif
return false
endfunction
//*
//*MANY THANKS TO RISING_DUSK FOR THE ABOVE. (HI)
//***************************************************************************************************************
function Trig_Caught takes nothing returns nothing
call PauseAllUnitsBJ( true )
call DisableTrigger( GetTriggeringTrigger() )
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 0.50, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 0, 0, 0, 0 )
call TriggerSleepAction( 0.60 )
call PauseAllUnitsBJ( false )
call TriggerExecute( gg_trg_Reset )
call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 1.00, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 0, 0, 0, 0 )
call TriggerSleepAction( 1.00 )
call EnableTrigger( GetTriggeringTrigger() )
endfunction
function Guard_Conditions takes unit source returns boolean
if (DistanceBetweenPoints(GetUnitLoc(source), GetUnitLoc(gg_unit_hpea_0025)) <= 100.00) then
return true
elseif not(IsUnitFacingUnit(source)) then
return false
elseif not(DistanceBetweenPoints(GetUnitLoc(source), GetUnitLoc(gg_unit_hpea_0025)) <= 600.00) then
return false
elseif not IsUnitVisible(gg_unit_hpea_0025, Player(1)) then
return false
endif
return true
endfunction
Name | Type | is_array | initial_value |
ColumnCounter | real | No | |
Counter | integer | No | -1 |
PlaceToReset | rect | No | RectNull |
function Trig_Map_Initialization_Actions takes nothing returns nothing
local player p = Player(0)
local unit u = gg_unit_hpea_0025
call SetDayNightModels("","Environment\\DNC\\DNCDungeon\\DNCDungeonUnit\\DNCDungeonUnit.mdx")
call SelectUnitForPlayerSingle(u, p)
call SetPlayerAbilityAvailable(p, 'AHwe', false)
call SetPlayerAbilityAvailable(p, 'AHtc', false)
call ForceCinematicSubtitles(true)
set udg_PlaceToReset = gg_rct_Region_005
set p = null
set u = null
endfunction
//===========================================================================
function InitTrig_Map_Initialization takes nothing returns nothing
set gg_trg_Map_Initialization = CreateTrigger()
call TriggerAddAction( gg_trg_Map_Initialization, function Trig_Map_Initialization_Actions )
endfunction
function Trig_Time_0_Actions takes nothing returns nothing
local unit u = gg_unit_Hpal_0082
local player p = Player(0)
local rect l1 = gg_rct_CloakPoint1
local rect l2 = gg_rct_CloakPoint2
call SetUnitTimeScale( u, 0.5 )
call TriggerExecute(gg_trg_Reset)
call DisplayTextToForce( GetPlayersAll(), "|cffffcc00Hint:|r When you |c0066CCFFget near shadows|r, you gain an ability called |cffffcc00C|r|c0066CCFFloak|r. Once used, you |c0066CCFFmeld into the shadow|r, invisible to the eye. You then gain an ability called |c0066CCFFDe|r|cffffcc00c|r|c0066CCFFloak|r, which |c0066CCFFremoves you from the shadow|r when used. You can also remove yourself from the shadow by exiting the shadow. The first two |c0066CCFFshadow spots|r are indicated by an arrow. Find the rest on your own.\n|c00AA0000Avoid the guards at all costs.|r\nPress Esc to clear the screen of text messages, including this one." )
// GIVE SIGHT OF REGIONS TO CLOAK
call FogModifierStart(CreateFogModifierRect(p, FOG_OF_WAR_VISIBLE, l1, true, false))
call FogModifierStart(CreateFogModifierRect(p, FOG_OF_WAR_VISIBLE, l2, true, false))
call SetFloatGameState( GAME_STATE_TIME_OF_DAY, 12. )
call SetTimeOfDayScale( 0. )
set u = null
set p = null
set l1 = null
set l2 = null
endfunction
//===========================================================================
function InitTrig_Time_0 takes nothing returns nothing
set gg_trg_Time_0 = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_Time_0, 0.00 )
call TriggerAddAction( gg_trg_Time_0, function Trig_Time_0_Actions )
endfunction
function Trig_Esc_Actions takes nothing returns nothing
call ClearTextMessages()
endfunction
//===========================================================================
function InitTrig_Esc takes nothing returns nothing
local player p = Player(0)
set gg_trg_Esc = CreateTrigger()
call TriggerRegisterPlayerEventEndCinematic(gg_trg_Esc,p)
call TriggerAddAction( gg_trg_Esc,function Trig_Esc_Actions)
set p = null
endfunction
function Trig_Reset_Actions takes nothing returns nothing
local destructable d = gg_dest_ZTd2_0064
local destructable d2 = gg_dest_ZTd2_0008
local destructable d3 = gg_dest_ZTd2_0048
local rect r = gg_rct_Lever
local rect r2 = udg_PlaceToReset
local unit u = gg_unit_Hpal_0082
local unit u2 = gg_unit_hpea_0025
local unit u3 = gg_unit_hcth_0010
local player p = Player(0)
call ClearTextMessages()
call SetDoodadAnimationRect(r, 'D001', "stand", false)
call DestructableRestoreLife( d, GetDestructableMaxLife(d), true )
call KillDestructable( d2 )
call SetDestructableAnimation( d2, "death")
call DestructableRestoreLife( d3, GetDestructableMaxLife(d3), true )
call EnableTrigger( gg_trg_END_BOSS )
call SetUnitAnimation( u, "sleep" )
//call SetUnitPositionLoc(u2, GetRectCenter(r2))
call SetUnitFacing(u2, 0.)
call PanCameraToTimed( GetLocationX(GetUnitLoc(u2)), GetLocationY(GetUnitLoc(u2)), 0. )
call SetUnitPositionLoc(u3, GetRectCenter(gg_rct_Region_006))
call SetUnitFacing(u3, AngleBetweenPoints(GetRectCenter(gg_rct_Region_006),GetRectCenter(gg_rct_Region_003)))
call SetUnitPositionLocFacingLocBJ( gg_unit_hcth_0009, GetRectCenter(gg_rct_Region_006_Copy), GetRectCenter(gg_rct_Region_003_Copy) )
call SetUnitPositionLocFacingLocBJ( gg_unit_hcth_0011, GetRectCenter(gg_rct_Region_003_Copy_Copy), GetRectCenter(gg_rct_Region_003_Copy_Copy_2) )
call SetUnitPositionLocFacingLocBJ( gg_unit_hcth_0000, GetRectCenter(gg_rct_Region_003_Copy_Copy_2), GetRectCenter(gg_rct_Region_003_Copy_Copy) )
call SetUnitPositionLocFacingLocBJ( gg_unit_hcth_0044, GetRectCenter(gg_rct_Region_003_Copy_Copy_2_Copy_Copy_2), GetRectCenter(gg_rct_Region_003_Copy_Copy_2_Copy_Copy) )
call SetUnitPositionLocFacingLocBJ( gg_unit_hcth_0081, GetRectCenter(gg_rct_Region_003_Copy_Copy_2_Copy_Copy_2_Copy_2), GetRectCenter(gg_rct_Region_003_Copy_Copy_2_Copy_Copy_2_Copy) )
call SetUnitPositionLocFacingLocBJ( gg_unit_hcth_0206, GetRectCenter(gg_rct_Region_025), GetRectCenter(gg_rct_Region_025_Copy) )
call SetUnitPositionLocFacingLocBJ( gg_unit_hcth_0211, GetRectCenter(gg_rct_Region_025_Copy_3), GetRectCenter(gg_rct_Region_025_Copy_2) )
// GUARDS... PATROL!
call IssuePointOrderLocBJ( gg_unit_hcth_0010, "patrol", GetRectCenter(gg_rct_Region_003) )
call IssuePointOrderLocBJ( gg_unit_hcth_0009, "patrol", GetRectCenter(gg_rct_Region_003_Copy) )
call IssuePointOrderLocBJ( gg_unit_hcth_0044, "patrol", GetRectCenter(gg_rct_Region_003_Copy_Copy_2_Copy_Copy) )
call IssuePointOrderLocBJ( gg_unit_hcth_0081, "patrol", GetRectCenter(gg_rct_Region_003_Copy_Copy_2_Copy_Copy_2_Copy) )
call IssuePointOrderLocBJ( gg_unit_hcth_0206, "patrol", GetRectCenter(gg_rct_Region_025_Copy) )
call IssuePointOrderLocBJ( gg_unit_hcth_0211, "patrol", GetRectCenter(gg_rct_Region_025_Copy_2) )
call EnableTrigger( gg_trg_Peeing_Earl )
call EnableTrigger( gg_trg_Angry_Raph )
call DisableTrigger( gg_trg_UnreezeWhenCloaked )
call DisableTrigger( gg_trg_FreezeWhenUncloaked )
set udg_ColumnCounter = 0.00
set d = null
set d2 = null
set d3 = null
set r = null
set r2 = null
set u = null
set u2 = null
set u3 = null
set p = null
endfunction
//===========================================================================
function InitTrig_Reset takes nothing returns nothing
set gg_trg_Reset = CreateTrigger( )
call TriggerAddAction( gg_trg_Reset, function Trig_Reset_Actions )
endfunction
function Trig_GiveSight_Actions takes nothing returns nothing
local location l = GetUnitLoc(gg_unit_hpea_0025)
local unit u = gg_unit_hgry_0024
call SetUnitPositionLoc(u, l)
call SetUnitFacing(u, 0.00)
set l = null
set u = null
endfunction
//===========================================================================
function InitTrig_GiveSight takes nothing returns nothing
set gg_trg_GiveSight = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_GiveSight, 0.50 )
call TriggerAddAction( gg_trg_GiveSight, function Trig_GiveSight_Actions )
endfunction
function Trig_RandomHints_Actions takes nothing returns nothing
set udg_Counter = udg_Counter + 1
if (udg_Counter == 0) then
call DisplayTextToForce( GetPlayersAll(), "|c00008800Flashback:|r \"We are spies. We live only in shadow.\"" )
elseif(udg_Counter == 1) then
call DisplayTextToForce( GetPlayersAll(), "|c00008800Flashback:|r \"For a spy, patience is everything.\"" )
elseif(udg_Counter == 2) then
call DisplayTextToForce( GetPlayersAll(), "|c00008800Flashback:|r \"Out of the shadows, we are vulnerable. In the shadows, we are invincible.\"" )
elseif(udg_Counter == 3) then
call DisplayTextToForce( GetPlayersAll(), "|c00008800Flashback:|r \"We are always one with the shadow.\"" )
elseif(udg_Counter == 4) then
call DisplayTextToForce( GetPlayersAll(), "|c00008800Flashback:|r \"We are the spies of nightfall, we are the spies of ruin.\"")
elseif(udg_Counter == 5) then
call DisplayTextToForce( GetPlayersAll(), "|c00008800Flashback:|r \"We travel through eternal darkness, eternal shadow.\"")
elseif(udg_Counter == 6) then
call DisplayTextToForce( GetPlayersAll(), "|c00008800Flashback:|r \"If you must strike, strike and fade away.\"")
set udg_Counter = -1
endif
endfunction
//===========================================================================
function InitTrig_Flashbacks takes nothing returns nothing
set gg_trg_Flashbacks = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Flashbacks, 30.00 )
call TriggerAddAction( gg_trg_Flashbacks, function Trig_RandomHints_Actions )
endfunction
function Trig_Guard_1_Conditions takes nothing returns boolean
return Guard_Conditions(gg_unit_hcth_0010)
endfunction
//===========================================================================
function InitTrig_Guard_1 takes nothing returns nothing
set gg_trg_Guard_1 = CreateTrigger()
call TriggerRegisterTimerEventPeriodic( gg_trg_Guard_1, 0.50 )
call TriggerAddCondition( gg_trg_Guard_1, Condition( function Trig_Guard_1_Conditions ) )
call TriggerAddAction( gg_trg_Guard_1, function Trig_Caught )
endfunction
function Trig_Guard_2_Conditions takes nothing returns boolean
return Guard_Conditions(gg_unit_hcth_0009)
endfunction
//===========================================================================
function InitTrig_Guard_2 takes nothing returns nothing
set gg_trg_Guard_2 = CreateTrigger()
call TriggerRegisterTimerEventPeriodic( gg_trg_Guard_2, 0.50 )
call TriggerAddCondition( gg_trg_Guard_2, Condition( function Trig_Guard_2_Conditions ) )
call TriggerAddAction( gg_trg_Guard_2, function Trig_Caught )
endfunction
function Trig_Guard_3_Conditions takes nothing returns boolean
return Guard_Conditions(gg_unit_hcth_0011)
endfunction
//===========================================================================
function InitTrig_Guard_3 takes nothing returns nothing
set gg_trg_Guard_3 = CreateTrigger()
call TriggerRegisterTimerEventPeriodic( gg_trg_Guard_3, 0.50 )
call TriggerAddCondition( gg_trg_Guard_3, Condition( function Trig_Guard_3_Conditions ) )
call TriggerAddAction( gg_trg_Guard_3, function Trig_Caught )
endfunction
function Trig_Guard_4_Conditions takes nothing returns boolean
return Guard_Conditions(gg_unit_hcth_0000)
endfunction
//===========================================================================
function InitTrig_Guard_4 takes nothing returns nothing
set gg_trg_Guard_4 = CreateTrigger()
call TriggerRegisterTimerEventPeriodic( gg_trg_Guard_4, 0.50 )
call TriggerAddCondition( gg_trg_Guard_4, Condition( function Trig_Guard_4_Conditions ) )
call TriggerAddAction( gg_trg_Guard_4, function Trig_Caught )
endfunction
function Trig_Guard_5_Conditions takes nothing returns boolean
return Guard_Conditions(gg_unit_hcth_0044)
endfunction
//===========================================================================
function InitTrig_Guard_5 takes nothing returns nothing
set gg_trg_Guard_5 = CreateTrigger()
call TriggerRegisterTimerEventPeriodic( gg_trg_Guard_5, 0.50 )
call TriggerAddCondition( gg_trg_Guard_5, Condition( function Trig_Guard_5_Conditions ) )
call TriggerAddAction( gg_trg_Guard_5, function Trig_Caught )
endfunction
function Trig_Guard_6_Conditions takes nothing returns boolean
return Guard_Conditions(gg_unit_hcth_0081)
endfunction
//===========================================================================
function InitTrig_Guard_6 takes nothing returns nothing
set gg_trg_Guard_6 = CreateTrigger()
call TriggerRegisterTimerEventPeriodic( gg_trg_Guard_6, 0.50 )
call TriggerAddCondition( gg_trg_Guard_6, Condition( function Trig_Guard_6_Conditions ) )
call TriggerAddAction( gg_trg_Guard_6, function Trig_Caught )
endfunction
function Trig_Guard_7_Conditions takes nothing returns boolean
return Guard_Conditions(gg_unit_hcth_0206)
endfunction
//===========================================================================
function InitTrig_Guard_7 takes nothing returns nothing
set gg_trg_Guard_7 = CreateTrigger()
call TriggerRegisterTimerEventPeriodic( gg_trg_Guard_7, 0.50 )
call TriggerAddCondition( gg_trg_Guard_7, Condition( function Trig_Guard_7_Conditions ) )
call TriggerAddAction( gg_trg_Guard_7, function Trig_Caught )
endfunction
function Trig_Guard_8_Conditions takes nothing returns boolean
return Guard_Conditions(gg_unit_hcth_0211)
endfunction
//===========================================================================
function InitTrig_Guard_8 takes nothing returns nothing
set gg_trg_Guard_8 = CreateTrigger()
call TriggerRegisterTimerEventPeriodic( gg_trg_Guard_8, 0.50 )
call TriggerAddCondition( gg_trg_Guard_8, Condition( function Trig_Guard_8_Conditions ) )
call TriggerAddAction( gg_trg_Guard_8, function Trig_Caught )
endfunction
function Trig_IFYOUDIE_Actions takes nothing returns nothing
call PauseAllUnitsBJ( true )
call DisableTrigger( GetTriggeringTrigger() )
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 2, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 0, 0, 0, 0 )
call TriggerSleepAction( 2.10 )
call CustomDefeatBJ( Player(0), "You died!" )
endfunction
//===========================================================================
function InitTrig_IFYOUDIE takes nothing returns nothing
set gg_trg_IFYOUDIE = CreateTrigger( )
call TriggerRegisterUnitEvent( gg_trg_IFYOUDIE, gg_unit_hpea_0025, EVENT_UNIT_DEATH )
call TriggerAddAction( gg_trg_IFYOUDIE, function Trig_IFYOUDIE_Actions )
endfunction