• 🏆 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!

Faulty Terrain Generator

Status
Not open for further replies.
Level 23
Joined
Oct 20, 2012
Messages
3,075
Heya guys, I've created a some kind of random terrain generator for my map. It should work but somehow, after one of the loops, it just won't run the rest of the trigger.

  • TERRAIN Starter
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • -------- ---------------- --------
      • Set GAMETEXT_ColorInt = 13
      • Set GAMETEXT_Duration = 60.00
      • Set GAMETEXT_MessageString = Generating terrain, destructibles and the weather effect. This may take a few moments...
      • Set GAMETEXT_ShowTo = (All players)
      • Set GAMETEXT_TypeString = Game Notice
      • Set GAMETEXT_Sound = GameNotice <gen>
      • Trigger - Run GAME Game Messages <gen> (checking conditions)
      • -------- ---------------- --------
      • -------- ---------------- --------
      • Set GAMETEXT_ColorInt = 13
      • Set GAMETEXT_Duration = 60.00
      • Set GAMETEXT_MessageString = Now generating the tileset...
      • Set GAMETEXT_ShowTo = (All players)
      • Set GAMETEXT_TypeString = Game Notice
      • Set GAMETEXT_Sound = GameNotice <gen>
      • Trigger - Run GAME Game Messages <gen> (checking conditions)
      • -------- ---------------- --------
      • Trigger - Run TERRAIN Tileset Generator <gen> (checking conditions)
  • TERRAIN Tileset Generator
    • Events
    • Conditions
    • Actions
      • For each (Integer tempint) from 1 to (Integer(((Width of TERRAIN_Region) / (Real(TERRAIN_Seed))))), do (Actions)
        • Loop - Actions
          • For each (Integer A) from 1 to (Integer(((Height of TERRAIN_Region) / (Real(TERRAIN_Seed))))), do (Actions)
            • Loop - Actions
              • Set temppoint = (Point(((Real(tempint)) x (Real(TERRAIN_Seed))), ((Real((Integer A))) x (Real(TERRAIN_Seed)))))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Terrain type at temppoint) Equal to Lordaeron Winter - Dirt
                  • (TERRAIN_Region contains temppoint) Equal to True
                • Then - Actions
                  • Environment - Change terrain type at temppoint to TERRAIN_TerrainTypes[(Random integer number between 1 and 7)] using variation -1 in an area of size (Random integer number between 1 and 3) and shape Circle
                • Else - Actions
              • Custom script: call RemoveLocation(udg_temppoint)
              • Set temppoint = (Point(((Real(tempint)) x (-1.00 x (Real(TERRAIN_Seed)))), ((Real((Integer A))) x (Real(TERRAIN_Seed)))))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Terrain type at temppoint) Equal to Lordaeron Winter - Dirt
                  • (TERRAIN_Region contains temppoint) Equal to True
                • Then - Actions
                  • Environment - Change terrain type at temppoint to TERRAIN_TerrainTypes[(Random integer number between 1 and 7)] using variation -1 in an area of size (Random integer number between 1 and 3) and shape Circle
                • Else - Actions
              • Custom script: call RemoveLocation(udg_temppoint)
              • Set temppoint = (Point(((Real(tempint)) x (Real(TERRAIN_Seed))), ((Real((Integer A))) x (-1.00 x (Real(TERRAIN_Seed))))))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Terrain type at temppoint) Equal to Lordaeron Winter - Dirt
                  • (TERRAIN_Region contains temppoint) Equal to True
                • Then - Actions
                  • Environment - Change terrain type at temppoint to TERRAIN_TerrainTypes[(Random integer number between 1 and 7)] using variation -1 in an area of size (Random integer number between 1 and 3) and shape Circle
                • Else - Actions
              • Custom script: call RemoveLocation(udg_temppoint)
              • Set temppoint = (Point(((Real(tempint)) x (-1.00 x (Real(TERRAIN_Seed)))), ((Real((Integer A))) x (-1.00 x (Real(TERRAIN_Seed))))))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Terrain type at temppoint) Equal to Lordaeron Winter - Dirt
                  • (TERRAIN_Region contains temppoint) Equal to True
                • Then - Actions
                  • Environment - Change terrain type at temppoint to TERRAIN_TerrainTypes[(Random integer number between 1 and 7)] using variation -1 in an area of size (Random integer number between 1 and 3) and shape Circle
                • Else - Actions
              • Custom script: call RemoveLocation(udg_temppoint)
      • Cinematic - Clear the screen of text messages for (All players)
      • -------- ---------------- --------
      • Set GAMETEXT_ColorInt = 13
      • Set GAMETEXT_Duration = 60.00
      • Set GAMETEXT_MessageString = Generating terrain, destructibles and the weather effect. This may take a few moments...
      • Set GAMETEXT_ShowTo = (All players)
      • Set GAMETEXT_TypeString = Game Notice
      • Set GAMETEXT_Sound = GameNotice <gen>
      • Trigger - Run GAME Game Messages <gen> (checking conditions)
      • -------- ---------------- --------
      • -------- ---------------- --------
      • Set GAMETEXT_ColorInt = 13
      • Set GAMETEXT_Duration = 60.00
      • Set GAMETEXT_MessageString = Tileset has been generated. Now generating random heights...
      • Set GAMETEXT_ShowTo = (All players)
      • Set GAMETEXT_TypeString = Game Notice
      • Set GAMETEXT_Sound = GameNotice <gen>
      • Trigger - Run GAME Game Messages <gen> (checking conditions)
      • -------- ---------------- --------
      • Trigger - Run TERRAIN Height Generator <gen> (checking conditions)
  • TERRAIN Height Generator
    • Events
    • Conditions
    • Actions
      • For each (Integer tempint) from 1 to (Integer(((Width of TERRAIN_Region) / (Real(TERRAIN_Seed))))), do (Actions)
        • Loop - Actions
          • For each (Integer A) from 1 to (Integer(((Height of TERRAIN_Region) / (Real(TERRAIN_Seed))))), do (Actions)
            • Loop - Actions
              • Set temppoint = (Point(((Real(tempint)) x (Real(TERRAIN_Seed))), ((Real((Integer A))) x (Real(TERRAIN_Seed)))))
              • Environment - Create a 0.10 second Permanent crater deformation at temppoint with radius (Random real number between 64.00 and 512.00) and depth (-1.00 x (Random real number between -32.00 and 32.00))
              • Custom script: call RemoveLocation(udg_temppoint)
              • Set temppoint = (Point(((Real(tempint)) x (Real((-1 x TERRAIN_Seed)))), ((Real((Integer A))) x (Real(TERRAIN_Seed)))))
              • Environment - Create a 0.10 second Permanent crater deformation at temppoint with radius (Random real number between 64.00 and 512.00) and depth (-1.00 x (Random real number between -32.00 and 32.00))
              • Custom script: call RemoveLocation(udg_temppoint)
              • Set temppoint = (Point(((Real(tempint)) x (Real(TERRAIN_Seed))), ((Real((Integer A))) x (Real((-1 x TERRAIN_Seed))))))
              • Environment - Create a 0.10 second Permanent crater deformation at temppoint with radius (Random real number between 64.00 and 512.00) and depth (-1.00 x (Random real number between -32.00 and 32.00))
              • Custom script: call RemoveLocation(udg_temppoint)
              • Set temppoint = (Point(((Real(tempint)) x (Real((-1 x TERRAIN_Seed)))), ((Real((Integer A))) x (Real((-1 x TERRAIN_Seed))))))
              • Environment - Create a 0.10 second Permanent crater deformation at temppoint with radius (Random real number between 64.00 and 512.00) and depth (-1.00 x (Random real number between -32.00 and 32.00))
              • Custom script: call RemoveLocation(udg_temppoint)
      • Cinematic - Clear the screen of text messages for (All players)
      • -------- ---------------- --------
      • Set GAMETEXT_ColorInt = 13
      • Set GAMETEXT_Duration = 60.00
      • Set GAMETEXT_MessageString = Generating terrain, destructibles and the weather effect. This may take a few moments...
      • Set GAMETEXT_ShowTo = (All players)
      • Set GAMETEXT_TypeString = Game Notice
      • Set GAMETEXT_Sound = GameNotice <gen>
      • Trigger - Run GAME Game Messages <gen> (checking conditions)
      • -------- ---------------- --------
      • -------- ---------------- --------
      • Set GAMETEXT_ColorInt = 13
      • Set GAMETEXT_Duration = 60.00
      • Set GAMETEXT_MessageString = Terrain height has been generated. Now generating the destructibles...
      • Set GAMETEXT_ShowTo = (All players)
      • Set GAMETEXT_TypeString = Game Notice
      • Set GAMETEXT_Sound = GameNotice <gen>
      • Trigger - Run GAME Game Messages <gen> (checking conditions)
      • -------- ---------------- --------
      • Trigger - Run TERRAIN Destructible Generator <gen> (ignoring conditions)
  • TERRAIN Destructible Generator
    • Events
    • Conditions
    • Actions
      • For each (Integer tempint) from 1 to (Integer(((Width of TERRAIN_Region) / (Real(TERRAIN_Seed))))), do (Actions)
        • Loop - Actions
          • For each (Integer A) from 1 to (Integer(((Height of TERRAIN_Region) / (Real(TERRAIN_Seed))))), do (Actions)
            • Loop - Actions
              • Set temppoint = (Point(((Real(tempint)) x (Real(TERRAIN_Seed))), ((Real((Integer A))) x (Real(TERRAIN_Seed)))))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Dirt
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Rough Dirt
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Grassy Snow
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Grass
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Snow
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random integer number between 1 and 100) Less than or equal to 15
                    • Then - Actions
                      • Set tempgroup = (Units within 400.00 of temppoint)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in tempgroup) Equal to 0
                          • Or - Any (Conditions) are true
                            • Conditions
                              • (Terrain type at temppoint) Not equal to Northrend - Ice
                              • (Terrain type at temppoint) Not equal to Northrend - Rocky Snow
                          • (TERRAIN_Region contains temppoint) Equal to True
                        • Then - Actions
                          • Destructible - Create a TERRAIN_Destructibles[(Random integer number between 1 and 5)] at temppoint facing (Random angle) with scale 1.00 and variation 0
                        • Else - Actions
                      • Custom script: call DestroyGroup(udg_tempgroup)
                    • Else - Actions
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Dirt
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Rough Dirt
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Grassy Snow
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Grass
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Snow
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random integer number between 1 and 100) Less than or equal to 25
                    • Then - Actions
                      • Set tempgroup = (Units within 400.00 of temppoint)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in tempgroup) Equal to 0
                          • Or - Any (Conditions) are true
                            • Conditions
                              • (Terrain type at temppoint) Not equal to Northrend - Ice
                              • (Terrain type at temppoint) Not equal to Northrend - Rocky Snow
                          • (TERRAIN_Region contains temppoint) Equal to True
                        • Then - Actions
                          • Destructible - Create a TERRAIN_Destructibles[(Random integer number between 1 and 5)] at temppoint facing (Random angle) with scale 1.00 and variation 0
                        • Else - Actions
                      • Custom script: call DestroyGroup(udg_tempgroup)
                    • Else - Actions
                • Else - Actions
              • Custom script: call RemoveLocation(udg_temppoint)
              • Set temppoint = (Point(((Real(tempint)) x (-1.00 x (Real(TERRAIN_Seed)))), ((Real((Integer A))) x (Real(TERRAIN_Seed)))))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Dirt
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Rough Dirt
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Grassy Snow
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Grass
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Snow
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random integer number between 1 and 100) Less than or equal to 15
                    • Then - Actions
                      • Set tempgroup = (Units within 400.00 of temppoint)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in tempgroup) Equal to 0
                          • Or - Any (Conditions) are true
                            • Conditions
                              • (Terrain type at temppoint) Not equal to Northrend - Ice
                              • (Terrain type at temppoint) Not equal to Northrend - Rocky Snow
                          • (TERRAIN_Region contains temppoint) Equal to True
                        • Then - Actions
                          • Destructible - Create a TERRAIN_Destructibles[(Random integer number between 1 and 5)] at temppoint facing (Random angle) with scale 1.00 and variation 0
                        • Else - Actions
                      • Custom script: call DestroyGroup(udg_tempgroup)
                    • Else - Actions
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Dirt
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Rough Dirt
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Grassy Snow
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Grass
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Snow
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random integer number between 1 and 100) Less than or equal to 25
                    • Then - Actions
                      • Set tempgroup = (Units within 400.00 of temppoint)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in tempgroup) Equal to 0
                          • Or - Any (Conditions) are true
                            • Conditions
                              • (Terrain type at temppoint) Not equal to Northrend - Ice
                              • (Terrain type at temppoint) Not equal to Northrend - Rocky Snow
                          • (TERRAIN_Region contains temppoint) Equal to True
                        • Then - Actions
                          • Destructible - Create a TERRAIN_Destructibles[(Random integer number between 1 and 5)] at temppoint facing (Random angle) with scale 1.00 and variation 0
                        • Else - Actions
                      • Custom script: call DestroyGroup(udg_tempgroup)
                    • Else - Actions
                • Else - Actions
              • Custom script: call RemoveLocation(udg_temppoint)
              • Set temppoint = (Point(((Real(tempint)) x (Real(TERRAIN_Seed))), ((Real((Integer A))) x (-1.00 x (Real(TERRAIN_Seed))))))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Dirt
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Rough Dirt
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Grassy Snow
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Grass
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Snow
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random integer number between 1 and 100) Less than or equal to 15
                    • Then - Actions
                      • Set tempgroup = (Units within 400.00 of temppoint)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in tempgroup) Equal to 0
                          • Or - Any (Conditions) are true
                            • Conditions
                              • (Terrain type at temppoint) Not equal to Northrend - Ice
                              • (Terrain type at temppoint) Not equal to Northrend - Rocky Snow
                          • (TERRAIN_Region contains temppoint) Equal to True
                        • Then - Actions
                          • Destructible - Create a TERRAIN_Destructibles[(Random integer number between 1 and 5)] at temppoint facing (Random angle) with scale 1.00 and variation 0
                        • Else - Actions
                      • Custom script: call DestroyGroup(udg_tempgroup)
                    • Else - Actions
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Dirt
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Rough Dirt
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Grassy Snow
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Grass
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Snow
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random integer number between 1 and 100) Less than or equal to 25
                    • Then - Actions
                      • Set tempgroup = (Units within 400.00 of temppoint)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in tempgroup) Equal to 0
                          • Or - Any (Conditions) are true
                            • Conditions
                              • (Terrain type at temppoint) Not equal to Northrend - Ice
                              • (Terrain type at temppoint) Not equal to Northrend - Rocky Snow
                          • (TERRAIN_Region contains temppoint) Equal to True
                        • Then - Actions
                          • Destructible - Create a TERRAIN_Destructibles[(Random integer number between 1 and 5)] at temppoint facing (Random angle) with scale 1.00 and variation 0
                        • Else - Actions
                      • Custom script: call DestroyGroup(udg_tempgroup)
                    • Else - Actions
                • Else - Actions
              • Custom script: call RemoveLocation(udg_temppoint)
              • Set temppoint = (Point(((Real(tempint)) x (-1.00 x (Real(TERRAIN_Seed)))), ((Real((Integer A))) x (-1.00 x (Real(TERRAIN_Seed))))))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Dirt
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Rough Dirt
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Grassy Snow
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Grass
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Snow
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random integer number between 1 and 100) Less than or equal to 15
                    • Then - Actions
                      • Set tempgroup = (Units within 400.00 of temppoint)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in tempgroup) Equal to 0
                          • Or - Any (Conditions) are true
                            • Conditions
                              • (Terrain type at temppoint) Not equal to Northrend - Ice
                              • (Terrain type at temppoint) Not equal to Northrend - Rocky Snow
                          • (TERRAIN_Region contains temppoint) Equal to True
                        • Then - Actions
                          • Destructible - Create a TERRAIN_Destructibles[(Random integer number between 1 and 5)] at temppoint facing (Random angle) with scale 1.00 and variation 0
                        • Else - Actions
                      • Custom script: call DestroyGroup(udg_tempgroup)
                    • Else - Actions
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Dirt
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Rough Dirt
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Grassy Snow
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Grass
                      • (Terrain type at temppoint) Equal to Lordaeron Winter - Snow
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random integer number between 1 and 100) Less than or equal to 25
                    • Then - Actions
                      • Set tempgroup = (Units within 400.00 of temppoint)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in tempgroup) Equal to 0
                          • Or - Any (Conditions) are true
                            • Conditions
                              • (Terrain type at temppoint) Not equal to Northrend - Ice
                              • (Terrain type at temppoint) Not equal to Northrend - Rocky Snow
                          • (TERRAIN_Region contains temppoint) Equal to True
                        • Then - Actions
                          • Destructible - Create a TERRAIN_Destructibles[(Random integer number between 1 and 5)] at temppoint facing (Random angle) with scale 1.00 and variation 0
                        • Else - Actions
                      • Custom script: call DestroyGroup(udg_tempgroup)
                    • Else - Actions
                • Else - Actions
              • Custom script: call RemoveLocation(udg_temppoint)
      • Cinematic - Clear the screen of text messages for (All players)
      • -------- ---------------- --------
      • Set GAMETEXT_ColorInt = 13
      • Set GAMETEXT_Duration = 60.00
      • Set GAMETEXT_MessageString = The terrain has been successfully generated.
      • Set GAMETEXT_ShowTo = (All players)
      • Set GAMETEXT_TypeString = Game Notice
      • Set GAMETEXT_Sound = GameNotice <gen>
      • Trigger - Run GAME Game Messages <gen> (checking conditions)
      • -------- ---------------- --------
      • Trigger - Run TERRAIN Post Generation <gen> (checking conditions)
  • TERRAIN Post Generation
    • Events
    • Conditions
    • Actions
      • Cinematic - Enable user control for (All players)
      • Cinematic - Fade in over 0.75 seconds using texture Black Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
      • Environment - Create at (Entire map) the weather effect Northrend Snow (Heavy)
      • Environment - Set sky to Lordaeron Summer Sky
      • Selection - Select Hero Selection Building 0005 <gen>
      • For each (Integer tempint) from 1 to GAME_PlayersMax, do (Actions)
        • Loop - Actions
          • Countdown Timer - Start GAME_PlayerTimer[tempint] as a One-shot timer that will expire in 100000000.00 seconds
          • Set temppoint = (Position of Hero Selection Building 0005 <gen>)
          • Unit - Create 1 Hero Buyer for GAME_Players[tempint] at temppoint facing Default building facing degrees
          • Camera - Lock camera target for GAME_Players[tempint] to (Last created unit), offset by (0.00, 0.00) using Default rotation
          • Custom script: call RemoveLocation(udg_temppoint)
          • Visibility - Create an initially Enabled visibility modifier for (Player(tempint)) emitting Visibility across (Entire map)
          • Visibility - Destroy (Last created visibility modifier)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GAME_PlayersPlaying Equal to 1
        • Then - Actions
          • Set GAME_SinglePlayer = True
          • Game - Display to (All players) the text: ((GAME_TextColorStart[13] + (Game Notice : + GAME_TextColorEnd)) + Single Player mode activated. Prepare for zombies!)
        • Else - Actions
