HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Loops???

01-10-2004, 05:50 PM#1
Buttink
ok i have this trigger and its a loop now i dont know how u can get a wait action in a loop without it going insane and not working.

the trigger changes the owner of units in a area and i wait then change them back if that helps
01-10-2004, 06:43 PM#2
weaaddar
waits work fine in loops. Its just best you don't use the wait unless neccessary.
01-11-2004, 12:13 AM#3
Vidstige
You don't really mention what specific problem your loop causes you. You might want to check the thread Question about periodic actions in a function for an example of a loop with wait. If that doesn't help, please post your loop-code and specify how it misbehaves.
01-11-2004, 08:28 PM#4
Buttink
ok i have this spell it involves 4 triggers but the others are to make sure it works right (debug)

this is the loop

---------------------------------------------------------
function Trig_Disruption3_Func001Func002001003 takes nothing returns boolean
return ( IsUnitType(GetEnumUnit(), UNIT_TYPE_HERO) == false )
endfunction

function Trig_Disruption3_Func001Func002A takes nothing returns nothing
set udg_pickedunit = GetEnumUnit()
set udg_whatisbeingsilenced = GetLastCreatedGroup()
call SetUnitManaBJ( udg_Caster, ( udg_UnitsMana - 0.00 ) )
call SetUnitOwner( GetEnumUnit(), Player(PLAYER_NEUTRAL_AGGRESSIVE), true )
call AddSpecialEffectTargetUnitBJ( "origin", GetEnumUnit(), "Abilities\\Spells\\Human\\DispelMagic\\DispelMagicTarget.mdl" )
call TriggerSleepAction( 10.00 )
call AddSpecialEffectTargetUnitBJ( "origin", GetEnumUnit(), "Abilities\\Spells\\Human\\DispelMagic\\DispelMagicTarget.mdl" )
call SetUnitOwner( GetChangingUnit(), GetChangingUnitPrevOwner(), true )
endfunction

function Trig_Disruption3_Func001C takes nothing returns boolean
if ( not ( IsUnitInRangeLoc(GetTriggerUnit(), udg_location, 600.00) == true ) ) then
return false
endif
return true
endfunction

function Trig_Disruption3_Actions takes nothing returns nothing
if ( Trig_Disruption3_Func001C() ) then
call ForGroupBJ( GetUnitsInRangeOfLocMatching(300.00, udg_location, Condition(function Trig_Disruption3_Func001Func002001003)), function Trig_Disruption3_Func001Func002A )
else
call DisplayTextToPlayer( udg_PlayerofDisruption, 0, 0, "TRIGSTR_006" )
endif
endfunction

//===========================================================================
function InitTrig_Disruption3 takes nothing returns nothing
set gg_trg_Disruption3 = CreateTrigger( )
call TriggerAddAction( gg_trg_Disruption3, function Trig_Disruption3_Actions )
endfunction
----------------------------------------------------------

and it endlessly loops and it never finishes