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

How do you make a terrain "unwalkable"?

Status
Not open for further replies.
Level 14
Joined
Apr 20, 2009
Messages
1,543
If you have JassNewGenPack you can specify which tile should have which pathing, such as Buildable, Walkable, Flyable.

Take a look here for JassNewGenPack:
http://www.hiveworkshop.com/forums/...456/how-download-install-confige-jngp-160547/

Once installed go to:
UMSWE->Customize Tile Pathability

It should pop up a window with all the tiles. Select the one you want to change the pathability of, save your map close JNGP and re-open it.

If you don't want to use JassNewGenPack then you can create your own pathing map. A tutorial on how to do that can be found here:
http://world-editor-tutorials.thehelper.net/pathmaps.php
 
Level 2
Joined
Apr 2, 2012
Messages
17
Cant you just make 1 big region in the area where you dont want them to walk, and then go to triggers and make a trigger that removes unit, and then makes a new one at the same spot?
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Why would you want to do that if changing the pathability of a tile can be way and way easier?

I know It's possible to make regions which teleports the unit back to the edge of the region, but it's way more work then you think.
I've created such a system myself, but changing the path of a tile is a way easier solution which works more fluently.
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Check every ... the terrain type at the position of a unit, then order it to stop moving.
Or you could store the previous position of the unit and move it instantly to the previous position if his current position is on top of a specified terrain type.

  • (Terrain type at (Position of(Your_Unit) Equal to Lordaeron Summer - Dirt
You can also use regions without specified terrain but this is a bit more advanced.
You can then for example create a region and when the unit leaves the region on 2 sides of the region make it teleport back inside the region on the previous position of the unit.
This would need a custom region system with any geomatrical shape.
I can give one to you in Jass, but I don't know if you'll find much use for it.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
You people are sometimes too smart to see the solution...

  • Change Pathablility
    • Events
    • Conditions
    • Actions
      • Environment - Set terrain pathing at Location of type Walkability to Off
      • -------- MAkes terrain at 'Location' unwalkable --------

That will only create a pathing blocker-like at the exact Location/Point (which is ridiculously small point to cover) to not be able to walk, not the entire region/terrain.

We are called as "smart" for a reason.

Somehow, we must convert it to coordinates to cover a larger area such as Regions created via pre-set.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
the unit will still have a 8 radius collision
Flying units does not takes up space (with 0 collision size (Object Editor)), even the model is Peasant.

First, I tried creating the unit exactly at the spot (where the Environment action is done) and try to move across it, but my unit instead move around the Peasant (I assume it could be blocked by my Peasant instead the trigger action).

And the next round, I order my Peasant to move somewhere else and I tried to move across it, and I succeeded this time.
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Sorry for this late respond, but I'm going to put this here as measurement refference for those who would like to know ;)

gridexample.png


In other words, if a peasant where to have 128 attack range and 0 collision, and you would let 2 peasants fight each other, they would stand roughly 4 smallest grid squares away from each other in order to hit each other.

Why did I say roughly 4 small grid squares and not exactly?
Remember what Tirlititi said:

By the way, if you put 0 collision in the object editor, the unit will still have a 8 radius collision. It's improperly handled by the editor so you may put a bunch of preplaced units in a very small area but they won't be created at the same position in-game.

If they would for example have something like 16 collision, then the distance between the two in order to hit each other would be:

128 - 32 (2 times 16 collision since they both have this collision) = 96
Which is 3 squares away...

To test it you could do something as simple as:

  • Simple Test
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (String((Distance between (Position of Peasant 0000 <gen>) and (Position of Peasant 0001 <gen>))))
Simply place 2 enemy peasants and change the collision and attack range of the peasant inside the object editor.


also, be reminded that 32x32 is the smallest grid. This can not be reduced to something smaller.

Pathing can not be reduced to smaller than 32x32.
(Each pixel in a TGA file represents 32 grid units in the editor).
More info on custom pathing maps can be found here: Custom Pathing Maps by SD_Ryoko


EDIT: made a few adjustments due to mistakes (it's way to late over here >.>), all should be good now...
 
Last edited:
JASS:
function PaintPathing takes real mX,real mY,real MX,real MY,pathingtype P,boolean T returns nothing
    local real X
    local real Y
    local integer I=0
    set mX=R2I(mX/32)
    set mY=R2I(mY/32)
    set MX=R2I(MX/32)
    set MY=R2I(MY/32)
    if mX==MX or mY==MY then
        set P=null
        return
    endif
    set X=mX
    loop
        exitwhen X>MX
        set Y=mY
        loop
            exitwhen Y>MY
            call SetTerrainPathable(X,Y,P,T)
            set I=I+1
            if I>=2000then
                set I=0
                call TriggerSleepAction(0.01)
            endif
            set Y=Y+32
        endloop
        set X=X+32
    endloop
    set P=null
endfunction

function PaintPathingRect takes rect R,pathingtype P,boolean T returns nothing
    call PaintPathing(GetRectMinX(R),GetRectMinY(R),GetRectMaxX(R),GetRectMaxY(R),P,T)
    set R=null
    set P=null
endfunction

Here ya go, a JASS function to use that will paint pathing types.
Includes a wrapper function to use GUI regions (rects)

Copy and Paste this into the custom map script (has the map icon in the trigger editor and is above your triggers.).

to call simply use:
  • Set myRect = SomeRegion
  • Custom script: call PaintPathing(udg_myRect,PATHING_TYPE_WALKABILITY,false)
That'll make it unwalkable, or should, i might have my true/false backwards.
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Is this way not working? I tried it and heroes still walked over the tiles.

It should work, are you sure Custom Tile Pathability is checked under UMSWE?
Also remember that you can press p inside the editor to see if the change made any effect or not.
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Too bad WorldEdit lacks support for this feature although WarCraft III map structure does allow it.

Do you perhaps know how to alter war3map.wpm to your advantage?
Would I need to alter the actual bytes?
If so, how can I see those bytes?
Simply by opening it in a notepad doesn't really work :/
Excuse me for my ignorance on this matter.

It would be quite nice to know how to paint your own pathing for an entire map.
I'm really interested in this.

EDIT: oops, totally forgot about hex editors xD
Nevermind this question, already figured it out thnx ;)

EDIT2: Also I just realised that you have mentioned this to me before Dr Super Good.


For those interested in altering the pathing map file of your warcraft 3 map, I suggest you get yourself an MPQ- and a hex editor and then take a look at one of these tutorials:
http://www.thehelper.net/threads/guide-explanation-of-w3m-and-w3x-files.35292/
http://www.wc3c.net/showthread.php?t=123
 
Last edited:
The problem is that a .wpm editor should be implanted in the real WE terrain editor or at least display the map's terrain and doodads.

Also, Zeatherann, your function doesn't work :
- if I>=2000then -> if I>=2000 then,
- The 4 first lines of the function must be removed,
- The use of a TriggerSleepAction is really bad for several reasons (use a TriggerExecute/Evaluate or an ExecuteFunc instead),
- No need to null function arguments and no need to null pathingtypes.
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
The problem is that a .wpm editor should be implanted in the real WE terrain editor or at least display the map's terrain and doodads.

You do realise that there is no .wpm editor at this moment? This needs to be created in its entirety if it even were to ever be implemented into the WE.

Right now the only possibility of altering the .wpm file (which can be extracted from the maps MPQ archive) is to use a hex editor.

By using a hex editor you can alter the hexadecimal values of the data inside the .wpm file, changing it to the appropriate flags in such a way that you can create pathing for your entire map by going through the file tile by tile (byte by byte).

tutorial said:
Data:
Each byte of the data part is a part of a tileset exactly like for the TGA.
Data size: (map_height*4)*(map_with*4) bytes
Flags table:
0x01: 0 (unused)
0x02: 1=no walk, 0=walk ok
0x04: 1=no fly, 0=fly ok
0x08: 1=no build, 0=build ok
0x10: 0 (unused)
0x20: 1=blight, 0=normal
0x40: 1=no water, 0=water
0x80: 1=unknown, 0=normal

(Correct me if I missunderstood the concept or am being ignorant)

If someone wants to create an entire editor that reads and writes the bytes of this file's extension in a scripting language like C then be my guest.
I think lots of people would appreciate it. (Personally I don't really have the time to do so)
It would be great to have some kind of Graphical User Interface in order to "paint" pathing onto the map instead of having to alter it manually through hexadecimal values.
Whether it be a standalone application or not, it would increase the workflow of lots of users out here (for example not having to deal with pathing blockers anymore).
 
Last edited:
I think you misunderstood me...

Making a program that reads and edits .wpm files is already a little to work but it would be useless if you can only see the pathing without any cliff, ground texture or doodad displayed.

That's why you need either to include it in the WE or to make the program additionally reads and displays .doo and .w3e files (at least).
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
I think you misunderstood me...

Making a program that reads and edits .wpm files is already a little to work but it would be useless if you can only see the pathing without any cliff, ground texture or doodad displayed.

That's why you need either to include it in the WE or to make the program additionally reads and displays .doo and .w3e files (at least).

Ah yes, it would be rather hard to create pathing for your map if you don't know the placement of your cliffs and doodads. That's a good point...

You're right, if one where to create this it would need to be abled to read .doo and .w3e files too.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Is there anyway to actually import a .tga image into WE to actualy replace the whole pathing of the map(ofcourse I am asking for a possible file path name when imported). If I think so right you could actually import this kind of texture into WE and add it to a doodad to do this anyway.
Correct me if i am wrong.
Only in the WarCraft III beta could you do that. Although the final pathing map is basicly a bitmap it is no longer a TGA formated bitmap (custom header). A simple converter could be made though so it can be edited as an image.
 
Status
Not open for further replies.
Top