The first and second trigger runs just fine. The third trigger, however, runs the loop but doesn't run the next actions (starting from the clear text down are all ignored) plus, the generated terrain looks like it has variating heights but everything placed in it treat it as the miserable flat plane of terrain it once was.

I've also tried running the next trigger manually through another trigger (chat message -> run trigger 4) and it does run BUT it only creates destructibles within the camera bounds and not in the whole TERRAIN_Region (which is a region that covers the whole 32x32 map area).

Those are my main problems. Questions are:
1.) Why does the third trigger ignore the rest of the actions? and why does the product treated as a flat terrain?
2.) The doodad creation limited within the camera bounds thing. Why does it happen as well?

I'm ready to dump this thing if it doesn't work but I'd still appreciate all the help I could get. ^^

NOTE : Please focus on triggers 3 & 4. The rest work fine.

EDIT: God, I forgot I should have posted this in Triggers and Scripts. *facepalm*
 
Level 23
Joined
Oct 20, 2012
Messages
3,075
Yes. 2 non-array integers.


EDIT - Well first, I though the case was the 0.10 sec terrain deformation but now that it happens in the second trigger as well...

EDIT2 - I've dumped the terrain generator for now (asking for help with things that concern an entry for a contest is considered teamwork) and settled for a premade terrain but I'd still appreciate the help with this.
 
