globals
integer = udg_BT
boolean array udg_BT_Closed
real array udg_BT_Damage
real array udg_BT_Duration
group = udg_BT_Group
unit array udg_BT_Hero
real array udg_BT_Interval
real array udg_BT_IntervalCheck
integer array udg_BT_Level
boolean array udg_BT_On
location array udg_BT_Point
integer = udg_BT_Skip
unit array udg_BT_Target
location array udg_BT_TargetPoint
integer = udg_BT_Times
unit array udg_BT_Trap
endglobals
function Trig_Bear_Trap_Loop_Func001Func001Func001Func005Func011Func005Func008Func006001 takes nothing returns boolean
return ( GetLocationX(udg_BT_Point[1]) == GetLocationX(udg_BT_Point[2]) )
endfunction
function Trig_Bear_Trap_Loop_Func001Func001Func001Func005Func011Func005Func008Func006002 takes nothing returns boolean
return ( GetLocationY(udg_BT_Point[1]) == GetLocationY(udg_BT_Point[2]) )
endfunction
function Trig_Bear_Trap_Loop_Func001Func001Func001Func005Func011Func005Func008C takes nothing returns boolean
if ( not GetBooleanOr( Trig_Bear_Trap_Loop_Func001Func001Func001Func005Func011Func005Func008Func006001(), Trig_Bear_Trap_Loop_Func001Func001Func001Func005Func011Func005Func008Func006002() ) ) then
return false
endif
return true
endfunction
function Trig_Bear_Trap_Loop_Func001Func001Func001Func005Func011Func005C takes nothing returns boolean
if ( not ( IsUnitAliveBJ(udg_BT_Target[udg_BT]) == true ) ) then
return false
endif
return true
endfunction
function Trig_Bear_Trap_Loop_Func001Func001Func001Func005Func011C takes nothing returns boolean
if ( not ( udg_BT_IntervalCheck[udg_BT] >= udg_BT_Interval[udg_BT] ) ) then
return false
endif
return true
endfunction
function Trig_Bear_Trap_Loop_Func001Func001Func001Func005Func019002003001001 takes nothing returns boolean
return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_GROUND) == true )
endfunction
function Trig_Bear_Trap_Loop_Func001Func001Func001Func005Func019002003001002 takes nothing returns boolean
return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_MECHANICAL) == false )
endfunction
function Trig_Bear_Trap_Loop_Func001Func001Func001Func005Func019002003001 takes nothing returns boolean
return GetBooleanAnd( Trig_Bear_Trap_Loop_Func001Func001Func001Func005Func019002003001001(), Trig_Bear_Trap_Loop_Func001Func001Func001Func005Func019002003001002() )
endfunction
function Trig_Bear_Trap_Loop_Func001Func001Func001Func005Func019002003002001 takes nothing returns boolean
return ( IsUnitDeadBJ(GetFilterUnit()) == false )
endfunction
function Trig_Bear_Trap_Loop_Func001Func001Func001Func005Func019002003002002 takes nothing returns boolean
return ( IsUnitAlly(GetFilterUnit(), GetOwningPlayer(udg_BT_Hero[udg_BT])) == false )
endfunction
function Trig_Bear_Trap_Loop_Func001Func001Func001Func005Func019002003002 takes nothing returns boolean
return GetBooleanAnd( Trig_Bear_Trap_Loop_Func001Func001Func001Func005Func019002003002001(), Trig_Bear_Trap_Loop_Func001Func001Func001Func005Func019002003002002() )
endfunction
function Trig_Bear_Trap_Loop_Func001Func001Func001Func005Func019002003 takes nothing returns boolean
return GetBooleanAnd( Trig_Bear_Trap_Loop_Func001Func001Func001Func005Func019002003001(), Trig_Bear_Trap_Loop_Func001Func001Func001Func005Func019002003002() )
endfunction
function Trig_Bear_Trap_Loop_Func001Func001Func001Func005Func023Func001A takes nothing returns nothing
set udg_BT_Target[udg_BT] = GetEnumUnit()
set udg_BT_Closed[udg_BT] = true
call SetUnitAnimation( udg_BT_Trap[udg_BT], "death spell" )
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
// Trap being visible if you stack in it. You can remove lower line if you want enemy to do not know what damaging it.
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
endfunction
function Trig_Bear_Trap_Loop_Func001Func001Func001Func005Func023C takes nothing returns boolean
if ( not ( CountUnitsInGroup(udg_BT_Group) > 0 ) ) then
return false
endif
return true
endfunction
function Trig_Bear_Trap_Loop_Func001Func001Func001Func005C takes nothing returns boolean
if ( not ( udg_BT_Closed[udg_BT] == false ) ) then
return false
endif
return true
endfunction
function Trig_Bear_Trap_Loop_Func001Func001Func001Func007C takes nothing returns boolean
if ( ( udg_BT_Duration[udg_BT] <= 0.00 ) ) then
return true
endif
if ( ( udg_BT_Trap[udg_BT] == null ) ) then
return true
endif
if ( ( IsUnitDeadBJ(udg_BT_Trap[udg_BT]) == true ) ) then
return true
endif
return false
endfunction
function Trig_Bear_Trap_Loop_Func001Func001Func001Func008Func005C takes nothing returns boolean
if ( ( udg_BT_Trap[udg_BT] == null ) ) then
return true
endif
if ( ( IsUnitDeadBJ(udg_BT_Trap[udg_BT]) == true ) ) then
return true
endif
return false
endfunction
function Trig_Bear_Trap_Loop_Func001Func001Func001Func008C takes nothing returns boolean
if ( not Trig_Bear_Trap_Loop_Func001Func001Func001Func008Func005C() ) then
return false
endif
return true
endfunction
function Trig_Bear_Trap_Loop_Func001Func001Func001Func010C takes nothing returns boolean
if ( not ( udg_BT < udg_BT_Times ) ) then
return false
endif
return true
endfunction
function Trig_Bear_Trap_Loop_Func001Func001Func001Func014C takes nothing returns boolean
if ( not ( udg_BT_Skip == 0 ) ) then
return false
endif
return true
endfunction
function Trig_Bear_Trap_Loop_Func001Func001Func001C takes nothing returns boolean
if ( not Trig_Bear_Trap_Loop_Func001Func001Func001Func007C() ) then
return false
endif
return true
endfunction
function Trig_Bear_Trap_Loop_Func001Func001C takes nothing returns boolean
if ( not ( udg_BT_On[udg_BT] == true ) ) then
return false
endif
return true
endfunction
function Trig_Bear_Trap_Loop_Actions takes nothing returns nothing
set udg_BT = 1
loop
exitwhen udg_BT > udg_BT_Times
if ( Trig_Bear_Trap_Loop_Func001Func001C() ) then
if ( Trig_Bear_Trap_Loop_Func001Func001Func001C() ) then
if ( Trig_Bear_Trap_Loop_Func001Func001Func001Func008C() ) then
else
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
// Killing trap because if it is exist and it is alive but duration elapsed it must to die.
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
call KillUnit( udg_BT_Trap[udg_BT] )
endif
set udg_BT_On[udg_BT] = false
if ( Trig_Bear_Trap_Loop_Func001Func001Func001Func010C() ) then
set udg_BT_On[udg_BT] = udg_BT_On[udg_BT_Times]
set udg_BT_Closed[udg_BT] = udg_BT_Closed[udg_BT_Times]
set udg_BT_Damage[udg_BT] = udg_BT_Damage[udg_BT_Times]
set udg_BT_Duration[udg_BT] = udg_BT_Duration[udg_BT_Times]
set udg_BT_Hero[udg_BT] = udg_BT_Hero[udg_BT_Times]
set udg_BT_Interval[udg_BT] = udg_BT_Interval[udg_BT_Times]
set udg_BT_IntervalCheck[udg_BT] = udg_BT_IntervalCheck[udg_BT_Times]
set udg_BT_Level[udg_BT] = udg_BT_Level[udg_BT_Times]
set udg_BT_Target[udg_BT] = udg_BT_Target[udg_BT_Times]
set udg_BT_Trap[udg_BT] = udg_BT_Trap[udg_BT_Times]
else
endif
set udg_BT = ( udg_BT - 1 )
set udg_BT_Skip = ( udg_BT_Skip - 1 )
set udg_BT_Times = ( udg_BT_Times - 1 )
if ( Trig_Bear_Trap_Loop_Func001Func001Func001Func014C() ) then
set udg_BT_Times = 0
call DisableTrigger( GetTriggeringTrigger() )
else
endif
else
set udg_BT_Point[1] = GetUnitLoc(udg_BT_Trap[udg_BT])
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
// If trap is not closed actions below are runing
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
if ( Trig_Bear_Trap_Loop_Func001Func001Func001Func005C() ) then
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
// Picking units around to catch one
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
set udg_BT_Group = GetUnitsInRangeOfLocMatching(75.00, udg_BT_Point[1], Condition(function Trig_Bear_Trap_Loop_Func001Func001Func001Func005Func019002003))
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
// If that is some unit around, it catch him and close
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
if ( Trig_Bear_Trap_Loop_Func001Func001Func001Func005Func023C() ) then
call ForGroupBJ( GetRandomSubGroup(1, udg_BT_Group), function Trig_Bear_Trap_Loop_Func001Func001Func001Func005Func023Func001A )
else
endif
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
// Clearing group to destroy leaks
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
call DestroyGroup(udg_BT_Group)
else
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
// Lower action is seting point where victum must return. like that victum cant walk.
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
set udg_BT_Point[2] = GetUnitLoc(udg_BT_Target[udg_BT])
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
// Interval check must increase with 0.02 second like loop speed. Interval show per how much time unit recive damage.
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
if ( Trig_Bear_Trap_Loop_Func001Func001Func001Func005Func011C() ) then
set udg_BT_IntervalCheck[udg_BT] = 0.00
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
// Trap destroys when victum dies.
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
if ( Trig_Bear_Trap_Loop_Func001Func001Func001Func005Func011Func005C() ) then
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
// If victum is exacly at position of trap, it means what it is not mooving and will recive less damage
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
if ( Trig_Bear_Trap_Loop_Func001Func001Func001Func005Func011Func005Func008C() ) then
call UnitDamageTargetBJ( udg_BT_Hero[udg_BT], udg_BT_Target[udg_BT], udg_BT_Damage[udg_BT], ATTACK_TYPE_NORMAL, DAMAGE_TYPE_UNKNOWN )
else
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
// But if victum trying to move, coardinates victum point will be diferent and it recive 150% damage more. You can change it by changing multiplayer number (1.50 at spell)
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
call UnitDamageTargetBJ( udg_BT_Hero[udg_BT], udg_BT_Target[udg_BT], ( udg_BT_Damage[udg_BT] * 1.65 ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_UNKNOWN )
endif
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
// Removing point to avoid leaks.
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
// Special effect creates to enemy origin, because damage recived at legs.
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
call AddSpecialEffectTargetUnitBJ( "origin", udg_BT_Target[udg_BT], "Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
else
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
// Victum dies and trap must be destroyed, so duration must be zero too.
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
set udg_BT_Duration[udg_BT] = 0.00
endif
else
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
// Interval check variable increased by loop speed to become greater or equal to interval and cause damage.
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
set udg_BT_IntervalCheck[udg_BT] = ( udg_BT_IntervalCheck[udg_BT] + 0.02 )
endif
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
// Here victim moving to position of trap with function and not action. Diferent with Instant move of unit is: unit can walk while mooving :P unit can attack and cast spells. while mooving, also creeps will return to their camp place.
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
call SetUnitX(udg_BT_Target[udg_BT], GetLocationX(udg_BT_Point[1]))
call SetUnitY(udg_BT_Target[udg_BT], GetLocationY(udg_BT_Point[1]))
call RemoveLocation(udg_BT_Point[2])
set udg_BT_Duration[udg_BT] = ( udg_BT_Duration[udg_BT] - 0.02 )
endif
call RemoveLocation(udg_BT_Point[1])
endif
else
endif
set udg_BT = udg_BT + 1
endloop
endfunction
//===========================================================================
function InitTrig_Bear_Trap_Loop takes nothing returns nothing
local trigger gg_trg_Bear_Trap_Loop = CreateTrigger( )
call DisableTrigger( gg_trg_Bear_Trap_Loop )
call TriggerRegisterTimerEventPeriodic( gg_trg_Bear_Trap_Loop, 0.02 )
call TriggerAddAction( gg_trg_Bear_Trap_Loop, function Trig_Bear_Trap_Loop_Actions )
endfunction