- Joined
- Aug 31, 2006
- Messages
- 132
I just don't get it and worse, can find no help. To make a simple JASS knockback, i had to resort to using a timer and have to transfer the local variables to the function it calls. The problem is, i can't. I searched in the JASS help section, but that is the only what i found.
function Cond takes nothing returns boolean
return GetSpellAbilityId() == 'A000'
endfunction
function Knockback takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit caster = GetHandleUnit(t, "caster")
local unit target = GetHandleUnit(t, "target")
local real x1 = GetUnitX(caster)
local real y1 = GetUnitY(caster)
local real x2 = GetUnitX(target)
local real y2 = GetUnitY(target)
local real angle = GetAngleBetweenPoints(x1,y1,x2,y2)
local real dist = GetDistanceBetweenPoints(x1,y1,x2,y2)
call SetUnitPosition(target, PolarProjectionX(x2, dist+10.00, angle), PolarProjectionY(y2, dist+10.00, angle))
set t = null
set caster = null
set target = null
endfunction
function Knockback takes nothing returns nothing
local timer t = CreateTimer()
local unit caster = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
call SetHandleHandle(t, "caster", caster)
call SetHandleHandle(t, "target", target)
call TimerStart(t, 0.035, true, function Knockback)
call TriggerSleepAction(0.5)
call FlushHandleLocals(t)
call DestroyTimer(t)
set t = null
set caster = null
set target = null
endfunction
function InitTrig_trigger takes nothing returns nothing
local trigger Knocky
set Knocky = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( Knocky, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Knocky, Condition(function Cond))
call TriggerAddAction(Knocky, function Knockback)
endfunction
Not only does my WE not allow it, I couldn't find some of the functions it uses in JC and it seems either outdated, or in need of additional code which i could not download. (The link lead to wc3sear.ch)
(The code comes from Advanced JASS tips in the The Hive Workshop JASS/AI Scripts Tutorials)
function Cond takes nothing returns boolean
return GetSpellAbilityId() == 'A000'
endfunction
function Knockback takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit caster = GetHandleUnit(t, "caster")
local unit target = GetHandleUnit(t, "target")
local real x1 = GetUnitX(caster)
local real y1 = GetUnitY(caster)
local real x2 = GetUnitX(target)
local real y2 = GetUnitY(target)
local real angle = GetAngleBetweenPoints(x1,y1,x2,y2)
local real dist = GetDistanceBetweenPoints(x1,y1,x2,y2)
call SetUnitPosition(target, PolarProjectionX(x2, dist+10.00, angle), PolarProjectionY(y2, dist+10.00, angle))
set t = null
set caster = null
set target = null
endfunction
function Knockback takes nothing returns nothing
local timer t = CreateTimer()
local unit caster = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
call SetHandleHandle(t, "caster", caster)
call SetHandleHandle(t, "target", target)
call TimerStart(t, 0.035, true, function Knockback)
call TriggerSleepAction(0.5)
call FlushHandleLocals(t)
call DestroyTimer(t)
set t = null
set caster = null
set target = null
endfunction
function InitTrig_trigger takes nothing returns nothing
local trigger Knocky
set Knocky = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( Knocky, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Knocky, Condition(function Cond))
call TriggerAddAction(Knocky, function Knockback)
endfunction
Not only does my WE not allow it, I couldn't find some of the functions it uses in JC and it seems either outdated, or in need of additional code which i could not download. (The link lead to wc3sear.ch)
(The code comes from Advanced JASS tips in the The Hive Workshop JASS/AI Scripts Tutorials)