Hm. But the tileset is generated at it should in trigger 2?
If so.
Have you turned on Cinematics before all these triggers run?
If so.
Try to turn it off and see what happens. I have had problems with trigger running when Cinematics is turned on.

Edit:
Saw your edit.
I guess the timed deformation could screw it up, but as you say it also happens in the second trigger. So my initial post in this post still stands.
Other than that I guess a user with more in depth knowledge needs to reply.
 

Deleted member 219079

D

Deleted member 219079

I've made my own not a while ago, use it instead?
JASS:
library customFunctions
    globals
        private player FN_DUMMYOWNER
        private boolean FN_ENEMIESONLY
        private unit FN_DUMMY
        private string MAP_VERSION = "1.0.0"
        private unit FN_RETURNED
        private texttag ST_RETURNED
        private string PLN_RETURNED
        private player GN_RETURNED
    endglobals
    
    function GetSmaller takes integer i1, integer i2 returns integer
        if i1 < i2 then
            return i1
        endif
        return i2
    endfunction
    function GetBigger takes integer i1, integer i2 returns integer
        if i1 > i2 then
            return i1
        endif
        return i2
    endfunction
    
    function GetVersionStr takes nothing returns string
        return MAP_VERSION
    endfunction
    
    function FN_Cond takes nothing returns boolean
        return (not IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD) and  not IsUnitHidden(GetFilterUnit())) and (not (GetFilterUnit()==FN_DUMMY)) and (not FN_ENEMIESONLY or IsPlayerEnemy(FN_DUMMYOWNER,GetOwningPlayer(GetFilterUnit())))
    endfunction
    
    function FindNearest takes unit dummy, real range, boolean enemiesonly returns unit
        local group g = CreateGroup( )
        local real x = GetUnitX( dummy )
        local real y = GetUnitY( dummy )
        local real dx = 0
        local real dy = 0
        local real mindist = 0
        local real dist = 0
        local unit FoG
        set FN_RETURNED = null
        set FN_DUMMY = dummy
        set FN_ENEMIESONLY = enemiesonly
        set FN_DUMMYOWNER = GetOwningPlayer(dummy)
        call GroupEnumUnitsInRange( g, x, y, range, function FN_Cond )
        loop
            set FoG = FirstOfGroup( g )
            exitwhen ( FoG == null )
            set dx = GetUnitX(FoG) - x
            set dy = GetUnitY(FoG) - y
            set dist = SquareRoot(dx * dx + dy * dy)
            if (dist<mindist) or (mindist == 0) then
                set mindist = dist
                set FN_RETURNED = FoG
            endif
            call GroupRemoveUnit( g, FoG )
        endloop
        call DestroyGroup( g )
        set g = null
        set FN_DUMMYOWNER = null
        set FN_DUMMY = null
        return FN_RETURNED
    endfunction
    
    public function FindNearestEnemy takes player whichPlayer, real x, real y, real range returns unit
        local group g = CreateGroup( )
        local real dx = 0
        local real dy = 0
        local real mindist = 0
        local real dist = 0
        local unit FoG
        set FN_RETURNED = null
        set FN_DUMMY = null
        set FN_ENEMIESONLY = true
        set FN_DUMMYOWNER = whichPlayer
        call GroupEnumUnitsInRange( g, x, y, range, function FN_Cond )
        loop
            set FoG = FirstOfGroup( g )
            exitwhen ( FoG == null )
            set dx = GetUnitX(FoG) - x
            set dy = GetUnitY(FoG) - y
            set dist = SquareRoot(dx * dx + dy * dy)
            if (dist<mindist) or (mindist == 0) then
                set mindist = dist
                set FN_RETURNED = FoG
            endif
            call GroupRemoveUnit( g, FoG )
        endloop
        call DestroyGroup( g )
        set g = null
        set FN_DUMMYOWNER = null
        set FN_DUMMY = null
        return FN_RETURNED
    endfunction
    
    function FindNearestLoc takes real x, real y, real range returns unit
        local group g = CreateGroup( )
        local real dx = 0
        local real dy = 0
        local real mindist = 0
        local real dist = 0
        local unit FoG
        set FN_RETURNED = null
        set FN_DUMMY = null
        set FN_ENEMIESONLY = false
        call GroupEnumUnitsInRange( g, x, y, range, function FN_Cond )
        loop
            set FoG = FirstOfGroup( g )
            exitwhen ( FoG == null )
            set dx = GetUnitX(FoG) - x
            set dy = GetUnitY(FoG) - y
            set dist = SquareRoot(dx * dx + dy * dy)
            if (dist<mindist) or (mindist == 0) then
                set mindist = dist
                set FN_RETURNED = FoG
            endif
            call GroupRemoveUnit( g, FoG )
        endloop
        call DestroyGroup( g )
        set g = null
        set FN_DUMMYOWNER = null
        set FN_DUMMY = null
        return FN_RETURNED
    endfunction
    
    public function SpawnText_Simple takes unit u, string str returns texttag
        set ST_RETURNED = CreateTextTag()
        call SetTextTagText(ST_RETURNED, "|cffffcc00"  + str + "|r", 0.023)
        call SetTextTagPos ( ST_RETURNED,GetUnitX(u), GetUnitY(u), 100)
        call SetTextTagVisibility ( ST_RETURNED, true)
        call SetTextTagPermanent (ST_RETURNED, false)
        call SetTextTagLifespan ( ST_RETURNED, 3.5)
        call SetTextTagFadepoint ( ST_RETURNED, 2)
        call SetTextTagVelocity (ST_RETURNED, 0, 0.01775)
        if GetLocalPlayer() != GetOwningPlayer(u) then
            call SetTextTagVisibility(ST_RETURNED, false)
        else
            call SetTextTagVisibility(ST_RETURNED, true)
        endif
        return ST_RETURNED
    endfunction
    
    public function SpawnText_Adv takes unit u, string str, real time, string color returns texttag
        set ST_RETURNED = CreateTextTag()
        if color=="red" then
            call SetTextTagText ( ST_RETURNED, "|c00ff0000" + str + "|r", 0.023)
        elseif color=="yellow" then
            call SetTextTagText ( ST_RETURNED, "|cffffcc00" + str + "|r", 0.023)
        elseif color=="green" then
            call SetTextTagText ( ST_RETURNED, "|c0000cc00" + str + "|r", 0.023)
        elseif color=="blue" then
            call SetTextTagText ( ST_RETURNED, "|c000033ff" + str + "|r", 0.023)
        else
            call SetTextTagText ( ST_RETURNED, str, 0.023)
        endif
        call SetTextTagPos ( ST_RETURNED,GetUnitX(u), GetUnitY(u), 100)
        call SetTextTagVisibility ( ST_RETURNED, true)
        call SetTextTagPermanent (ST_RETURNED, false)
        call SetTextTagLifespan ( ST_RETURNED, time)
        call SetTextTagFadepoint ( ST_RETURNED, time-1.5)
        call SetTextTagVelocity (ST_RETURNED, 0, 0.01775)
        if GetLocalPlayer() != GetOwningPlayer(u) then
            call SetTextTagVisibility(ST_RETURNED, false)
        else
            call SetTextTagVisibility(ST_RETURNED, true)
        endif
        return ST_RETURNED
    endfunction
    
    function Experience_GetLevel takes integer exp, integer level returns integer
        local integer i = 0
        loop
            set i = level*level*10
            if exp < i then
                if level > 1 then
                    return level-1
                else
                    return 1
                endif
            endif
            set level = level +1
        endloop
        return 0
    endfunction
    
    public function GetPlayerNameColored takes player pl returns string
        if GetPlayerId(pl)==0 then
            return "|c00ff0000" + GetPlayerName(pl) + "|r"
        elseif GetPlayerId(pl)==1 then
            return "|c000033ff" + GetPlayerName(pl) + "|r"
        elseif GetPlayerId(pl)==2 then
            return "|c0000ffff" + GetPlayerName(pl) + "|r"
        elseif GetPlayerId(pl)==3 then
            return "|c009900cc" + GetPlayerName(pl) + "|r"
        elseif GetPlayerId(pl)==4 then
            return "|c00ffff00" + GetPlayerName(pl) + "|r"
        elseif GetPlayerId(pl)==5 then
            return "|c00ff6600" + GetPlayerName(pl) + "|r"
        elseif GetPlayerId(pl)==6 then
            return "|c0033ff00" + GetPlayerName(pl) + "|r"
        elseif GetPlayerId(pl)==7 then
            return "|c00ff33ff" + GetPlayerName(pl) + "|r"
        elseif GetPlayerId(pl)==8 then
            return "|c00999999" + GetPlayerName(pl) + "|r"
        elseif GetPlayerId(pl)==9 then
            return "|c0099ccff" + GetPlayerName(pl) + "|r"
        elseif GetPlayerId(pl)==10 then
            return "|c00023a02" + GetPlayerName(pl) + "|r"
        elseif GetPlayerId(pl)==11 then
            return "|c00663300" + GetPlayerName(pl) + "|r"
        endif
        return GetPlayerName(pl)
    endfunction
    
    public function getPlayerColor takes integer i returns string
        if i==0 then
            return "|c00ff0000"
        elseif i==1 then
            return "|c000033ff"
        elseif i==2 then
            return "|c0000ffff"
        elseif i==3 then
            return "|c009900cc"
        elseif i==4 then
            return "|c00ffff00"
        elseif i==5 then
            return "|c00ff6600"
        elseif i==6 then
            return "|c0033ff00"
        elseif i==7 then
            return "|c00ff33ff"
        elseif i==8 then
            return "|c00999999"
        elseif i==9 then
            return "|c0099ccff"
        elseif i==10 then
            return "|c00023a02"
        elseif i==11 then
            return "|c00663300"
        endif
        return "|c0099ccff" //gray
    endfunction

    public function Experience_Add takes integer exp, integer id returns nothing
        set udg_playerExp[id] = udg_playerExp[id] + exp
        set udg_playerLevel[id] = Experience_GetLevel(udg_playerExp[id],udg_playerLevel[id])
    endfunction
    
    public function Experience_Set takes integer exp, integer id returns nothing
        set udg_playerExp[id] = exp
        set udg_playerLevel[id] = Experience_GetLevel(udg_playerExp[id],0)
    endfunction
        
    public function IsUnitDead takes unit u returns boolean
        return IsUnitType(u, UNIT_TYPE_DEAD) or GetUnitTypeId(u) == 0
    endfunction
    
    public function getPlayerKD takes player pl returns real
        if udg_playerDeaths[GetPlayerId(pl)+1]>0 then
            return I2R(udg_playerKills[GetPlayerId(pl)+1])/I2R(udg_playerDeaths[GetPlayerId(pl)+1])
        endif
        return I2R(udg_playerKills[GetPlayerId(pl)+1])
    endfunction
    
    public function getNerd takes nothing returns player
        local integer index = 0
        local real r = -1
        loop
            if getPlayerKD(Player(index))>r then
                set GN_RETURNED = Player(index)
                set r = getPlayerKD(Player(index))
            endif
            exitwhen index == 11
            set index = index + 1
        endloop
        return null
    endfunction
    
    public function triggerRegisterChatEventEveryone takes trigger trig returns nothing
        local integer index
    
        set index = 0
        loop
            call TriggerRegisterPlayerChatEvent( trig, Player(index), "", false )
    
            set index = index + 1
            exitwhen index == bj_MAX_PLAYER_SLOTS
        endloop
    endfunction
