Solved Use lua in jbeam file

Discussion in 'Mod Support' started by jojos38, Jan 6, 2017.

  1. jojos38

    jojos38
    Expand Collapse

    Joined:
    Oct 22, 2013
    Messages:
    1,071
    Hi, how can i use a lua line in a jbeam file please ?
     
  2. aljowen

    aljowen
    Expand Collapse

    Joined:
    Oct 21, 2012
    Messages:
    1,677
    As far as I am aware you can't embed Lua into a jBeam file. They should be separate files.

    It would help a lot if you gave more information about what you are wanting to achieve.

    As far as I am aware if you create a folder called "lua" in the same directory as your main jbeam file any lua files within that folder should run when your vehicle is loaded. However I could be wrong about that.

    Here is some general wiki stuff about how to access your vehicle data from within your lua code which may or may not be helpful to you: http://wiki.beamng.com/Streams
     
  3. jojos38

    jojos38
    Expand Collapse

    Joined:
    Oct 22, 2013
    Messages:
    1,071
    I would like to run a lua code: sounds.test() if the player choose the police variant of the moonwalk. But only if he choose the police. Thanks :)
    http://www.beamng.com/resources/police-lightbar-sound-mod.1749/
     
  4. jojos38

    jojos38
    Expand Collapse

    Joined:
    Oct 22, 2013
    Messages:
    1,071
    ?
     
  5. aljowen

    aljowen
    Expand Collapse

    Joined:
    Oct 21, 2012
    Messages:
    1,677
    I haven't responded because I don't know of a good way of doing that. The only thing I could come up with was making the police variant have an engine that revs 1rpm higher and using that to detect which variant the player has loaded. Which could work but is a pretty rubbish solution.
     
  6. jojos38

    jojos38
    Expand Collapse

    Joined:
    Oct 22, 2013
    Messages:
    1,071
    Okay :p thanks
     
    • Like Like x 1
  7. Diamondback

    Diamondback
    Expand Collapse
    Vehicle Systems Lead
    BeamNG Team

    Joined:
    Apr 8, 2014
    Messages:
    1,966
    It's a bit overkill but you can create a specific controller for this case which gets loaded from jbeam only for that specific part.
    Certainly will work as you want it to work.
    Take a look at the ETK post crash brake controller.
     
    • 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