Building zone

Status
Not open for further replies.
Level 3
Joined
Aug 8, 2022
Messages
29
How to make a zone outside which worker of current player can't build? Like undead workers out of the damned ground.
 

Uncle

Warcraft Moderator
Level 71
Joined
Aug 10, 2018
Messages
7,613
  • Environment - Set terrain pathing at (Center of (Playable map area)) of type Buildability to Off
This will affect all buildings at that point.

Some other methods:
 
Level 3
Joined
Aug 8, 2022
Messages
29
  • Environment - Set terrain pathing at (Center of (Playable map area)) of type Buildability to Off
This will affect all buildings at that point.

Some other methods:
Exactly what I was looking for, ty ^^
 

Uncle

Warcraft Moderator
Level 71
Joined
Aug 10, 2018
Messages
7,613
EDIT: If your region is too large this function will reach the operation limit and fail. It may also not be as efficient as using large Pathing Blockers. A solution to the operation limit would be to split up your region into multiple smaller regions and run this on each one.

If you want to disable the Buildability across a Region you can use this script:
vJASS:
function DisableBuildability takes rect r returns nothing
    local real minX = GetRectMinX(r)
    local real maxX = GetRectMaxX(r)
    local real minY = GetRectMinY(r)
    local real resetX = minX + 16
    local real x = resetX
    local real y = GetRectMaxY(r) - 16

    loop
        call SetTerrainPathable(x, y, PATHING_TYPE_BUILDABILITY, false)
        set x = x + 32
            if x > maxX then
                set x = resetX
                set y = y - 32
                exitwhen y < minY
            endif
    endloop
endfunction

To call it in a GUI trigger you would do this:
  • Actions
    • Custom script: call DisableBuildability(gg_rct_RegionName)
 

Attachments

  • Disable Buildability.w3m
    16.7 KB · Views: 11
Last edited:

Uncle

Warcraft Moderator
Level 71
Joined
Aug 10, 2018
Messages
7,613
Environment did nothing, but pathing maps will be enough.
Not too sure what you mean, but the method I provided works.

This action changes the terrain pathability of the pathing tile found at the given point:
  • Environment - Set terrain pathing at (Center of (Playable map area)) of type Buildability to Off
Here's the thing, pathing tiles are only 32x32 units in size. A Farm for example uses a 128x128 pathing size.

You can press G in the World Editor to toggle through the Grid to see these different sizes, you'll see the smallest pathing tiles are 32x32 in size, the slightly larger ones are 128x128, and the largest ones are 512x512.

That means it's a bit of a pain to manually disable the Buildability of every single little 32x32 tile. However, that's why I made the script in my last post, which allows you to disable the Buildability across an entire Region. What it's actually doing is finding every single 32x32 tile inside of the given Region and disabling the Buildability of each of them.
 
Last edited:
Level 3
Joined
Aug 8, 2022
Messages
29
Idk, can you send a screenshot of it in Map Manager? Because i've tryed to make it work with replacing center of map with center of region, tryed to add an event or/and condition, nothing helps, its just didnt work
 

Uncle

Warcraft Moderator
Level 71
Joined
Aug 10, 2018
Messages
7,613
Idk, can you send a screenshot of it in Map Manager? Because i've tryed to make it work with replacing center of map with center of region, tryed to add an event or/and condition, nothing helps, its just didnt work
Have you seen my previous post about making it work with a region? I attached an example map as well.
 
Status
Not open for further replies.
Top