• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Loop prematurely ends

Status
Not open for further replies.
I've got this trigger (sorry for the mess):

  • Generate Terrain Patches w Trees
    • Events
    • Conditions
    • Actions
      • Game - Display to (All players) the text: Patch trees started
      • For each (Integer integer_007) from 50 to 100, do (Actions)
        • Loop - Actions
          • Game - Display to (All players) the text: (String(integer_007))
          • Set pointTempPoint_01 = (Random point in (Playable map area))
          • Set intRandom_Number_1 = (Random integer number between 3 and 20)
          • Set real_001 = (Random real number between 1.00 and 360.00)
          • Set intRandom_Number_2 = (Random integer number between 1 and 2)
          • For each (Integer integer_003) from 1 to intRandom_Number_1, do (Actions)
            • Loop - Actions
              • Game - Display to (All players) the text: Patch trees loop 2 ...
              • Set pointTempPoint_02 = (pointTempPoint_01 offset by 400.00 towards real_001 degrees)
              • Set intRandom_Number_3 = (Random integer number between 2 and 4)
              • Environment - Change terrain type at pointTempPoint_02 to Random_TreeTiles[GameVari_Generate] using variation -1 in an area of size intRandom_Number_3 and shape Circle
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Settings_RandomForests Equal to 1
                • Then - Actions
                  • For each (Integer integer_010) from 1 to intRandom_Number_3, do (Actions)
                    • Loop - Actions
                      • Game - Display to (All players) the text: Patch trees loop 3 ...
                      • Set pointTempPoint_03 = (pointTempPoint_02 offset by (Random real number between ((Random real number between 40.00 and 60.00) x (Real(intRandom_Number_3))) and ((Random real number between 40.00 and 60.00) x (Real(intRandom_Number_3)))) towards (Random angle) degrees)
                      • Destructible - Create a Random_Trees[GameVari_Generate] at pointTempPoint_03 facing (Random angle) with scale 1.00 and variation (Random integer number between 0 and 5)
                      • Custom script: call RemoveLocation (udg_pointTempPoint_03)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • intRandom_Number_2 Equal to 1
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • real_001 Less than or equal to 0.00
                    • Then - Actions
                      • Set real_001 = (real_001 + 360.00)
                      • Set real_001 = (real_001 - 10.00)
                    • Else - Actions
                      • Set real_001 = (real_001 - 10.00)
                • Else - Actions
                  • Set real_001 = (real_001 + 10.00)
              • Custom script: call RemoveLocation (udg_pointTempPoint_02)
      • Custom script: call RemoveLocation (udg_pointTempPoint_01)
      • -------- ------------------------------ ------------------------------ --------
      • Set boolTerrainPatchTreesReady = True
      • Game - Display to (All players) the text: Patch trees ended
This trigger seem to always prematurely end before reaching 100.
So far I have got to 84, 91, 91, 94.
But the trigger has not once run all of the iterations and the "boolTerrainPatchTreesReady" will never be set to true.

What could cause this problem?
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
most likely cause is running to OP limit, since the loop is quite hefty long with operations such as creating destructable, changing terrain etc. Not to mention loop inside loop, which has varying length from 3 and 20, so you could potentially have as many as 1000 iterations in there. That aint gonna run :D
 
most likely cause is running to OP limit, since the loop is quite hefty long with operations such as creating destructable, changing terrain etc. Not to mention loop inside loop, which has varying length from 3 and 20, so you could potentially have as many as 1000 iterations in there. That aint gonna run :D

Noes!? :eek: Is that really a problem if I give it enough time?
 
After a quick chat back and forth with edo494 he suggested making 0 sec waits which apparently resets the max iteration count (or that's how I understood it).

So for the trigger above I threw in a if/then/else condition at the beginning of the first loop. It will make the loop wait 0 seconds if integer_007 is either 60, 70, 80, or 90.
This worked.
 
Status
Not open for further replies.
Top