For Loop Help...

Guest3z

New Member
Reaction score
22
Ok so I wanted to make a map where wisps would spawn and circle in a wheel and as time went on it gets harder and harder. I made a trigger to do all the spawning for me all I would need to do is set the level before I ran the trigger. Here it is
Code:
SpawnWisps
    Events
    Conditions
    Actions
        Unit Group - Pick every unit in TempGroup and do (Unit - Remove (Picked unit) from the game)
        Custom script:   call DestroyGroup( udg_TempGroup )
        For each (Integer A) from 1 to 9, do (Actions)
            Loop - Actions
                Set TempPt1 = (Center of WispRegion[(Integer A)])
                Unit - Create 1 Wisp for Neutral Hostile at TempPt1 facing Default building facing degrees
                Custom script:   call RemoveLocation( udg_TempPt1 )
        Set TempGroup = (Units owned by Neutral Hostile)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Level Greater than or equal to 9
            Then - Actions
                Unit - Remove (Random unit from TempGroup) from the game
            Else - Actions
                [COLOR="Red"]For each (Integer A) from 1 to (9 - Level), do (Actions)[/COLOR]
                    Loop - Actions
                        Unit - Remove (Random unit from TempGroup) from the game
                        Custom script:   call DestroyGroup( udg_TempGroup )
                        Set TempGroup = (Units owned by Neutral Hostile)
        Custom script:   call DestroyGroup( udg_TempGroup )
        Set TempGroup = (Units owned by Neutral Hostile)
I use TempGroup to move the wisps in another trigger and every time it loops around (360°) It runs this trigger so you have to move to dodge the wisps again. Level is an integer set before I run this so It's not that, but the problem is whenever I run this It doesn't spawn the right amount of wisps and I can't figure out why. I just want it to spawn the level integer in wisps, so level 1 would have 1 wisp and 2 would have 2 and so on. For some reason It seems to make any amount of wisps it feels like. I think the red line is the problem but I just don't get it. Please help +rep
Btw I posted the map so you can try yourself and see what happens if you feel like it http://www.epicwar.com/maps/download/29224/Asdfjklol.w3x

-Edit Fixed it... it seems unit groups cannot update instantly because when I added a wait 0.00 seconds trigger at the start of the loop
Code:
For each (Integer A) from 1 to (9 - Level), do (Actions)
                    Loop - Actions
                        Unit - Remove (Random unit from TempGroup) from the game
                        Custom script:   call DestroyGroup( udg_TempGroup )
                        Set TempGroup = (Units owned by Neutral Hostile)
it magicly worked... but now it takes about a quarter of a second to delete all of the wisps. Oh well maybe this will help someone else.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top