1. Trouble with the game?
    Try the troubleshooter!

    Dismiss Notice
  2. Issues with the game?
    Check the Known Issues list before reporting!

    Dismiss Notice
  3. Before reporting issues or bugs, please check the up-to-date Bug Reporting Thread for the current version.
    0.35 Bug Reporting thread
    Solutions and more information may already be available.

Creating digital gauges

Discussion in 'Troubleshooting: Bugs, Questions and Support' started by SushiPro, Apr 29, 2018.

  1. SushiPro

    SushiPro
    Expand Collapse

    Joined:
    Dec 21, 2015
    Messages:
    258
    I've been looking through ETK files to try and understand how digital gauges are done, but I'm stuck. I know how to create an HTML gauge cluster and do the js, but I don't know how to map it as a material. How would I do that?
     
    • Agree Agree x 2
  2. Neo

    Neo
    Expand Collapse

    Joined:
    Oct 31, 2015
    Messages:
    262
    Hi @SushiPro ,
    I think this process lives in BeamNG.drive\lua\vehicle\material.lua:updateGFX(). This function fetches the electric values and first checks which values have been changed and wich not (ll.229-244).After that it checks how high the value is and determine which material should be used (newMat = va.on or newMat = va.on_intense) (ll.244-274). If a material was found it applies the new material (ll.274-285).I think the real interesting lines are 280 and 282. With these commands you should can replace your material in you own script. The first parameter for the switchMaterial-function is I assume a numeric id (I´m not 100% where the id is coming from) and the second parameter is the material name. You may also have a look into the function switchMaterial(msc, matname) declared in line 32.
    Example: ETK I 2400ti TTSport Evolution -> VehicleLua: obj:switchMaterial(2,"etki_lights_on") switches one of the booster lights to white.
    I hope that helps you :).
     
    #2 Neo, Jul 28, 2018
    Last edited: Jul 28, 2018
  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