endlibrary
JASS:
library TerrainSystem initializer init requires customFunctions//v1.1 - 9.5.2014
    globals
        private timer TIMER = CreateTimer()
        private chunk array CHUNK
        private integer STEP = 0
        private integer OVERFLOW = 0
        private integer STEP_MAX
        private integer COUNT = 0
        private integer INDEX
        private integer SCANS_MADE
        private integer TOTAL_PHASES = 4 //+1
        private multiboard MB// = CreateMultiboard()
        private integer PHASE
        /* user defined :*/
            private constant integer MAX_DEST_COUNT = 200/* how many trees there can be spawned on one chunk*/
            private constant integer MAX_HILLS_COUNT = 100/* how many hills there can be spawned on one chunk*/
            private constant integer ACCURACY = 6/* how many chunks the map will be divided into*/
            private constant integer SCANS = 4 /* how many times each chunk is loaded (0 = crash)*/
            private constant integer SPEED = 100 /* how many instances can be made per step
          -ends here-*/
    endglobals
    struct chunk
        private real minX
        private real maxX
        private real minY
        private real maxY
        private integer index
        private integer left
        private integer biomeId
        private static real rX //random X
        private static real rY //random Y
        public static constant integer maxBiome = 2
        //phase identifiers
        private static constant integer hillPhase = 0
        private static constant integer detailPhase = 1
        private static constant integer doodadPhase = 2
        private static constant integer treePhase = 3
        private static constant integer unitPhase = 4
        //hill variables
        private static real array hillHeightMin
        private static real array hillHeightMax
        private static integer array hillCountMin
        private static integer array hillCountMax
        private integer hillsMade = 0
        //tree variables
        private static integer array treeMinId
        private static integer array treeMaxId
        private static integer array treeCountMin
        private static integer array treeCountMax
        private static integer array treeId
        private integer treesMade = 0
        //unit variables
        private static constant integer unitMinId = 0
        private static constant integer unitMaxId = 2
        private static integer array unitId
        //doodad variables
        private static string array doodadStr
        private static integer array doodadMinId
        private static integer array doodadMaxId
        //tileset variables
        private static integer array tilesetTree
        private static integer array tilesetDetail
        private static integer array tilesetHill
        static method onInit takes nothing returns nothing
            local integer i = 0 //pine forest
            set hillCountMin[i] = 10
            set hillCountMax[i] = 15
            set hillHeightMin[i] = 40
            set hillHeightMax[i] = 50
            set doodadMinId[i] = 0
            set doodadMaxId[i] = 2
            set treeMinId[i] = 0
            set treeMaxId[i] = 2
            set treeCountMin[i] = 20
            set treeCountMax[i] = 30
            set tilesetTree[i] = 'Agrd'
            set tilesetHill[i] = 'Adrg'
            set tilesetDetail[i] = 'Alvd'
            set i = 1 //thich pine forest
            set hillCountMin[i] = 15
            set hillCountMax[i] = 20
            set hillHeightMin[i] = 40
            set hillHeightMax[i] = 50
            set doodadMinId[i] = 0
            set doodadMaxId[i] = 2
            set treeMinId[i] = 0
            set treeMaxId[i] = 2
            set treeCountMin[i] = 30
            set treeCountMax[i] = 40
            set tilesetTree[i] = 'Agrd'
            set tilesetHill[i] = 'Adrg'
            set tilesetDetail[i] = 'Alvd'
            set i = 2 //barrens
            set hillCountMin[i] = 20
            set hillCountMax[i] = 30
            set hillHeightMin[i] = 42
            set hillHeightMax[i] = 48
            set doodadMinId[i] = 69
            set treeMinId[i] = 3
            set treeMaxId[i] = 4
            set treeCountMin[i] = 15
            set treeCountMax[i] = 20
            set tilesetTree[i] = 'Bgrr'
            set tilesetHill[i] = 'Bdrg'
            set tilesetDetail[i] = 'Bdrh'
            //tree ID:s
            set treeId[0] = 'B000'
            set treeId[1] = 'B001'
            set treeId[2] = 'B002'
            set treeId[3] = 'BTtw'
            set treeId[4] = 'BTtc'
            //unit ID:s
            set unitId[0] = 'n005'
            set unitId[1] = 'n006'
            set unitId[2] = 'n007'
            //doodad ID:s
            set doodadStr[0] = "Doodads\\Ruins\\Plants\\Ruins_Shrub\\Ruins_Shrub0.mdl"
            set doodadStr[1] = "Doodads\\Ruins\\Plants\\Ruins_Shrub\\Ruins_Shrub1.mdl"
            set doodadStr[2] = "Doodads\\Ruins\\Plants\\Ruins_Shrub\\Ruins_Shrub2.mdl"
        endmethod
        static method create takes real x1, real x2, real y1, real y2 returns thistype
            local thistype returned = thistype.allocate()
            set returned.minX = x1
            set returned.maxX = x2
            set returned.minY = y1
            set returned.maxY = y2
            return returned
        endmethod
        method onDestroy  takes nothing returns nothing
            set .biomeId = 0
            set .minX = 0
            set .maxX =0
            set .minY = 0
            set .maxY = 0
        endmethod
        method setBiome takes integer i returns nothing
            set .biomeId = i
        endmethod
        method checkReady  takes nothing returns boolean
            return .left == 0
        endmethod
        private method GetPhaseStats takes nothing returns nothing
            if PHASE == hillPhase then
                //set .index = <value>
                set .left = GetRandomInt(hillCountMin[.biomeId],hillCountMax[.biomeId])
            elseif PHASE == detailPhase then
                //set .index = <value>
                set .left = GetRandomInt(20,30)
            elseif PHASE == doodadPhase then
                if doodadMinId[.biomeId]!=69 then
                    set .index = GetRandomInt(doodadMinId[.biomeId],doodadMaxId[.biomeId])
                    set .left = GetRandomInt(30,40)
                else
                    set .left = 0
                endif
            elseif PHASE == treePhase then
                set .index = GetRandomInt(treeMinId[.biomeId], treeMaxId[.biomeId])
                set .left = GetRandomInt(treeCountMin[.biomeId], GetSmaller(MAX_DEST_COUNT,treeCountMax[.biomeId]))
            elseif PHASE == unitPhase then
                set .index = GetRandomInt(unitMinId, unitMaxId)
                set .left = GetRandomInt(0,1)
            endif
        endmethod
        private method GenPhaseObjects takes nothing returns nothing
            if PHASE == hillPhase and .hillsMade < MAX_HILLS_COUNT then
                call TerrainDeformCrater(rX, rY, 600, -1*GetRandomReal(hillHeightMin[.biomeId],hillHeightMax[.biomeId]), 1, true)
                call SetTerrainType(rX, rY, tilesetHill[.biomeId], -1, 6, 0)
            elseif PHASE == detailPhase then
                call SetTerrainType(rX, rY, tilesetDetail[.biomeId], -1, 2, 0)
            elseif PHASE == doodadPhase then
                call AddSpecialEffect(doodadStr[.index],rX,rY)
            elseif PHASE == treePhase and .treesMade < MAX_DEST_COUNT then
                call CreateDestructable(treeId[.index], rX, rY, GetRandomReal(0, 360), GetRandomReal(0.8, 1.2), 0)
                call SetTerrainType(rX, rY, tilesetTree[.biomeId], -1, 2, 0)
                set .treesMade = .treesMade + 1
            elseif PHASE == unitPhase and FindNearestLoc(rX, rY, 200)==null then
                call SetUnitColor(/*
                    */CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), unitId[.index], rX, rY, 270),PLAYER_COLOR_YELLOW)
            endif
        endmethod
        method generate takes integer calcLeft /* takes how many calculations have already been done
        */returns integer//returns how many calculations are left
            local integer i2 = calcLeft//how many calculations you've done
            if .left==0 then
                call GetPhaseStats()
            endif
            loop
                exitwhen .left==0 or i2>=SPEED
                set rX = GetRandomReal(.minX, .maxX)
                set rY = GetRandomReal(.minY, .maxY)
                call GenPhaseObjects()
                set i2 = i2 + 1
                set .left = .left - 1
            endloop
            return GetBigger(.left,0)
        endmethod
    endstruct
    function destroy takes nothing returns nothing
        local integer i = 0
        call MultiboardDisplay(MB, false)
        call MultiboardClear(MB)
        call DestroyMultiboard(MB)
        set MB = null
        call DestroyTimer(TIMER)
        set TIMER = null
        loop
            call CHUNK[i].destroy()
            exitwhen i == STEP_MAX
            set i = i + 1
        endloop
    endfunction
    private function timerStep takes nothing returns nothing
        local multiboarditem mbitem
        local real r = (I2R(STEP) / I2R(STEP_MAX * SCANS) + I2R(SCANS_MADE)/I2R(SCANS)) //before phases
        local string percent
        set r = r / I2R(TOTAL_PHASES+1) + I2R(PHASE)/I2R(TOTAL_PHASES+1)
        set percent = R2SW( r * 100.0,0,2)
        if SCANS_MADE<SCANS then
            set OVERFLOW = CHUNK[STEP].generate(OVERFLOW)
            if OVERFLOW == 0 then
                set STEP = STEP + 1
                if STEP > STEP_MAX then
                    set SCANS_MADE = SCANS_MADE +1
                    set STEP = 0
                endif
            endif
            set mbitem = MultiboardGetItem(MB, 0, 0)
            call MultiboardSetItemValue(mbitem, "Generating terrain... " + percent + "%" + " : modifying chunk " + I2S(STEP))
            call MultiboardReleaseItem(mbitem)
        else
            set SCANS_MADE = 0
            set STEP = 0
            set COUNT = 0
            set PHASE = PHASE +1
            if PHASE == TOTAL_PHASES+1 then
                set mbitem = MultiboardGetItem(MB, 0, 0)
                call MultiboardSetItemValue(mbitem, "Generation succesful!")
                call MultiboardReleaseItem(mbitem)
                call DestroyTimer(TIMER)
                call destroy()
            endif
        endif
    endfunction
    private function mb takes nothing returns boolean
        set MB=CreateMultiboard()
        call MultiboardSetRowCount(MB, 1)
        call MultiboardSetColumnCount(MB, 1)
        call MultiboardSetTitleText(MB, "Generating...")
        call MultiboardSetItemStyleBJ( MB, 0, 0, true, false )
        call MultiboardSetItemWidthBJ( MB, 0, 0, 35.00 )
        call MultiboardDisplay(MB, true)
        return false
    endfunction
    private function init takes nothing returns nothing
        local integer i = 0 //yloop
        local integer i2 //xlooop
        local trigger t = CreateTrigger()
        local real rX = (GetRectMaxX(bj_mapInitialPlayableArea) - GetRectMinX(bj_mapInitialPlayableArea)) / I2R(ACCURACY) //the x offset
        local real rY = (GetRectMaxY(bj_mapInitialPlayableArea) - GetRectMinY(bj_mapInitialPlayableArea)) / I2R(ACCURACY) //the y offset
        loop
            exitwhen i == ACCURACY
            set i2 = 0
            loop
                exitwhen i2 == ACCURACY
                set CHUNK[ACCURACY*i2 + i] = chunk.create(/* create new "chunk" struct
                    */ GetRectMinX(bj_mapInitialPlayableArea)+rX*i2,/* min plus the offset times i2
                    */ GetRectMinX(bj_mapInitialPlayableArea)+rX*i2+rX,/* min plus the offset times i2 plus offset
                    */ GetRectMinY(bj_mapInitialPlayableArea)+rY*i,/* min plus the offset times i
                    */ GetRectMinY(bj_mapInitialPlayableArea)+rY*i+rY/* min plus the offset times i plus offset
                    */ )
                call CHUNK[ACCURACY*i2 + i].setBiome( GetRandomInt(0, chunk.maxBiome) )
                set i2 = i2+1
            endloop
            set i = i+1
        endloop
        set STEP_MAX = ACCURACY*(i2-1) + (i-1)
        set PHASE = 0
        set SCANS_MADE = 0
        call TriggerRegisterTimerEvent(t, 0, false)
        call TriggerAddCondition(t, function mb)
        set t = null
        call TimerStart(TIMER, 0.015625, true, function timerStep)
    endfunction
