Set temperature with a LUA trigger?

Discussion in 'Programming' started by MysteryManGER, Nov 25, 2023.

  1. MysteryManGER

    MysteryManGER
    Expand Collapse

    Joined:
    May 25, 2016
    Messages:
    749
    Hello everybody,

    Is it possible to set the ambient map temperature with a LUA trigger? For example, the default map temperature is 20°C. If you drive into the LUA trigger, the temperature is set to 0°C. If you leave the trigger the temperature will be set back to the default map temperature.

    Thanks!

    regards,
    MysteryManGer
     
  2. DaddelZeit

    DaddelZeit
    Expand Collapse

    Joined:
    Jul 17, 2019
    Messages:
    3,484
    Hi,
    this thread could help: https://www.beamng.com/threads/changing-temperature-curve.89155/

    All you'll need to do is add the code into your trigger:
    Code:
    local function onBeamNGTrigger(data)
      if data.subjectID == be:getPlayerVehicleID(0) then
        if data.event == "enter" then
          scenetree.theLevelInfo:setTemperatureCurveC({{0,0}, {1,0}})
        elseif data.event == "exit" then
          scenetree.theLevelInfo:setTemperatureCurveC({{0,20}, {1,20}})
        end
        core_environment:reset()
      end
    end
    return onBeamNGTrigger
    
     
    • Like Like x 2
  3. MysteryManGER

    MysteryManGER
    Expand Collapse

    Joined:
    May 25, 2016
    Messages:
    749
    Despite the search function, I couldn't find this thread. Thank you very much DaddelZeit, will try it tomorrow!
     
  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