//TESH.scrollpos=0
//TESH.alwaysfold=0
globals
hashtable udg_hash = InitHashtable()
endglobals
// ===========================
function LS takes nothing returns hashtable
//Returns hashtable for use in saving data to handles
return udg_hash
endfunction
function ControlCircle_Filter takes nothing returns nothing
if GetEnumUnit() != udg_TempUnit and GetPlayerId(GetOwningPlayer(GetEnumUnit())) < 12 and IsUnitAliveBJ(GetEnumUnit()) then
call ForceAddPlayer(udg_TempForce, GetOwningPlayer(GetEnumUnit()))
set udg_TempPlayer=GetOwningPlayer(GetEnumUnit())
endif
endfunction
function RegisterControlCircle takes unit circle returns nothing
local group k
local force o=CreateForce()
local location m=GetUnitLoc(circle)
loop
exitwhen udg_GameOver==true
call ForceClear(o)
set k = GetUnitsInRangeOfLocAll(200.0, m)
set udg_TempForce=o
set udg_TempUnit=circle
set udg_TempPlayer=GetOwningPlayer(circle)
call ForGroup(k, function ControlCircle_Filter)
if CountPlayersInForceBJ(o) <= 1 then
call SetUnitOwner(circle,udg_TempPlayer,true)
endif
call DestroyGroup(k)
call PolledWait(1.0)
endloop
endfunction
function RCC_2 takes nothing returns nothing
call RegisterControlCircle(udg_TempUnit)
endfunction
function DeploymentShip_AppropriateActions takes nothing returns nothing
local unit b=GetEnumUnit()
call SetUnitVertexColorBJ( b, 100, 100, 100, 100.00 )
call PauseUnitBJ( true, b )
call ShowUnitHide(b)
endfunction
function DeploymentShip_AppropriateActions2 takes nothing returns nothing
local unit b=GetEnumUnit()
call SetUnitPositionLoc(b,udg_TempPoint)
call SetUnitVertexColorBJ( b, 100, 100, 100, 0.00 )
call PauseUnitBJ( false, b )
call ShowUnitShow(b)
endfunction
function DeploymentShip takes group c, location r, real descendspeed, real scale returns boolean
local unit q
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 12
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set udg_TempPoint2 = PolarProjectionBJ(r, 256*scale, ( I2R(GetForLoopIndexA()) * 30.00 ))
call AddSpecialEffectLocBJ( udg_TempPoint2, "Abilities\\Weapons\\VengeanceMissile\\VengeanceMissile.mdl" )
call RemoveLocation( udg_TempPoint2 )
set udg_TempReal=1500/descendspeed+2
call ExecuteFunc( "CleanSFX_R" )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call ForGroup(c, function DeploymentShip_AppropriateActions)
call CreateNUnitsAtLoc( 1, 'h001', Player(PLAYER_NEUTRAL_PASSIVE),r, bj_UNIT_FACING )
set q=GetLastCreatedUnit()
call SetUnitScale(q, scale*2, scale*2, scale*2)
call SetUnitFlyHeightBJ( q, 0.00, descendspeed )
call TriggerSleepAction( 1500/descendspeed+2)
call SetUnitFlyHeightBJ(q, 1600.00, descendspeed*3)
call AddSpecialEffectLocBJ( r, "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl" )
call ExecuteFunc( "CleanSFX20" )
set udg_TempPoint=r
call ForGroup(c, function DeploymentShip_AppropriateActions2)
call RemoveLocation(r)
call DestroyGroup(c)
return true
endfunction
function CleanSFX_R takes nothing returns nothing
local effect a=GetLastCreatedEffectBJ()
call TriggerSleepAction(udg_TempReal)
call DestroyEffect(a)
endfunction
function CleanSFX20 takes nothing returns nothing
local effect a=GetLastCreatedEffectBJ()
call TriggerSleepAction(20.0)
call DestroyEffect(a)
endfunction
function DamageAndEffectAreaWithDelay_Child_Child takes nothing returns nothing
call UnitDamageTarget(GetLastCreatedUnit(), GetEnumUnit(), udg_TempReal,false,false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
endfunction
function DamageAndEffectAreaWithDelay_Child takes nothing returns nothing
local timer t=GetExpiredTimer()
local location r=LoadLocationHandle(LS(), GetHandleId(t), StringHash("r"))
local real radius=LoadReal(LS(), GetHandleId(t), StringHash("radius"))
local real damage=LoadReal(LS(), GetHandleId(t), StringHash("damage"))
local integer effectcreate=LoadInteger(LS(), GetHandleId(t), StringHash("effectcreate"))
local group i=GetUnitsInRangeOfLocAll(radius,r)
call FlushChildHashtable(LS(), GetHandleId(t))
call DestroyTimer(t)
call CreateUnitAtLoc(Player(13),effectcreate,r,GetRandomDirectionDeg())
set udg_TempReal=damage
call ForGroup(i,function DamageAndEffectAreaWithDelay_Child_Child)
call RemoveLocation(r)
call DestroyGroup(i)
endfunction
function DamageAndEffectAreaWithDelay takes location r, real radius, real damage, real delay, integer effectcreate returns nothing
local timer t=CreateTimer()
call SaveLocationHandle(LS(), GetHandleId(t), StringHash("r"), r)
call SaveReal(LS(), GetHandleId(t), StringHash("radius"), radius)
call SaveReal(LS(), GetHandleId(t), StringHash("damage"), damage)
call SaveInteger(LS(), GetHandleId(t), StringHash("effectcreate"), effectcreate)
call TimerStart(t,delay,false,function DamageAndEffectAreaWithDelay_Child)
endfunction
function NewUnitRegister takes unit h returns nothing
if GetUnitUserData(h) == 0 then
//Should be 8192 and 1, but I'm not going to change it while it's working.
set udg_Array_On = udg_Array_On + 1
if udg_Array_On >= 8000 then
set udg_Array_On = 100
endif
if udg_UnitAssignation[udg_Array_On] != null then
loop
exitwhen udg_UnitAssignation[udg_Array_On] == null
set udg_Array_On = udg_Array_On + 1
endloop
endif
set udg_UnitAssignation[udg_Array_On] = h
call SetUnitUserData(h,udg_Array_On)
endif
endfunction
//Faster to type than GetUnitUserData() and easier to remember.
function GetUnitAN takes unit h returns integer
return GetUnitUserData(h)
endfunction
//When a unit enters the map, this will catch it and assign a number to it.
//The bad part is, you shouldn't reference a unit immediately after creating it.
//If you must, call NewUnitRegister(GetLastCreatedUnit()). A built in safety guard will prevent this function from overwriting.
function Redirect_RegisterUnit takes nothing returns nothing
if GetUnitUserData(GetTriggerUnit()) != 0 then
return
endif
call NewUnitRegister(GetTriggerUnit())
endfunction
//==============================
//Give pre-placed units a number.
//You should still call a new register before accessing if you immediately want it during map init.
function PrePlacedUnits takes nothing returns nothing
call NewUnitRegister(GetEnumUnit())
endfunction
function Init_ForGlobal takes nothing returns nothing
//Fun fun fun, make sure to call this somewhere.
local group x=GetUnitsInRectAll(GetPlayableMapRect())
local trigger v=CreateTrigger()
call TriggerRegisterEnterRectSimple( v, GetPlayableMapRect() )
call TriggerAddAction( v, function Redirect_RegisterUnit)
call ForGroup(x,function PrePlacedUnits)
call DestroyGroup(x)
set x=null
endfunction
Name | Type | is_array | initial_value |
AllControlPoints | group | No | |
Array_On | integer | No | |
GameEnd | timer | No | |
GameOver | boolean | No | |
Plane_StationaryPoint | location | Yes | |
PlaneGroup | group | No | |
Scoreboard | leaderboard | No | |
TempForce | force | No | |
TempInt | integer | No | |
TempPlayer | player | No | |
TempPoint | location | No | |
TempPoint2 | location | No | |
TempReal | real | No | |
TempUnit | unit | No | |
TempUnitGroup | group | No | |
TheNullUnit | unit | No | |
UnitAssignation | unit | Yes |
//TESH.scrollpos=0
//TESH.alwaysfold=0
//===========================================================================
function InitTrig_ArrayDat takes nothing returns nothing
call Init_ForGlobal()
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_TacticalBarrage_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A001' ) ) then
return false
endif
return true
endfunction
function Trig_TacticalBarrage_Actions takes nothing returns nothing
local location b=GetSpellTargetLoc()
call IssueImmediateOrderBJ( GetSpellAbilityUnit(), "stop" )
call PolledWait(1.0)
call CreateNUnitsAtLoc( 1, 'h003', Player(PLAYER_NEUTRAL_PASSIVE), b, bj_UNIT_FACING )
call SetUnitFlyHeightBJ( GetLastCreatedUnit(), 0.00, 3000.00 )
call DamageAndEffectAreaWithDelay(b,150.0,800.0,0.5, 'h004')
endfunction
//===========================================================================
function InitTrig_TacticalBarrage takes nothing returns nothing
set gg_trg_TacticalBarrage = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_TacticalBarrage, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_TacticalBarrage, Condition( function Trig_TacticalBarrage_Conditions ) )
call TriggerAddAction( gg_trg_TacticalBarrage, function Trig_TacticalBarrage_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_IrradiateArea_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A002' ) ) then
return false
endif
return true
endfunction
function Trig_IrradiateArea_Actions takes nothing returns nothing
local location b=GetSpellTargetLoc()
call IssueImmediateOrderBJ( GetSpellAbilityUnit(), "stop" )
call PolledWait(3.0)
call CreateNUnitsAtLoc( 1, 'h005', Player(PLAYER_NEUTRAL_PASSIVE), b, bj_UNIT_FACING )
call SetUnitFlyHeightBJ( GetLastCreatedUnit(), 0.00, 750.00 )
call DamageAndEffectAreaWithDelay(b,150.0,100.0,2, 'h006')
endfunction
//===========================================================================
function InitTrig_IrradiateArea takes nothing returns nothing
set gg_trg_IrradiateArea = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_IrradiateArea, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_IrradiateArea, Condition( function Trig_IrradiateArea_Conditions ) )
call TriggerAddAction( gg_trg_IrradiateArea, function Trig_IrradiateArea_Actions )
endfunction