- Joined
- Feb 11, 2011
- Messages
- 1,860
I am trying to make my own Knockback spell grin and I have come across a strange issue. When I try the following code, it thinks the terrain is unpathable and stops the Knockback (the unit is in a completely open space). Any ideas? The snippet is as follows:
Thanks!
P.S. It works fine without the pathability check.
JASS:
static method Timer_Actions takes nothing returns nothing
local timer t = GetExpiredTimer()
local thistype D = GetTimerData(t)
local real x
local real y
local real x2
local real y2
if D.DistLeft > 0 then
set x = GetUnitX(D.targ)
set y = GetUnitY(D.targ)
set x2 = x + 5 * Cos(D.ang * bj_DEGTORAD)
set y2 = y + 5 * Sin(D.ang * bj_DEGTORAD)
if IsTerrainPathable(x2, y2, PATHING_TYPE_WALKABILITY) then //Here, it skips to the "else" actions.
call SetUnitX(D.targ, x2)
call SetUnitY(D.targ, y2)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\FlyingMachine\\FlyingMachineImpact.mdl", D.targ, "chest"))
set D.DistLeft = D.DistLeft - 5
else
call ReleaseTimer(t)
call PauseUnit(D.targ, false)
call SetUnitPathing(D.targ, true)
call D.destroy()
endif
else
call ReleaseTimer(t)
call PauseUnit(D.targ, false)
call SetUnitPathing(D.targ, true)
call D.destroy()
endif
set t = null
endmethod
P.S. It works fine without the pathability check.