Cokemonkey11
Spell Reviewer
- Joined
- May 9, 2006
- Messages
- 3,575
Here's what I have so far:
And here's what I'd like to have inside EMPPeriodic:
In the past I've used triggers or globals, but I understand there's a way to use locals/timers as well. What am I doing wrong?
JASS:
function EMPPeriodic takes nothing returns nothing
endfunction
function Trig_crusaderEMPBall_Actions takes nothing returns nothing
local location castOff
local timer time
local unit empBall
local integer i
local location empBallOff
if GetSpellAbilityId()=='A041' then
set castOff = PolarProjectionBJ(GetUnitLoc(GetSpellAbilityUnit()),150,GetUnitFacing(GetSpellAbilityUnit()))
set empBall = CreateUnit(GetOwningPlayer(GetSpellAbilityUnit()),'h00H',GetLocationX(castOff),GetLocationY(castOff),GetUnitFacing(GetSpellAbilityUnit()))
call UnitApplyTimedLife(empBall,'BTLF',5)
set time = CreateTimer()
set i = 0
call TimerStart(time,.03,true,function EMPPeriodic)
endif
endfunction
function InitTrig_crusaderEMPBall takes nothing returns nothing
set gg_trg_crusaderEMPBall = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_crusaderEMPBall,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction(gg_trg_crusaderEMPBall,function Trig_crusaderEMPBall_Actions)
endfunction
And here's what I'd like to have inside EMPPeriodic:
JASS:
set i = i+1
if i > 200 then
call DestroyTimer(time)
endif
set empBallOff = PolarProjectionBJ(GetUnitLoc(empBall),15,GetUnitFacing(empBall))
call SetUnitX(empBall,GetLocationX(empBallOff))
call SetUnitY(empBall,GetLocationY(empBallOff))
In the past I've used triggers or globals, but I understand there's a way to use locals/timers as well. What am I doing wrong?