Released Speed limiter with GUI

Discussion in 'Utilities and programming' started by GregBlast, Sep 19, 2013.

  1. GregBlast

    GregBlast
    Expand Collapse

    Joined:
    Aug 12, 2013
    Messages:
    224
    Information

    This is a little modification that allows you to limit the speed of your vehicle. It has a GUI that can be used to tweak the speed limit.
    Once you reach the specified speed limit your vehicle will attempt to stick to it. For some vehicles with too much power however (like the Civetta Bolide) you could still go over the limit.


    Installation





    • Extract the contents of the zip file in attachment to your game directory (...\AppData\Local\BeamNG\BeamNG.drive-0.3) or wherever you installed it.
    • open [game dir]\lua\system\main.lua and below the group of lines with require statements add this require:
      Code:
      speedLimiterGUI= require("speedLimiterGUI")
    • in that same file locate the 'graphicsStep' function a little below and at the end of that function add the following code:
      Code:
      speedLimiterGUI.update()
    • open [game dir]\lua\vehicle\default.lua and below the group of lines with require statements add this require:
      Code:
      speedLimiter = require("speedLimiter")
    • open [game dir]\scripts\client\inputmaps\keyboard.inputmap.cs and at the end of the file add the following bind:
      Code:
      %mm.bindSLuaCmd(keyboard, "alt u", "speedLimiterGUI.showGUI()", "" );
    -> change "alt u" by any shortcut you want to use to open the speed limiter GUI

    Now you should be good to go :).


    Notes

    I'll make a tutorial on how to build this when I get the time. This is an example of interaction between System LUA and Vehicle LUA with a GUI in addition.


    Contents



    See attachments below.
     

    Attached Files:

    • Like Like x 1
  2. LiLFunnyMan

    LiLFunnyMan
    Expand Collapse

    Joined:
    Aug 31, 2013
    Messages:
    11
    I hope you can make the turorial soon... :p
     
    #2 LiLFunnyMan, Sep 19, 2013
    Last edited: Sep 19, 2013
  3. Incognito

    Incognito
    Expand Collapse

    Joined:
    Aug 4, 2013
    Messages:
    246
    1. Simple-cruise-Control :)
    2.
    That is, this speed limit only works for one car - with an id = 0.
     
  4. GregBlast

    GregBlast
    Expand Collapse

    Joined:
    Aug 12, 2013
    Messages:
    224
    Yeah I guess it wouldn't be 0 if you spawn a car and use it but this is just a small example.
    And about your cruise-control I didn't check it out but this is not cruise-control. This is what it says: speed limiter. You just can't drive above the defined speed. Cruise control makes you keep going at a specified speed no matter your inputs (or maybe faster if you keep using the throttle and cut it if you brake).

    Anyways this is more like a little sample for modules and interaction between System and Vehicle through a GUI.
     
  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