Names of vehicles for .prefab files, how to trigger certain events.

Discussion in 'Content Creation' started by The Gas Station, Jul 26, 2016.

  1. The Gas Station

    The Gas Station
    Expand Collapse

    Joined:
    Jul 14, 2016
    Messages:
    272
    Hello everyone!
    I have two questions.

    First- what is the vehicles names I should use for game files? I noticed the d15 uses "pickup", and the covet uses "hatch". What are the names of the other vehicles?

    Second- how can I trigger events during a scenario? I mean, after you cross a certain waypoint, I want something to happen. How can I do it?
     
  2. mumboking

    mumboking
    Expand Collapse

    Joined:
    Jun 11, 2015
    Messages:
    1,400
    For the first one, just look at the files in "BeamNG.drive\content\vehicles\"
     
    • Like Like x 2
  3. RyvyLo

    RyvyLo
    Expand Collapse

    Joined:
    May 15, 2014
    Messages:
    438
    And for the second one, you can trigger events after crossing a waypoint using this lua code :

    Code:
    local function onRaceWaypoint(data, goal)
       
        if data.waypointName == 'yourWaypointNameHere' then
            theEvent()
        end
       
    end
    
    return {
        onRaceWaypoint = onRaceWaypoint,
    }
     
    • Like Like x 1
  4. sketchy_b

    sketchy_b
    Expand Collapse

    Joined:
    Apr 13, 2014
    Messages:
    62
    Ok, thanks for that. Although I was hoping for a way to do it through the new scenario creation format. The way its done through the scenario.json I have created a few lua scripts but it seems they didn't work after the latest update. Did you have any issues with this?
     
  5. The Gas Station

    The Gas Station
    Expand Collapse

    Joined:
    Jul 14, 2016
    Messages:
    272

    Um... I understand the code, but since I'm new to modding in Beamng, is there a way where I can see what events commands exist? I mean, I have no idea what syntax and what commands should be in the "TheEvent()" section.
    If there's a tutorial to .lua files usage, it would be useful if someone could link it for me.
     
  6. RyvyLo

    RyvyLo
    Expand Collapse

    Joined:
    May 15, 2014
    Messages:
    438
    Yeah this is the hard part, understanding what command does what. If you don't know how to use Lua but you understand the principle of programmation, it's easy to learn it with google. There's some BeamNG specific lua documentation on the wiki and in "BeamNG.drive\lua\lua-doc.zip" but it's hard to understand what arguments corresponds to what.
    The best way I found is to open other scenarios's Lua and see what's possible ( Scepheo's scenarios are the best, especially the Random Tour one ). There's also a script extender called bnse which add a lot of events and has a clear and easy to understand documentation, I recommend to check it out.
     
    • Like Like x 1
  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