s3rius
Linux is only free if your time is worthless.
- Reaction score
- 130
Hi,
my problem is that I'm calling a function that uses waits in a loop, thus the loop waits until the function's waits are over. How can I get the loop to immediately continue?
That's the code, MSRL_Actions is the function with the loop, FireRocketLauncher with the waits.
BTW that wait is needed because without it the explosion would occur when the rocket is still in the air´.
my problem is that I'm calling a function that uses waits in a loop, thus the loop waits until the function's waits are over. How can I get the loop to immediately continue?
That's the code, MSRL_Actions is the function with the loop, FireRocketLauncher with the waits.
JASS:
function FireRocketLauncher takes unit u, integer lvl, location spellloc returns nothing //which unit fires, level of rocket, target
local player my_player = GetOwningPlayer( u)
local location my_unitloc = GetUnitLoc( u)
local unit my_dummy = CreateUnitAtLoc(my_player, 039;h00K039;, my_unitloc , 270.00)
call IssuePointOrderLoc( my_dummy, "attackground", spellloc )
call SetUnitAbilityLevel(my_dummy, 039;A00T039;, lvl)
call PolledWait( ( DistanceBetweenPoints(my_unitloc, spellloc) / 1400.00 ) * 1.1 ) //That's the wait -.-
call IssuePointOrderLoc( my_dummy, "blizzard", spellloc )
call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl", spellloc))
call UnitDamagePoint( u, 0, 140 + (lvl * 10), GetLocationX(spellloc), GetLocationY(spellloc), 230 + (20 * lvl), true, true, ATTACK_TYPE_MELEE, DAMAGE_TYPE_DEMOLITION, WEAPON_TYPE_WHOKNOWS)
call AttachSoundToUnit(gg_snd_GrenadeExplosion, my_dummy)
call SetSoundVolume(gg_snd_GrenadeExplosion, 200)
call StartSound(gg_snd_GrenadeExplosion)
call UnitApplyTimedLife(my_dummy, 039;BTLF039;, 2.00)
call RemoveUnit(my_dummy)
set my_dummy = null
set my_unitloc = null
set my_player = null
endfunction
function MSRL_Actions takes nothing returns nothing
local unit my_unit = GetTriggerUnit()
local integer my_integer = 5
local location my_targloc
local location my_location = GetSpellTargetLoc()
loop
exitwhen my_integer == 0
set my_targloc = GetRandomPointInRange( GetLocationX(my_location), GetLocationY(my_location), 250)
call FireRocketLauncher(my_unit, 3, my_targloc)
set my_integer = my_integer - 1
endloop
set my_unit = null
set my_targloc = null
endfunction
BTW that wait is needed because without it the explosion would occur when the rocket is still in the air´.