Outdated Automatic hazard lights on accident + emergency brakes

Discussion in 'Utilities and programming' started by Davidbc, Sep 2, 2013.

  1. Davidbc

    Davidbc
    Expand Collapse

    Joined:
    Mar 20, 2013
    Messages:
    1,334
    I've been watching some ''Crash compilation videos'' and I have noticed than in most crashes the hazard lights turn on automatically after a crah or after applying full brakes, so, as the title says, I have added a small code to the game that will turn on the hazard lights after a crash or after full braking. It uses the in-game G sensors, and whenever there is a read higher than 18 G the hazard lights are turned on (the value can be changed to be more/less sensitive), I'm uploading a video to show it:




    Kown bugs:

    -Sometimes when spawning a car the hazard lights turn on themselves, this is due to the G sensors giving a huge value when spawning or resetting a car, so you'll have to turn them off, but other than that it works fine.

    If you're interested just download and unzip the file in: BeamNG\BeamNG-DRIVE-0.3\lua\vehicle It will ask to overwrite a file, so make sure you make a backup (even though the updater can set all files to default)

    There are 3 files:

    -electrics1: This only has the ''lights on crash''

    electrics2: This only has the ''lights on full brake''

    electrics3: This has both features.
     

    Attached Files:

    #1 Davidbc, Sep 2, 2013
    Last edited by a moderator: Oct 21, 2015
  2. marvtheking

    marvtheking
    Expand Collapse

    Joined:
    Feb 20, 2013
    Messages:
    111
    Re: Automatic hazard lights on accident

    Thats a really nice feature

    In the last traffic jam,i saw a new audi,breaking really hard,the lights also went on there,maybe you could add that
     
  3. Davidbc

    Davidbc
    Expand Collapse

    Joined:
    Mar 20, 2013
    Messages:
    1,334
    Re: Automatic hazard lights on accident

    Yes I thought about that too, I think I can do that for when you apply full brakes.

    Edit: I have added that as well :D Now if you're going any faster than 50 km/h and apply full brakes the hazard lights will turn on :cool:
     
    #3 Davidbc, Sep 2, 2013
    Last edited: Sep 2, 2013
  4. Davidbc

    Davidbc
    Expand Collapse

    Joined:
    Mar 20, 2013
    Messages:
    1,334
    Re: Automatic hazard lights on accident + full brakes

    If you have any more ideas feel free to ask, I might be able to do it :D
     
  5. AMG V12

    AMG V12
    Expand Collapse

    Joined:
    Aug 16, 2013
    Messages:
    209
    Re: Automatic hazard lights on accident + full brakes

    That really is nice :) It's little things like that that improve the game :) Well done!
     
  6. Possibly_Pos

    Possibly_Pos
    Expand Collapse

    Joined:
    Aug 31, 2013
    Messages:
    213
    what about make something that if you flip you can press a button and it flips the car back over or like in rigs of rods backspace reset your car in the position but it does not reset the spawn point

    also love the addon :p
     
  7. Zero

    Zero
    Expand Collapse

    Joined:
    Sep 2, 2012
    Messages:
    1,146
    How to install this?
     
  8. Jujune

    Jujune
    Expand Collapse

    Joined:
    Aug 5, 2013
    Messages:
    1,074
    Drop the Lua File to: /user/BeamNG.Drive/lua/vehicle
     
  9. Zero

    Zero
    Expand Collapse

    Joined:
    Sep 2, 2012
    Messages:
    1,146
    You sir, are my hero!:D. Thanks^^

    Great mod btw, epic.
     
  10. shotgun347

    shotgun347
    Expand Collapse

    Joined:
    Aug 12, 2013
    Messages:
    31
    How do i edit the g-force needed to set off the lights?
     
  11. Davidbc

    Davidbc
    Expand Collapse

    Joined:
    Mar 20, 2013
    Messages:
    1,334
    Sorry for the late response, sleeping time here :p.

    Open electrics.lua, search for this line: if warncrash > 180 then

    And edit the number. (180 is 18G.)
     
  12. ThatGamer164

    ThatGamer164
    Expand Collapse

    Joined:
    Jan 25, 2013
    Messages:
    593
    This is awesome, I was going to ask about this when I saw this in euro ncap [MEDIA=youtube]http://m.youtube.com/watch?v=J9cakKinONA[/MEDIA]
    As you can see on the side impact at 0:43, the hazards go on by them selves.
     
  13. FleAZN

    FleAZN
    Expand Collapse

    Joined:
    Aug 20, 2013
    Messages:
    1
    Hi Guys

    Cant seem to get this working or even edit the document to change the G-force amount. Cannot find that line in the document. Tested in game and cannot get the indicators to start whether its hard braking or crashing.


    Any Help Please, Would be much appreciated

    EDIT ---

    Turns out I wasint going fast enough in the crash so thats working fine. Still nothing under hard braking and cannot find the line to change the G- Force
     
    #13 FleAZN, Dec 14, 2013
    Last edited: Dec 14, 2013
  14. Jujune

    Jujune
    Expand Collapse

    Joined:
    Aug 5, 2013
    Messages:
    1,074
    You have downloaded this, wright?
    http://www.beamng.com/attachment.php?attachmentid=7895&d=1378140542
     
    #14 Jujune, Dec 17, 2013
    Last edited: Dec 17, 2013
  15. Griffin3300

    Griffin3300
    Expand Collapse

    Joined:
    Feb 3, 2014
    Messages:
    25
    Really cool addon!

    Now if only we can get airbags... :confused:
     
  16. JohnnyMacDonald

    JohnnyMacDonald
    Expand Collapse

    Joined:
    Oct 1, 2014
    Messages:
    47
    i cant get it to work help please
     
  17. Hati

    Hati
    Expand Collapse

    Joined:
    Aug 5, 2012
    Messages:
    1,367
    Just click between pluto gravity and zero gravity till you bounce the car back onto it's wheels.
     
  18. clayton8or

    clayton8or
    Expand Collapse

    Joined:
    Aug 26, 2013
    Messages:
    1,047
    Nice trying to help but... It's a 2013 thread lol I think you should use a PM for that stuff.

    As for Johnny it might be broken, just try changing the installation place for experimental.
     
  19. JohnnyMacDonald

    JohnnyMacDonald
    Expand Collapse

    Joined:
    Oct 1, 2014
    Messages:
    47
  20. Svpracer

    Svpracer
    Expand Collapse

    Joined:
    Aug 21, 2013
    Messages:
    231
    sorry if this is a bump...
    I copied and pasted this code into the new electrics file and it works nicely. Can I post a "updated" file here?
     
  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