- Joined
- Jun 7, 2008
- Messages
- 440
Hello friend Hivers.
I am having some difficulty with this minor ability i am making. What the inteded purpose is, attacked unit moves instantly behind attacking unit.
This is what I have:
Now, the trigger fires. But Im sent to a spot way accross the map, nowhere near the opponent. Any Ideas ( I think the " local real angle = Atan2(GetUnitY(u) - GetUnitY(c), GetUnitX(u) - GetUnitX(c))" Is what is messing my script.)?
I am having some difficulty with this minor ability i am making. What the inteded purpose is, attacked unit moves instantly behind attacking unit.
This is what I have:
JASS:
function Trig_TrigStep_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit c = GetAttacker()
local real dist = 500
local real angle = Atan2(GetUnitY(u) - GetUnitY(c), GetUnitX(u) - GetUnitX(c))
local real x = (Cos(angle) * dist)
local real y = (Sin(angle) * dist)
local real a = GetUnitState(c, UNIT_STATE_LIFE) - 100
local integer temp = GetRandomInt(1, 100)
if temp > 15 then
set u = null
set c = null
return
endif
call AddSpecialEffectTarget("Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl", u, "chest")
call DestroyEffect( bj_lastCreatedEffect )
call SetUnitPosition(u, x, y)
call SetUnitState(c, UNIT_STATE_LIFE, a)
set u = null
set c = null
endfunction
Now, the trigger fires. But Im sent to a spot way accross the map, nowhere near the opponent. Any Ideas ( I think the " local real angle = Atan2(GetUnitY(u) - GetUnitY(c), GetUnitX(u) - GetUnitX(c))" Is what is messing my script.)?