- Joined
- Jul 14, 2007
- Messages
- 59
I'm trying to get this spell to work, the only problem is that the dummy unit won't fire the spell. I think it has something to do with call IssuePointOrderById(dummy, S2I("shockwave"), tx, ty), because that's the only part the debug hasn't worked on.
The spell is supposed to shoot shockwaves repeatedly at target point.
Also, exactly where should I fix leaks? I'm not very experienced with JASS, and I don't want my map to lag.
The spell is supposed to shoot shockwaves repeatedly at target point.
Also, exactly where should I fix leaks? I'm not very experienced with JASS, and I don't want my map to lag.
JASS:
function Trig_Banefire_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A004'
endfunction
function BanefireExpire takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer level = GetHandleInt(t, "level")
local unit caster = GetHandleUnit(t, "caster")
local integer steps = GetHandleInt(t, "steps")
local real angle = GetHandleReal(t, "angle")
local real cx = GetHandleReal(t, "cx")
local real cy = GetHandleReal(t, "cy")
local real tx = GetHandleReal(t, "tx")
local real ty = GetHandleReal(t, "ty")
local unit dummy = CreateUnit(GetOwningPlayer(caster), 'h000', cx, cy, angle)
call UnitAddAbilityBJ('A005', dummy)
call SetUnitAbilityLevelSwapped('A005', dummy, level)
call UnitApplyTimedLifeBJ(2.00, 'BTLF', dummy)
call IssuePointOrderById(dummy, S2I("shockwave"), tx, ty)
if ( steps <= 1 ) then
call FlushHandleLocals(t)
call DestroyTimer(t)
return
endif
call SetHandleInt(t, "steps", steps-1)
endfunction
function Trig_Banefire_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local integer level = GetUnitAbilityLevelSwapped('A004', caster)
local real cx = GetUnitX(caster)
local real cy = GetUnitY(caster)
local real tx = GetLocationX(GetSpellTargetLoc())
local real ty = GetLocationY(GetSpellTargetLoc())
local real angle = Atan2(ty - GetUnitY(caster), tx - GetUnitX(caster))
local timer t = CreateTimer()
call SetHandleInt(t, "level", level)
call SetHandleInt(t, "steps", 20)
call SetHandleReal(t, "angle", angle)
call SetHandleReal(t, "cx", cx)
call SetHandleReal(t, "cy", cy)
call SetHandleReal(t, "tx", tx)
call SetHandleReal(t, "ty", ty)
call SetHandleHandle(t, "caster", caster)
call TimerStart(t, .2, true, function BanefireExpire)
set caster = null
set t = null
endfunction
//===========================================================================
function InitTrig_Banefire takes nothing returns nothing
set gg_trg_Banefire = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Banefire, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Banefire, Condition( function Trig_Banefire_Conditions ) )
call TriggerAddAction( gg_trg_Banefire, function Trig_Banefire_Actions )
endfunction