Trigger for changing exact car parts at exact location?

Discussion in 'Programming' started by DeWorD, Mar 27, 2023.

  1. DeWorD

    DeWorD
    Expand Collapse

    Joined:
    Jan 20, 2017
    Messages:
    147
    Hello everyone! :)

    I don't know anything about lua code so have to ask how hard is it for noob to make one or how it's even possible?

    Making a map https://www.beamng.com/threads/carkour_chaos.91129/ and would need it in there :)

    which is driving from point A to B and in some 'checkpoint' areas i want player to change few car parts, but would be much easier for the player just drive to a garage and it would spawn new car without the hassle of changing those one by one.


    Big thanks in advance!

    Is there easy place to learn lua code for beam ng? For world editor thingys mostly? Or any ready code thingys anywhere what could use? I only know teleport lua xD
     
  2. daniel-w

    daniel-w
    Expand Collapse
    BeamNG Team

    Joined:
    Jan 28, 2017
    Messages:
    284
    Hello :)

    If you're new to Lua, I recommend checking out https://www.tutorialspoint.com/lua/lua_overview.htm and https://devdocs.io/lua~5.1/ (5.1 because of LuaJIT but also check out newer versions since LuaJIT adds some of those features).

    There's no API for BeamNG so you'll have to spend some time going through the lua files to find what you want.
    Since you want to change parts, I would start off by looking through the javascript for the parts selector and find how that changes the part. My guess is that it has an object of changes parts and then it gets sent to Lua. That's generally how you mod BeamNG, it takes time but I find it fun. I just wish the developers added some funny comments so I have something to laugh at as I scroll through.

    I hope that somewhat helps
     
    • Like Like x 1
  3. DeWorD

    DeWorD
    Expand Collapse

    Joined:
    Jan 20, 2017
    Messages:
    147
    Uu links thank you i shall check those out and yes im very beginner in coding overall :D
     
  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