endlibrary
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
  • For each (Integer tempint) from 1 to (Integer(((Width of TERRAIN_Region) / (Real(TERRAIN_Seed))))), do (Actions)
    • Loop - Actions
      • For each (Integer A) from 1 to (Integer(((Height of TERRAIN_Region) / (Real(TERRAIN_Seed))))), do (Actions)
        • Loop - Actions
This loop can't be done in first try.Do you realize how big those numbers are?Even a little 100x100(100 range) region means this will do 100^100=10000 iterations.Instead of looping through region with 1x1 coordinates, you should loop through 32x32 coordinates
 

Deleted member 219079

D

Deleted member 219079

Thank for that, but I've already settled for a perma terrain instead. :)

My system does generate a permanent terrain? You just need to configure it.

Send me the map file, I will take a look at it.

Edit: Seems like ced already solved it. (100^100=10000 (y) )
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,204
Random guess is you are hitting the op limit. This is the most common cause of terrain generation related errors where mid way through generation it suddenly stops.

Two solutions which both work.
1. Create new threads mid way and continue execution in those. New threads have a new op-limit and can be spawned from other threads that are nearing their op-limit. The result is a chain of threads with a small bit of extra overhead that can execute as much as you like in total as long as the chain is made long enough. Problem is this can result in the game freezing for an extended period as it will only resume execution once all the trigger threads complete.

2. Use TriggerSleepAction (Wait, non-polled in GUI) to interrupt execution before the op-limit is reached. When the thread resumes from a Wait action it has its op-limit reset allowing it to execute more code than normally possible in a single thread. You can execute as much as you like as long as you regularly have waits to reset the op-limit. Only problem is waits cause cognizable delay in execution and actual waited time depends on network latency.
 
Status
Not open for further replies.
Top