Solved Adding bus routes to map

Discussion in 'Mod Support' started by Vollkornbrot, Mar 30, 2019.

Tags:
  1. Vollkornbrot

    Vollkornbrot
    Expand Collapse

    Joined:
    Feb 6, 2019
    Messages:
    2
    I made a map with bus stop objects and other stuff.
    .. a decent map.

    But i cant find a tutorial that shows how to setup bus routes.

    Do i need to program something?
    Or what?

    Please help me.

    Here a the locations:

    screenshot_2019-03-30_17-25-28.png screenshot_2019-03-30_17-25-16.png screenshot_2019-03-30_17-26-21.png screenshot_2019-03-30_17-26-00.png screenshot_2019-03-30_17-25-41.png
     

    Attached Files:

    • screenshot_2019-03-30_17-26-21.png
  2. RyvyLo

    RyvyLo
    Expand Collapse

    Joined:
    May 15, 2014
    Messages:
    438
    As many things gameplay-related on this game, the best way to figure out a system is to look for the relevant files in the game files, copy-paste them to your level and edit the fields to adapt it to your level.

    I order to create a bus route, you'll need 2 things :

    1) Create the bus stop triggers
    In the level editor, you need to place the box that the bus must be in to validate that the bus is parked next to your bus stop.
    To keep things organised, I advise you create a new folder/simgroup called "busstops" in the level editor. In this folder, you need to place "Lua Trigger" objects (Library tab -> Level tab -> Lua Trigger). Give it a relevant name (ex: busStop_1). You'll then need to scale and place this trigger where the bus needs to be parked.
    The parameters you'll need are as follow :

    You can then copy and paste these triggers until you made one in front of every bus stop.

    2) Create the bus line
    In the folder Documents\BeamNG.drive\levels\yourLevelName\buslines (that you'll need to create), you want to make a new file named "yourLevelName.buslines.json". In this file you'll tell the game how to make the bus lines. Here's an example :
    Code:
    {
        "version": 1,
        "routes":[
            {"routeID":"42",
                "variance":"a",
                "direction":"theFinalStopName",
                "routeColor": "#ff8c00",
                "vehicle" : {
                    "model": "citybus",
                    "config": "city"
                },
                "tasklist":[
                    "busStop_1",
                    "busStop_2",
                    "busStop_3",
                ],
                "spawnLocation": {
                    "pos": {"x": 0,"y": 0,"z": 0},
                    "rotAngAxisF": {"x": 0,"y": 0,"z": 1,"w": 267}
                },
                "navhelp" : {
                    "busStop_2" : ["helpWaypoint_1", "helpWaypoint_2"],
                },
                "previews":[
                    "busLinePreviewImage.png"
                ]
            },
        ]
    }
    Some notes on the functions :
    "routeColor" : Color of your line, in the hexadecimal format
    "vehicle" : The default bus selected for the line
    "tasklist" : List of the bus stop triggers needed to cross to complete the bus line
    "navhelp" : (optional) If the automatic navigation doesn't pick the route you want, you can add waypoints in the level and tell the navigation to show the path to the waypoints then to the bus stop. For example here in between busStop_1 and busStop_2, the navigation arrows will go to helpWaypoint_1, then to helpWaypoint_2 and then to busStop_2, instead of directly from busStop_1 to busStop_2
    To add another route, copy-paste everything between {"routeID": and }, just after this curly brace.

    And your bus route should now be created and working ! If it doesn't work, you can look in the console (search for the binding to bring it up in the controls), it often shows where the error comes from.
     
    • Informative Informative x 1
  3. Vollkornbrot

    Vollkornbrot
    Expand Collapse

    Joined:
    Feb 6, 2019
    Messages:
    2
    Thanks! I really like how staff members reply good answers to a thread.
    Thanks a lot.
     
  4. beamhole

    beamhole
    Expand Collapse

    Joined:
    Feb 9, 2021
    Messages:
    36
    This might actually help me with my map!
     
    #4 beamhole, Feb 19, 2021
    Last edited: Feb 20, 2021
  5. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,056
    You might want to double check if it still works after 2 years
     
  6. DaddelZeit

    DaddelZeit
    Expand Collapse

    Joined:
    Jul 17, 2019
    Messages:
    3,319
    It does, otherwise my custom bus routes would be broken already.
     
  7. Philipo98

    Philipo98
    Expand Collapse

    Joined:
    Jan 2, 2014
    Messages:
    61
    Tried it this way. And tried it the copy/paste way. My Map doesn't show up in the bus routes Map Selector. I cleaned Cache and watched for any kind of error in the console. But nothing there. I placed the 'BeamNGTrigger' class Object with Lua Function onBeamNGTrigger. Everything is fine controlled it 1000 times.

    Do your bus routes work this way at this date?
    @DaddelZeit which Map has the bus routes on it?

    //EDIT: Found everything in the new wiki.
    https://documentation.beamng.com/modding/gamemodes/buslines/

    The /scenarios/bus/bus_level.json wasn't there.

    :D
     
    #7 Philipo98, Sep 28, 2021
    Last edited: Sep 29, 2021
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice