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

[Trigger] Walkability Off over a whole region.

Status
Not open for further replies.
Level 8
Joined
Feb 20, 2007
Messages
338
  • Environment - Set terrain pathing at (Center of Block 1 <gen>) of type Walkability to Off
Is there a way to modify this to cover the whole region?
 
Level 8
Joined
Feb 20, 2007
Messages
338
Two nested "For" loops.

For Each Integer A from ...
For Each Integer B from ...

The function does an area of 32x32, so the placing should be 32A.

May I see that in an example trigger to know how to nest these two?

And I really do not understand 32A either - examples please.

Thanks
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
What poot means could be summarised in this way:

when using the function on a location a small area of 32x32 is affected.
(Compare the panels in the world editor below.)
2q8aud5.png


So... let say wou want it to affect this rect with the size 512x512 what you would do is, like poot said, using two loops, one inner loop determinating the x coordinate and the other loop determinating the y coordinate.

In Gui this would be something like this:
  • WalkabilityRectOff
    • Events
    • Conditions
    • Actions
      • -------- RectExample is just creating a rect which I will use in the trigger --------
      • Set RectExample = (Region(-256.00, -256.00, 256.00, 256.00))
      • -------- --------
      • Set minX = (Integer((Min X of RectExample)))
      • Set minY = (Integer((Min Y of RectExample)))
      • Set maxX = (Integer((Max X of RectExample)))
      • Set maxY = (Integer((Max Y of RectExample)))
      • For each (Integer A) from (minX / 32) to (maxX / 32), do (Actions)
        • Loop - Actions
          • For each (Integer B) from (minY / 32) to (maxY / 32), do (Actions)
            • Loop - Actions
              • Set temppoint = (Point((16.00 + ((Real((Integer A))) x 32.00)), (16.00 + ((Real((Integer B))) x 32.00))))
              • Environment - Set terrain pathing at temppoint of type Walkability to Off
              • Custom script: call RemoveLocation( udg_temppoint )
Note that in Gui this trigger would be very inefficient, as
A: you cant use x and y coordinates inside the loop unless you use a custom script (which is kind of easy to fix anyhow)
B: you cant use the looping in an efficient way without doing it all in jass.
C: due to B we use a loop of integers instead of reals, which is not having the same accuracy when gaining the coordinates.
D: Loops has a threshold of an amount of loops allowed in a trigger without using wait actions (I dont know how much). If the rect would turn out to be too big, it will loop until it hits the threshold, thus failing to affect the whole rect.
 
Status
Not open for further replies.
Top