scope Light initializer InitTrig_Light
globals
private constant string Lightning = "HWSB" //RAWCODE!
private constant integer SPELL_ID = 'A003'
private constant integer DUM_ID = 'h002'
private constant integer DUM_SPEL = 'A004'
private constant integer DUM_BUFF = 'BTLF'
private constant string Effect = "Abilities\\Spells\\Human\\ReviveHuman\\ReviveHuman.mdl"
private constant real Real1 = 90
private constant real Real2 = 180
private constant real Real3 = 270
private constant real Real4 = 360
private constant real Real5 = 400
private constant real Real6 = 750
endglobals
private function Light_Conditions takes nothing returns boolean
return GetSpellAbilityId() == SPELL_ID
endfunction
private function Light_Actions takes nothing returns nothing
local unit C = GetSpellAbilityUnit()
local location CL = GetUnitLoc(C)
local real CR = GetUnitX(C)
local real RC = GetUnitY(C)
local player Y = GetOwningPlayer(C)
local integer Level = GetUnitAbilityLevel(C,SPELL_ID)
local rect R = RectFromCenterSizeBJ(CL,Real6,Real6)
local real X1 = CR + Real5 * Cos(Real1*bj_DEGTORAD)
local real X2 = CR + Real5 * Cos(Real2*bj_DEGTORAD)
local real X3 = CR + Real5 * Cos(Real3*bj_DEGTORAD)
local real X4 = CR + Real5 * Cos(Real4*bj_DEGTORAD)
local real Y1 = RC + Real5 * Sin(Real1*bj_DEGTORAD)
local real Y2 = RC + Real5 * Sin(Real2*bj_DEGTORAD)
local real Y3 = RC + Real5 * Sin(Real3*bj_DEGTORAD)
local real Y4 = RC + Real5 * Sin(Real4*bj_DEGTORAD)
local lightning G1 = AddLightning(Effect,true,X1,Y1,X2,Y2)
local lightning G2 = AddLightning(Effect,true,X2,Y2,X3,Y3)
local lightning G3 = AddLightning(Effect,true,X3,Y3,X4,Y4)
local lightning G4 = AddLightning(Effect,true,X4,Y4,X1,Y1)
local location M
local integer P = 1
local unit D = CreateUnitAtLoc(Y,DUM_ID,CL,Real6)
call UnitAddAbility(D,DUM_SPEL)
call SetUnitAbilityLevel(D,DUM_ID,Level)
loop
exitwhen P==15
set M = GetRandomLocInRect(R)
call DestroyEffect(AddSpecialEffectLoc(Effect,M))
set M = GetRandomLocInRect(R)
call DestroyEffect(AddSpecialEffectLoc(Effect,M))
set M = GetRandomLocInRect(R)
call DestroyEffect(AddSpecialEffectLoc(Effect,M))
set M = GetRandomLocInRect(R)
call DestroyEffect(AddSpecialEffectLoc(Effect,M))
set M = GetRandomLocInRect(R)
call DestroyEffect(AddSpecialEffectLoc(Effect,M))
call RemoveLocation(M)
call TriggerSleepAction(.3)
set P=P+1
endloop
call UnitApplyTimedLife(D,DUM_BUFF,.5)
call RemoveRect(R)
call DestroyLightning(G1)
call DestroyLightning(G2)
call DestroyLightning(G3)
call DestroyLightning(G4)
endfunction
//===========================================================================
private function InitTrig_Light takes nothing returns nothing
local trigger I = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(I, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition(I, Condition( function Light_Conditions ) )
call TriggerAddAction(I, function Light_Actions )
set I=null
call Preload(Effect)
call Preload(Lightning)
endfunction
endscope