Alright I tried it once more again but sure it doesn't work, so please show me what the hell is wrong.. seems to be I'm just to stupid -_-
library Move initializer init
globals
private constant integer SPELL_ID = 'A000'
private constant integer DUMMY_ID = 'dum1'
// \\
private constant hashtable HASH = InitHashtable()
endglobals
struct Move
unit caster = null
unit dummy = null
real x = 0.
real y = 0.
real f = 0.
static method periodic takes nothing returns nothing
local timer t = GetExpiredTimer()
local thistype this = LoadInteger(HASH,GetHandleId(t),0)
local real x = GetUnitX(.dummy)
local real y = GetUnitY(.dummy)
local real dx = .x - x
local real dy = .y - y
if dx * dx + dy * dy > 100 then // speed * speed \\
set x = x + 10. * Cos(.f)
set y = y + 10. * Sin(.f)
call SetUnitX(.dummy,x)
call SetUnitY(.dummy,y)
else
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Other\\HowlOfTerror\\HowlCaster.mdl",.x,.y))
call RemoveUnit(.dummy)
call PauseTimer(t)
call DestroyTimer(t)
call .destroy()
endif
set t = null
endmethod
static method create takes unit caster,real x,real y returns thistype
local thistype this = .allocate()
local timer t = CreateTimer()
set .caster = caster
set .x = x
set .y = y
set .f = bj_RADTODEG * Atan2(.y - GetUnitY(.caster),.x - GetUnitX(.caster))
set .dummy = CreateUnit(GetOwningPlayer(.caster),DUMMY_ID,GetUnitX(.caster),GetUnitY(.caster),.f)
call SaveInteger(HASH,GetHandleId(t),0,this)
call TimerStart(t,0.03125,true,function thistype.periodic)
set t = null
return this
endmethod
endstruct
private function cond takes nothing returns boolean
if GetSpellAbilityId() == SPELL_ID then
call Move.create(GetTriggerUnit(),GetSpellTargetX(),GetSpellTargetY())
endif
return false
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
loop
exitwhen i == 11
call TriggerRegisterPlayerUnitEvent(t,Player(i),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
set i = i + 1
endloop
call TriggerAddCondition(t,function cond)
set t = null
endfunction
endlibrary
Well sure it is a bit different from the Deathball one, but the deathball was based on the thunderball missile which has no facing, thats why I didn't use bj_RADTODEG and also there didn't use a distance check.