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

[General] Train system with railway using shallow water pathing

Status
Not open for further replies.
Level 25
Joined
Feb 2, 2006
Messages
1,686
Hi,
I want to create a train system but keep it as simple as possible so without moving the train units periodically.
I have the idea that the train units have the movement type float just as ships and the pathing of the railways is that of shallow water.
It would be possible to keep the train on the railway and let ground units still pass the railway with this solution. However, I have no idea how I could create the pathing of shallow water without actually placing shallow water. I can't find anything about Pathing - Everything about it

There is a JASS function:
JASS:
call SetTerrainPathableBJ( GetRectCenter(GetPlayableMapRect()), PATHING_TYPE_FLOATABILITY, true )
so it should be possible?

I use destructables or doodads for the railway pieces but I would like to set the pathing manually with pathing blockers which have the pathing type floatability.
In the World Editor it shows color in the attached screenshot for shallow water's pathing.


Is this approach even possible and does it make sense? I did not think much about some disadvantages. Otherwise, I would have to move the train automatically from different checkpoints to the next ones. With my approach the check points would be less and it would be easier to order it to the next location. The wagons would simply follow the next wagon/first wagon.
It would even allow you to control the train yourself since it can never leave the railway :)
 

Attachments

  • WC3ScrnShot_121120_233254_001.png
    WC3ScrnShot_121120_233254_001.png
    1.8 MB · Views: 40
Level 14
Joined
Nov 17, 2010
Messages
1,265
I wonder if there is a way to make a naval pathable tile that can be used as a pathing blocker. You may have to just figure out the color and make it into a tga or something like that. I will do some checking and see what I can find.

edit: take a look through this and see if it helps Pathing - Everything about it

alternatively you could make the train be a flying unit and line the track with teal path blockers that allow walking but not flying to cross.
 
Last edited:
Level 25
Joined
Feb 2, 2006
Messages
1,686
Well I want avoid to make it non-pathable for flying units since I have some helicopters which would be blocked. I have already looked at the Pathing explanation article. It does only explain how to set the correct movement and placement for units and structures in water and how the pathing of water is shown in the editor. For the pathing blockers no type for naval pathing is listed.

I tried to write a JASS function which changes the pathable flag for a whole rect:
JASS:
function SetRectPathing takes rect whichRect, pathingtype pathingType, boolean flag returns nothing
        local location whichLocation = Location(GetRectMinX(whichRect), GetRectMinY(whichRect))
        local real x = 0.0
        local real y = 0.0
        loop
            exitwhen (x > GetRectMaxX(whichRect))
            set y = 0.0
            loop
                exitwhen(y > GetRectMaxY(whichRect))
                call MoveLocation(whichLocation, x, y)
                call SetTerrainPathableBJ(whichLocation, pathingType, flag)
                set y = y + 1.0
            endloop
            set x = x + 1.0
        endloop
        call RemoveLocation(whichLocation)
        set whichLocation = null
    endfunction

    function SetRectFloatable takes rect whichRect returns nothing
        call SetRectPathing(whichRect, PATHING_TYPE_FLOATABILITY, true)
    endfunction
However, it does not seem to work when I change the rects below the train to floatable and the train has the movement type floating. I am not sure if it is precise enough to use x ü 1.0 and y + 1.0 to make the whole rect pathable.
The color for the ground pathing of shallow water is the same as for invisible platforms. When I place an invisble platform on the map and show the naval pathing it shows it as pathable for ships as well. However, I cannot place units with floating pathing on it in the world editor. I could try to place invisible platforms on my railway.

edit:

It works with invisible platforms! I changed the movement type of ships and my train to foot, placed them on the invisibile platforms and changed it back to floating. I can move them ingame. Hence, the World Editor did prevent me from placing the units but it actually works!

Now I will have to figure out how to set the minimal follow distance/delay for units so that the wagons will follow immediately.
 
Last edited:
Status
Not open for further replies.
Top