Instruction: Open game_folder\lua\vehicle\input.lua After: Code: local padOutRate = 2.5 add (with a new line): Code: cruiseControl = 0 After: Code: -- map the values add (with a new line): Code: -- simple cruise control local maxBrake = 1 local maxThrottle = 1 local carSpeed = math.floor( obj:getVelocity():length() * 2.23694 ) -- getting car speed, in mph if ( carSpeed > cruiseControl and cruiseControl ~= 0 ) then -- if carSpeed > cruiseControl = disable acceleration --M.throttle = 0 input.event("axisy0", 0, 2) if carSpeed - cruiseControl >= 5 then local newBrake = ( carSpeed - cruiseControl ) / 5 if ( newBrake > maxBrake ) then --M.brake = maxBrake input.event("axisy1", maxBrake, 2) else --M.brake = newBrake input.event("axisy1", newBrake, 2) end end elseif ( carSpeed < cruiseControl and cruiseControl ~= 0 ) then -- if carSpeed < cruiseControl = enable acceleration local newThrottle = ( cruiseControl - carSpeed ) / 5 if ( newThrottle > maxThrottle ) then --M.throttle = maxThrottle input.event("axisy0", maxThrottle, 2) else --M.throttle = newThrottle input.event("axisy0", newThrottle, 2) end --M.brake = 0 input.event("axisy1", 0, 2) end -- simple cruise control After the "end" of the "update" function (line 128) add (with a new line): Code: -- simple cruise control local function setCruiseControl() local carSpeed = math.floor( obj:getVelocity():length() * 2.23694 ) -- getting car speed, in mph if ( cruiseControl == 0 ) then cruiseControl = carSpeed else cruiseControl = 0 end print( "Cruise control set = " .. cruiseControl .. " mph" ) end -- simple cruise control After: Code: M.toggleEvent = toggleEvent add (with a new line): Code: M.setCruiseControl = setCruiseControl Open your inputmap file and put this somewhere, then change "key_name" to the desired key: Code: %mm.bindVLuaCmd(keyboard, "key_name", "input.setCruiseControl()", ""); So, when you press "key_name" - enable cruise control, after second press - disable. Attached changed input.lua .
Watchyu sayin'? - - - Updated - - - which 'end' and wheres this '(update) thing? (stuck on step 2 ) Help me Incognito, you're my only hope
In your screen end - its line 265. Btw, you can download changed files from first post. Hm... My car is always appear with the running engine.
When I tested it, the vehicles engine was not started when the vehicle was loaded until the button was pressed. You can fix this by calling the setCruiseControl function right after it ends. EDIT: I think I found what it was. I followed your instructions and didn't use your pre done file. You omitted a line from the instructions which is in the pre done file, assigning a value of 0 to M.cruiseControl.
Inognito... why aren't you hired to code for this game yet? xD You've done things the devs haven't even done yet xD
i want the toggle key to be the space bar, should i type 'spacebar' or 'space_bar' or 'space' - - - Updated - - - nevermind on above post, 'space' worked out fine; One thing you should try to incorporate is when the brake is applied, that should disengage cruise control
Can you make a version of the file that you just drag and drop in and it work, and just tell us what line to use to change the CC key
Were should I add %mm.bindVLuaCmd(keyboard, "key_name", "input.setCruiseControl()", ""); , and Should I add the quotes Ex. "U" ? Every time i add that line the game does not work.