[trigger] Iteration detected

Frozenwind

System maker
Reaction score
99
I'll keep it relatively short with words.
Basically it gives me the error "Iteration detected in trigger blablbal", which is this trigger:

Code:
Push movement
    Events
        Timer - Every 0.04 seconds of Game Time
    Local Variables
        Speed = 0.0 <Real>
        ------- Speed = Grids / Second
    Conditions
    Actions
        ------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        ------- SurvivorBasic
        ------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        Variable - Set Speed = 14.0
        Unit Group - Pick each unit in PushingBullets[0] and do (Actions)
            Actions
                Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by (Speed * 0.04) towards (Facing of (Picked unit)) degrees) (Blend)
                Variable - Set TempPBullet = (Picked unit)
                [color=red]Unit Group - Pick each unit in (Units in PotentionalPushingTargets having alliance Enemy with (Owner of TempPBullet), with at most Any Amount) and do (Actions)[/color]
                    Actions
                        UI - Display "unit found" for (All players) to Subtitle area
                        General - If (Conditions) then do (Actions) else do (Actions)
                            If
                                And
                                    Conditions
                                        TempPBullet != (Picked unit)
                                        (Distance between (Position of (Picked unit)) and (Position of TempPBullet)) <= 0.6
                            Then
                                UI - Display "unit pushed" for (All players) to Subtitle area
                                Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by (Speed * 0.04) towards (Facing of TempPBullet) degrees) (Blend)
                            Else
                Variable - Set TempPBullet = No Unit
                UI - Display "-----" for (All players) to Subtitle area
After doing some research I know the iteration is caused by the red marked function. Yet I don't understand why this function causes an iteration. Though I DO know it doesn't do what it is supposed to do. It finds one unit, but the found unit won't be pushed if it's within range of the PushingBullet. So it most-likely finds a different unit as it should be able to find. In fact, I assume he finds the caster...

The units within the PotentionalPushingTargets are presets for my test, basically the caster and a target, with the target being an enemy. The bullet is owned by the caster's owner. Also bullets will be added to the potentional group to make them collide later. Now, when I create multiple bullets at once, they DO push eachother, while they are allied, whereas the condition (marked red) wants to find enemies only.

Can someone explain me?
 

Arkless

New Member
Reaction score
31
Code:
        Unit Group - Pick each unit in PushingBullets[0] and do (Actions)
            Actions
                [color=red]Unit Group - Pick each unit in (Units in PotentionalPushingTargets having alliance Enemy with (Owner of TempPBullet), with at most Any Amount) and do (Actions)[/color]
                    Actions
                        {you got two units that are "picked" at this point}

just chose the other pick function, wich writes the unit into a variable (and use a local unit variable for that)
 

Frozenwind

System maker
Reaction score
99
Doesn't it work like wc3? Latest unitgroup counts for Picked Unit? (Or actually it's a matter of functions there).
I'm at work now (8:25am), so I'll check whether I can find the function you mentioned later.
Are you refering to the unit group to unit conversion or an actual unitgroup pick? Cos there was another pick called "Find units matching condition", but it seems to be bugged. You have to set a unit group for it, but the sc2 editors wants us to write a string. In wc3 these two things were related, but in sc2 I couldn't find a conversion method for it. Not sure wheter you meant that one though.
 

Arkless

New Member
Reaction score
31
I mean that "for each unit in unit group" function. Instead of giving you a "picked unit", it fills a specific variable with the value.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top