scope Slide initializer Init
globals
private constant string path = "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl"
private constant trigger T = CreateTrigger() //• T == Main Trigger •|
private constant group g = CreateGroup() //• g == Unit Group; do not destroy •|
private boolean move //• move == Will move unit "u" if true •|
private location eloc = Location(0,0) //• eloc == Test Location •|
private location loc = eloc //• loc == True Location •|
private real array cos //• cos & sin are pre-calculated •|
private real array sin //••••••••••••••••••••••••••••••••••••••|
private real ex
private real ey
private real x
private real y
private real z
private integer e
private unit u
endglobals
private function Slide takes nothing returns nothing
call GroupEnumUnitsInRect( g , bj_PLAYABLE_MAP_RECT , null )
//* Init Loop 1 ********************** Loop 1 Rdy
loop
set u = FirstOfGroup( g )
exitwhen u == null
call GroupRemoveUnit( g , u )
set move = false
set x = GetUnitX(u)
set y = GetUnitY(u)
call MoveLocation(loc,x,y)
set z = GetLocationZ(loc)
set e = 0
//* Init Loop 2 ********************** Loop 2 Rdy
loop
set ex = x + 3 * cos[e]
set ey = y + 3 * sin[e]
call MoveLocation(eloc,ex,ey)
//* Evaluate Height ******************* MOVE? Rdy
if GetLocationZ(eloc) < z then
call MoveLocation(loc,ex,ey)
set z = GetLocationZ(loc)
set move = true
endif
//* End Evaluation ******************** MOVE? End
set e = e + 1
exitwhen e == 16
endloop
//* End Loop 2 *********************** Loop 2 End
if move then
call DestroyEffect(AddSpecialEffect(path,x,y))
call SetUnitPositionLoc(u,loc)
endif
endloop
//* End Loop 1 *********************** Loop 1 End
endfunction
private function Toggle takes nothing returns nothing
if IsTriggerEnabled(T) then
call DisableTrigger(T)
else
call EnableTrigger(T)
endif
endfunction
private function Remove takes nothing returns nothing
local unit v
call GroupEnumUnitsInRect( g , bj_PLAYABLE_MAP_RECT , null )
set e = 1
//* Loop - Pick Random Unit to Remove ********//*
loop
set v = FirstOfGroup( g )
exitwhen v == null
call GroupRemoveUnit( g , v )
if GetRandomInt( 1 , e ) == 1 then
set u = v
set e = e + 1
endif
endloop
//* End Loop *********************************//*
call KillUnit( u )
set v = null
endfunction
private function Add takes nothing returns nothing
call CreateUnit(GetTriggerPlayer(),'hpea',0,0)
endfunction
//* The following initializes the four triggers/events/actions...
private function Maketrg takes string msg, code func returns nothing
local trigger t = CreateTrigger()
call TriggerAddAction( t , func )
set e = 0
loop //* Init Player 0-11 (Players 1-12) *//
call TriggerRegisterPlayerChatEvent( t , Player( e ) , msg , true)
set e = e + 1
exitwhen e == 11
endloop
set t = null
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger() //* Toggle on/off Trig
call TriggerAddAction(t,function Toggle) //* Toggle Trig actions
call TriggerAddAction(T,function Slide) //* Main Trig actions
call TriggerRegisterTimerEvent(T,0.03,true) //* Main Trig events
call Maketrg( "remove" , function Remove ) //* Init Remove Unit Trig
call Maketrg( "add" , function Add ) //* Init Add Unit Trig
set e = 0
loop
if e < 12 then
call TriggerRegisterPlayerEvent(t,Player(e),EVENT_PLAYER_END_CINEMATIC)
endif
set z = e + 1 * 22.5 * bj_DEGTORAD
set cos[ e ] = Cos( z )
set sin[ e ] = Sin( z )
set e = e + 1
exitwhen e == 16
endloop
set t = null
endfunction
endscope