Grurf
Ultra Cool Member
- Reaction score
- 30
Well, I'm pretty much stuck. Have a look at the bold parts of this JASS code:
The first one (that is actually executed after the second one) works perfectly, but the second one does not play. I tried disabling the changing of facing, animation speed and flying height, but the animation still doesn't play. It's like the caster just stands while jumping up. Can anyone here find the reason that stops my caster from playing it's animation?
Edit:
It seems that this is caused by the instability of WEU. I got it working again by putting the call SetUnitAnimationById in another place but after I added some other things it stopped working again, and even if I reverted it back to the old state it kept refusing to work.
Code:
function Trig_Wave_Jump_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A000'
endfunction
function Trig_Wave_Jump_End takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = GetAttachedUnit(t, "u")
local real h = GetAttachedReal(t, "h")
local effect e = GetAttachedEffect(t, "e")
local real x = GetAttachedReal(t, "x")
local real y = GetAttachedReal(t, "y")
local integer i = GetAttachedInt(t, "i")
call SetUnitTimeScale(u, 1.0)
call SetUnitAnimation(u, "stand")
call DestroyEffect(e)
call CasterSetCastSource(GetUnitX(u),GetUnitY(u))
call CasterCastAbilityLevelPoint(GetOwningPlayer(u), 'A002', i, "carrionswarm", x, y, true)
set t = null
set u = null
set e = null
endfunction
function Trig_Wave_Jump_StrikeLoop takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = GetAttachedUnit(t, "u")
local real h = GetAttachedReal(t, "h") - 12
local effect e = GetAttachedEffect(t, "e")
local real x = GetAttachedReal(t, "x")
local real y = GetAttachedReal(t, "y")
local integer i = GetAttachedInt(t, "i")
call SetUnitFlyHeight(u, h, 99999.9)
if (h <= 0.0) then
call SetUnitFlyHeight(u, 0.0, 99999.9)
call PauseTimer(t)
call CleanAttachedVars(t)
call DestroyTimer(t)
set t = CreateTimer()
call AttachObject(t, "u", u)
call AttachObject(t, "e", e)
call AttachReal(t, "h", h)
call AttachReal(t, "x", x)
call AttachReal(t, "y", y)
call AttachInt(t, "i", i)
call TimerStart(t, 0.04, false, function Trig_Wave_Jump_End)
else
call AttachReal(t, "h", h)
endif
set t = null
set u = null
set e = null
endfunction
function Trig_Wave_Jump_Strike takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = GetAttachedUnit(t, "u")
local real h = GetAttachedReal(t, "h")
local real r = GetAttachedReal(t, "r")
local effect e = GetAttachedEffect(t, "e")
local real x = GetAttachedReal(t, "x")
local real y = GetAttachedReal(t, "y")
local integer i = GetAttachedInt(t, "i")
call SetUnitTimeScale(u, 0.5)
[B]call SetUnitAnimationByIndex(u, 4)[/B]
call CleanAttachedVars(t)
call DestroyTimer(t)
set t = CreateTimer()
call AttachObject(t, "u", u)
call AttachObject(t, "e", e)
call AttachReal(t, "h", h)
call AttachReal(t, "x", x)
call AttachReal(t, "y", y)
call AttachInt(t, "i", i)
call TimerStart(t, 0.04, true, function Trig_Wave_Jump_StrikeLoop)
set t = null
set u = null
set e = null
endfunction
function Trig_Wave_Jump_Loop takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = GetAttachedUnit(t, "u")
local real h = GetAttachedReal(t, "h") + 8
local real r = GetAttachedReal(t, "r") + 9.6
local effect e = GetAttachedEffect(t, "e")
local real x = GetAttachedReal(t, "x")
local real y = GetAttachedReal(t, "y")
local integer i = GetAttachedInt(t, "i")
call SetUnitFlyHeight(u, h, 99999.9)
call SetUnitFacing(u, r)
if (h >= 300.0) then
call PauseTimer(t)
call CleanAttachedVars(t)
call DestroyTimer(t)
set t = CreateTimer()
call AttachObject(t, "u", u)
call AttachObject(t, "e", e)
call AttachReal(t, "h", h)
call AttachReal(t, "r", 0.0)
call AttachReal(t, "x", x)
call AttachReal(t, "y", y)
call AttachInt(t, "i", i)
call TimerStart(t, 0.04, false, function Trig_Wave_Jump_Strike)
else
call AttachReal(t, "h", h)
call AttachReal(t, "r", r)
endif
set t = null
set u = null
set e = null
endfunction
function Trig_Wave_Jump_Actions takes nothing returns nothing
local unit u = GetSpellAbilityUnit()
local location l = GetSpellTargetLoc()
local effect e = AddSpecialEffectTarget("Abilities\\Weapons\\WaterElementalMissile\\WaterElementalMissile.mdl", u, "weapon left")
local timer t = CreateTimer()
local real h = 0.0
local real r = bj_RADTODEG * Atan2(GetLocationY(l) - GetUnitY(u), GetLocationX(l) - GetUnitX(u))
local real x = GetLocationX(l)
local real y = GetLocationY(l)
local integer i = GetUnitAbilityLevel(u, 'A000')
call UnitAddAbility(u, 'Arav')
call UnitRemoveAbility(u, 'Arav')
call SetUnitTimeScale(u, 0.33)
[B]call SetUnitAnimationByIndex(u, 5)[/B]
call AttachObject(t, "u", u)
call AttachObject(t, "e", e)
call AttachReal(t, "h", h)
call AttachReal(t, "r", r)
call AttachReal(t, "x", x)
call AttachReal(t, "y", y)
call AttachInt(t, "i", i)
call TimerStart(t, 0.04, true, function Trig_Wave_Jump_Loop)
call RemoveLocation(l)
set u = null
set l = null
set e = null
set t = null
endfunction
//===========================================================================
function InitTrig_Wave_Jump takes nothing returns nothing
set gg_trg_Wave_Jump = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Wave_Jump, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Wave_Jump, Condition( function Trig_Wave_Jump_Conditions ) )
call TriggerAddAction( gg_trg_Wave_Jump, function Trig_Wave_Jump_Actions )
endfunction
The first one (that is actually executed after the second one) works perfectly, but the second one does not play. I tried disabling the changing of facing, animation speed and flying height, but the animation still doesn't play. It's like the caster just stands while jumping up. Can anyone here find the reason that stops my caster from playing it's animation?
Edit:
It seems that this is caused by the instability of WEU. I got it working again by putting the call SetUnitAnimationById in another place but after I added some other things it stopped working again, and even if I reverted it back to the old state it kept refusing to work.