"For each (Integer A)" function

Dois

New Member
Reaction score
1
I have a trigger thats "disabling" all my other triggers that use "For each (Integer A) from X to Y, do (Actions)" whenever it runs.

This is it
Code:
Constant Battle and Trees
    Events
        Time - Every 30.00 seconds of game time
    Conditions
    Actions
        For each (Integer A) from 1 to 4, do (Actions)
            Loop - Actions
                Set Temp_Point = (Position of Ion Cannon Control Centre 0009 <gen>)
                Unit - Create 1 (Unit-type of (Random unit from RandomUnits)) for Player 6 (Orange) at Temp_Point facing Default building facing degrees
                Custom script:   call RemoveLocation(udg_Temp_Point)
                Set Temp_Point = (Position of Ion Cannon Control Centre 0011 <gen>)
                Unit - Order (Last created unit) to Attack-Move To Temp_Point
                Custom script:   call RemoveLocation(udg_Temp_Point)
                Set Temp_Point = (Position of Ion Cannon Control Centre 0011 <gen>)
                Unit - Create 1 (Unit-type of (Random unit from RandomUnits)) for Player 12 (Brown) at Temp_Point facing Default building facing degrees
                Custom script:   call RemoveLocation(udg_Temp_Point)
                Set Temp_Point = (Position of Ion Cannon Control Centre 0009 <gen>)
                Unit - Order (Last created unit) to Attack-Move To Temp_Point
                Custom script:   call RemoveLocation(udg_Temp_Point)
        Set Temp_Region = (Entire map)
        Destructible - Pick every destructible in Temp_Region and do (Destructible - Resurrect (Picked destructible) with (Max life of (Picked destructible)) life and Show birth animation)
        Custom script:   call RemoveRect(udg_Temp_Region)

When I use "For each (Integer B)..." for the other trigger instead of A, it works. So that tells me the problem is coming from the "For each (Integer A)" thing of course...

I don't know whats wrong... Can anyone help?


EDIT: ok i just realized that its not just this trigger.

All the triggers with "for each integer A" interfere with each other...

So i clearly have a lack of understand of how it works... is this "integer A" global? etc...
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> is this "integer A" global?

Yes, it is.

And, it's save to use, unless there's a "wait" action.
Because, if some trigger that uses it is waiting, and there's some other trigger that also runs it, the loop conditions will be changed...

Solutions:
- don't wait in "Integer A" loops
- use a different variable for each one that uses waits
- JASS... and plenty of locals
 

pandamoniuma

New Member
Reaction score
9
there are no waits in your trigger, so that shouldnt be the problem

however i do see that you destroy a rect for "entire map", which i think might be a problem, i know that when you destroy the player group All players, you will never be able to use the all players group again

i think a rect would only leak if you specified the coordinates, if the rect is already a preset in the game then you don't need to remove it
 

Dois

New Member
Reaction score
1
nah, its cuz of waits in my other triggers... i thought this was the cause but i later realize they all screw each other up... they work fine now... im using diff variables for the loop thing

"i think a rect would only leak if you specified the coordinates, if the rect is already a preset in the game then you don't need to remove it " really? if you're sure id prefer using the "normal" entire map way.

also, acehart i wuz playing necro corp ltd. and the minimap in the game was really beautiful... did you do something to the map or is it just cause its a small map so the minimap is somehow... more accurate
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top