Solved Issues with light

Discussion in 'Mod Support' started by Skabelse, Aug 4, 2018.

  1. Skabelse

    Skabelse
    Expand Collapse

    Joined:
    Jun 23, 2015
    Messages:
    12
    Hello!

    I'v been experimenting with making the headlights of a car flash when the lightbar is activated, but couldn't get it working.

    Could someone point out to me how that would work?

    Like the headlights in this video:
     
  2. torsion

    torsion
    Expand Collapse

    Joined:
    May 31, 2015
    Messages:
    1,600
    I expect that you'll have to learn about two or three topics:
    1. Lua scripting and hooking that up to the game. You could start by making headlights blink (together) when the lightbar is turned on. Look at the Lua that makes the light bar go, that's probably a good place to learn. Another place to learn would be adaptiveBrakeLights.lua where the adaptive brakelights are hooked up.
    2. Making modified copies of 'parts' from the jbeam. This will be similar to how people make 'custom' engines using the same mesh and mostly the same jbeam/powertrain as an official engine. It's mostly copy and paste and there are plenty of tutorials on the engines topic, just adapt one of those to your needs. See below for more comments on why.
    3. Spotlight props. Refer to the bottom of this page: https://wiki.beamng.com/Props#Lights
    The reason you'll need to learn about making modified copies of the props is that you can't make a wig-wag with the stock headlights. The official content only defines one "func" each for high and low: there is no high_L or high_R, only high. Take a look in the file sunburst_headlights.jbeam to get an idea what I'm talking about. You'll find that inside the "_R" headlight part there are 3 props with a mesh of "SPOTLIGHT". Each of them has a func associated with it: "highbeam", "lowbeam", and "signal_R". The same situation applies with the "_L" headlight: "highbeam", "lowbeam", and "signal_L". Hopefully you can see the issue here. Fixing it is simple enough, but will require fresh Lua to be written tying the "highbeam" func to a "highbeam_L" and "highbeam_R". Then you'll need new headlight parts looking for that, and of course your lightbar code will over-ride those independently to get a wig-wag.
     
    • Informative Informative x 2
  3. Skabelse

    Skabelse
    Expand Collapse

    Joined:
    Jun 23, 2015
    Messages:
    12
    Thank you for taking the time to write that!
    I'll try to mess with those things and see if I would get something working.
     
    • 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