Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Changing terrain(etc) across region problems

Discussion in 'World Editor Help Zone' started by Grags, May 10, 2013.

  1. Grags

    Grags

    Joined:
    Jul 7, 2011
    Messages:
    12
    Resources:
    0
    Resources:
    0
    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.
     
  2. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,526
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    it might be hitting the op limit. try seperating the terrain change into 2 triggers. or use a trigger sleep action.
     
  3. Spartipilo

    Spartipilo

    Joined:
    Jul 14, 2011
    Messages:
    3,190
    Resources:
    0
    Resources:
    0
    I was just thinking about the operation limit deathismyfriend mentioned. Separating it in two triggers should do.
     
  4. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,526
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    ya i cant see anything wrong and if it stops at 90% it has to be the op-limit.

    unless u know of anything else ?
     
  5. Grags

    Grags

    Joined:
    Jul 7, 2011
    Messages:
    12
    Resources:
    0
    Resources:
    0
    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
     

    Attached Files:

  6. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,526
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    that map is huge u do know that u cant play a map over 8mb on multiplayer right ?

    also did u try splitting up the terrain change trigger ?
     
  7. Grags

    Grags

    Joined:
    Jul 7, 2011
    Messages:
    12
    Resources:
    0
    Resources:
    0
    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.
     
  8. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,526
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    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.
     
  9. Grags

    Grags

    Joined:
    Jul 7, 2011
    Messages:
    12
    Resources:
    0
    Resources:
    0
    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
     
  10. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,526
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    ya i really dont see what u mean lol sry. a screen shot would be a lot better plz
     
  11. Grags

    Grags

    Joined:
    Jul 7, 2011
    Messages:
    12
    Resources:
    0
    Resources:
    0
    [​IMG]

    The area I've marked never gets touched by the trigger.
     
  12. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,526
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    it seems like the spot to the south of that isnt working right either. i wonder if its just ur sight blocker or if sight blockers dont work when doing terrain changeing. mybe u can check that out. see if thats the problem if not hopefully someone else can help. ill still try but i really dont see a problem with the triggers.
     
  13. Grags

    Grags

    Joined:
    Jul 7, 2011
    Messages:
    12
    Resources:
    0
    Resources:
    0
    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
     
  14. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,526
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    thanks for the rep and no problem.
     
  15. Almia

    Almia

    Joined:
    Apr 24, 2012
    Messages:
    4,842
    Resources:
    35
    Spells:
    30
    Tutorials:
    4
    JASS:
    1
    Resources:
    35
    You are hitting the op-limit.

    Btw,You should skip the x/y by 64,because the tile size is 128 game units.
    You should also start with the minX + 64 and minY + 64. The max also must be - 64.

    You can do something like this in my map:
    http://www.hiveworkshop.com/forums/pastebin.php?id=r4kheu

    Go to the triggers and find Save Terrain
     
  16. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,526
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    i thought that was the problem lol
     
  17. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    26,131
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    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.

    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.
     
  18. Almia

    Almia

    Joined:
    Apr 24, 2012
    Messages:
    4,842
    Resources:
    35
    Spells:
    30
    Tutorials:
    4
    JASS:
    1
    Resources:
    35
    Actually,the reason i suggested that is because of the
    SetTerrainType
    tile AoE change,where Circle with an area of 1 is 128 x 128,that's why i suggest skipping it by 128 and start with the tile's center.
     
  19. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    26,131
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Except tiles do not have any terrain type information, the 4 nodes that make them up do.
     
  20. Grags

    Grags

    Joined:
    Jul 7, 2011
    Messages:
    12
    Resources:
    0
    Resources:
    0
    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: