• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Changing terrain(etc) across region problems

Status
Not open for further replies.
Level 2
Joined
Jul 7, 2011
Messages
14
Firstly I know next to nothing about Jass. I have taken the custom script from various Jass topics throughout the site and manipulated it the best I can to make it GUI friendly.

The trigger is almost perfect. It searches through the region and changes the terrain and places LOS Blockers.

The problem I have is it only finishes 90% of the region. And for the life of me I can't figure out why?

Any help would be greatly appreciated. As this trigger will be reused time and time again throughout my map.

  • Build 2
    • Events
    • Conditions
    • Actions
      • Custom script: local real x = GetRectMinX(gg_rct_Cave_1)
      • Custom script: local real y
      • Custom script: loop
      • Custom script: exitwhen x > GetRectMaxX(gg_rct_Cave_1)
      • Custom script: set y = GetRectMinY(gg_rct_Cave_1)
      • Custom script: loop
      • Custom script: exitwhen y > GetRectMaxY(gg_rct_Cave_1)
      • Custom script: set udg_TempPoint[1] = Location(x, y)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain type at TempPoint[1]) Equal to Village Fall - Stone Path
        • Then - Actions
          • Destructible - Create a Line of Sight Blocker at TempPoint[1] facing (Random angle) with scale 1.00 and variation 0
          • Environment - Change terrain type at TempPoint[1] to Outland - Abyss using variation -1 in an area of size 1 and shape Circle
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain type at TempPoint[1]) Not equal to Cityscape - Grass
          • (Terrain type at TempPoint[1]) Not equal to Outland - Abyss
          • (Terrain type at TempPoint[1]) Not equal to Outland - Abyss Cliff
          • (Terrain type at TempPoint[1]) Not equal to Ashenvale - Grassy Dirt
        • Then - Actions
          • Environment - Change terrain type at TempPoint[1] to Underground - Grey Stones using variation -1 in an area of size 1 and shape Circle
        • Else - Actions
      • Custom script: call RemoveLocation( udg_TempPoint[1] )
      • Custom script: set y = y + 128
      • Custom script: endloop
      • Custom script: set x = x + 128
      • Custom script: endloop
Thanks for reading.
 
Level 2
Joined
Jul 7, 2011
Messages
14
Hi, thank you for the replies.

I went ahead and did some testing with the Operation Limit (I wasn't aware one existed) over lots of different region sizes. I've come to the conclusion the problem isn't the limit but something more complicated.

It seems very random. And I've spent nearly an hour here deleting shoddy explanations. I haven't got a clue how to explain.


I've uploaded the map in hope it could shed some light on the situation.

The problem area is the top left corner of the map. And the triggers are in the category "START" ~ Build 2, Build 3, Build 4
 

Attachments

  • A strange new world.w3x
    9.8 MB · Views: 50
Level 29
Joined
Oct 24, 2012
Messages
6,543
It's a single player RPG. I honestly didn't want to upload the map, but after spending an hour trying to explain the problem and getting nowhere, it seemed the only option left.

Yes.

ok ill take a look when i can hopefully shortly. u may also want to take a look at these tutorials in case u dont know about this stuff

here is a tutorial about leaks http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/

and here is my tutorial it has a lot of usefull info about GUI. http://www.hiveworkshop.com/forums/tutorial-submission-283/things-gui-user-should-know-233242/

edit: umm it seems like it works to me could u post a pic of the area that doesnt work mybe im just not seeing it.
 
Level 2
Joined
Jul 7, 2011
Messages
14
If you run the game. And head towards the top right corner of Cave_1_03. You will see no line of sight blockers have been placed and the terrain hasn't been changed.

If you still need a screenie. Thats no problem at all
 
Level 2
Joined
Jul 7, 2011
Messages
14
Untitled_zpsfe6598db.jpg


The area I've marked never gets touched by the trigger.
 
Level 2
Joined
Jul 7, 2011
Messages
14
I've filled that small section in manually. It's a shame as feel this action is bad practice. I can only assume as I get further down the line I'm going to run into similar problems. But for now, I'll settle for the easy way out.

Thanks a lot for the help. + Rep
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,197
Build 2 is hitting the operation limit. It runs out of operations by the time it reaches that area so the thread crashes leaving that area un-processed.

If you optimized the algorithm using pure JASS then it might just make the entire area. If you plan to add more complex terrain processing then you will need to break the task into more threads.

You should also start with the minX + 64 and minY + 64. The max also must be - 64.
What he is doing is correct in theory, yours is not. Tiles are orientated on nodes, not between nodes (as you suggest). As long as the rect is grid aligned (uses nodes as borders) it will work correctly. If you offset by 64 units then you are right in the middle between nodes which may cause many aliasing problems (which node to change) so is not recommended.

If the centre of the map is a multiple of 128, then all nodes are also a multiple of 128. All nodes are exactly 128 units apart and arranged in the grid. There are X+1 by Y+1 nodes where X and Y are the map size. 4 nodes are used to form a quad that make up the visible terrain. The visible terrain art is the result of blending the terrain type of the 4 nodes that make up the quad.
 
Level 2
Joined
Jul 7, 2011
Messages
14
Hi thanks for all the help. I just wanted to say that with everyones help i've managed to fix the problem.

Once I finally understood what the operation limit was, I went over the area with a fine-toothed comb and changed the terrain so the trigger didn't have to complete so many operations.

I managed to do it in 2 triggers and a single region.

+Rep to everyone! :ap:
 
Status
Not open for further replies.
Top