- Joined
- Jul 28, 2008
- Messages
- 211
Ok, so i finnaly made a knockback(a simple one) and the map just won't start.
Can someone tell me what's wrong with it?
Thx!
Can someone tell me what's wrong with it?
JASS:
scope vars initializer Init
globals
constant integer id = 'spel'
private unit target
private real distance = 0
private unit caster
private location l
private real angle
endglobals
private function actions takes nothing returns nothing
set target = GetSpellTargetUnit()
set caster = GetSpellAbilityUnit()
set c = GetUnitLoc(caster)
set angle = GetUnitFacing(caster)
endfunction
private private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction(t, function actions)
endfunction
private function Trig_Spell_Conditions takes nothing returns boolean
return GetSpellAbilityId() == id
endfunction
private function Move takes nothing returns nothing
call SetUnitPositionLoc(target, PolarProjectionBJ(l, distance, angle)
set distance = distance + 6
endfunction
private function Trig_Spell_Actions takes nothing returns nothing
local integer count = 100
local timer t
loop
exitwhen count == 0
call TimerStart(t,0.04,false,function Move)
set count = count - 1
endloop
call DestroyTimer(t)
endfunction
//===========================================================================
private function InitTrig_Spell takes nothing returns nothing
local trigger t = CreateTrigger( )
local integer i = 0
loop
exitwhen i == 16
call TriggerRegisterPlayerUnitEvent(t,Player(i),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
set i = i + 1
endloop
call TriggerAddCondition(t, Condition(function Trig_Spell_Conditions) )
call TriggerAddAction( t, function Trig_Spell_Actions )
endfunction
endscope
Thx!