Help! How to ignite & shut engine in customized Lua

Discussion in 'Content Creation' started by ArkFz, Mar 5, 2024.

  1. ArkFz

    ArkFz
    Expand Collapse

    Joined:
    Dec 24, 2023
    Messages:
    19
    I am editing lua/powertrain/combustionEngine.lua.
    I created a battery which will be charged by the engine.
    I'd like to let the engine shut down when the battery is charged to 80% and ignite the engine when battery level is below 20%.
    However, I don't know which part of the lua files controls the engine ignition. How should I program to let the engine work as I expect?
    (Following by the lua file I edited)
     

    Attached Files:

  2. epicfacecanada

    epicfacecanada
    Expand Collapse

    Joined:
    Oct 8, 2016
    Messages:
    441
    You can use the mod below for reference as it has diesel-engine powering an electric generator for a hybrid setup but basically most of controls for the engine are handled not in combustionEngine.lua but vehicleController.lua. So in order to control it you can leave combustionEngine.lua alone and instead make a custom controller file to operate the engine instead of the main vehicle controls.

    https://www.beamng.com/resources/t-series-drivetrain-expansion.29462/
     
  3. ArkFz

    ArkFz
    Expand Collapse

    Joined:
    Dec 24, 2023
    Messages:
    19
    Thanks. I tried to learn from this mod. However, the rotators turn out to interfere the driving safety system such as ABS and ESC. They are recognized as wheels with braking system.
     
  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