Komaqtion
You can change this now in User CP.
- Reaction score
- 469
Hi!
I've created a spell, which creates some effects and then some dummies that move out from the caster.
Everything works except that the timer never stops
And i have no idea how to stop it after some time, since if i use TriggerSleepAction, it's not MUI anymore since i've used some globals that get overwritten.
And also, the dumies move faster each time i use the spell-
(Note: I'm new to JASS so might not understand everything Please explain )
I've created a spell, which creates some effects and then some dummies that move out from the caster.
Everything works except that the timer never stops
And i have no idea how to stop it after some time, since if i use TriggerSleepAction, it's not MUI anymore since i've used some globals that get overwritten.
And also, the dumies move faster each time i use the spell-
(Note: I'm new to JASS so might not understand everything Please explain )
JASS:
scope Dummy initializer init
globals
private unit array du
private real array pointx
private real array pointy
private constant string e = "Abilities\\Spells\\Human\\Flare\\FlareCaster.mdl"
private constant string e2 = "Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl"
private constant string e1 = "Abilities\\Weapons\\DemolisherFireMissile\\DemolisherFireMissile.mdl"
private constant integer SPELL_ID = 039;0000039;
private constant integer unitid = 039;h000039;
private constant integer aid = 039;Aloc039;
private constant integer bid = 039;BTLF039;
endglobals
private function Spell_Check takes nothing returns boolean
return GetSpellAbilityId() == SPELL_ID
endfunction
private function Move_Dummy takes nothing returns nothing
local unit u = GetTriggerUnit()
local real xd
local real yd
local integer i = 0
loop
exitwhen i==16
set xd = GetUnitX(du<i>)
set yd = GetUnitY(du<i>)
set pointx<i> = xd+10*Cos((i*22.5)*bj_DEGTORAD)
set pointy<i> = yd+10*Sin((i*22.5)*bj_DEGTORAD)
call UnitDamagePoint(u,0,10,pointx<i>,pointy<i>,50,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
call SetUnitX(du<i>,pointx<i>)
call SetUnitY(du<i>,pointy<i>)
set i = i+1
endloop
endfunction
private function Effects takes nothing returns nothing
local integer i = 0
local unit u = GetTriggerUnit()
local real xu = GetUnitX(u)
local real yu = GetUnitY(u)
local player p = GetOwningPlayer(u)
local timer t = CreateTimer()
call DestroyEffect(AddSpecialEffect(e,xu,yu))
loop
exitwhen i==16
set pointx<i> = xu+200*Cos((i*22.5)*bj_DEGTORAD)
set pointy<i> = yu+200*Sin((i*22.5)*bj_DEGTORAD)
call DestroyEffect(AddSpecialEffect(e,pointx<i>,pointy<i>))
call DestroyEffect(AddSpecialEffect(e2,pointx<i>,pointy<i>))
call UnitDamagePoint(u,0,10,pointx<i>,pointy<i>,50,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
set du<i> = CreateUnit(p,unitid,xu,yu,bj_RADTODEG*Atan2(pointy<i>-yu,pointx<i>-xu))
call UnitApplyTimedLife(du<i>,039;BTLF039;,2.5)
call UnitAddAbility(du<i>,aid)
call AddSpecialEffectTarget(e1,du<i>,"chest")
set i = i+1
endloop
call TimerStart(t,0.05,true,function Move_Dummy)
set u = null
set p = null
call TriggerSleepAction(2.5)
call DestroyTimer(t)
endfunction
private function init takes nothing returns nothing
local trigger t=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t,Condition(function Spell_Check))
call TriggerAddAction(t,function Effects)
set t = null
endfunction
endscope</i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i>