How to create custom transmission modes?

Discussion in 'Content Creation' started by Michaelflat, Jun 1, 2018.

  1. Michaelflat

    Michaelflat
    Expand Collapse

    Joined:
    Jul 10, 2014
    Messages:
    1,543
    @fufsgfen has been helping me with making custom automatic transmission modes, but i just don't understand at the moment.

    Requirements:
    Mode "5" Will go through all gears except 6th
    Mode "W" will go through ONLY 2, no shifting into 1.

    But with the two files, it instead has the modes.. PRNDS21M. I have no idea why.

    You can see my lua file and my transmission file have no mention of those.
     

    Attached Files:

  2. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    Sorry, didn't had time to peek file, but did you remember to add extra IF clauses to cover those extra modes?
     
    • Like Like x 1
  3. Michaelflat

    Michaelflat
    Expand Collapse

    Joined:
    Jul 10, 2014
    Messages:
    1,543
    yeah did. But the modes aren't showing up, and other random modes are there. Like S, M, 2 and 1. And the ones i have made aren't showing up.
     
  4. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    Does it work if you have full contents of Lua in your controller.lua? I'm thinking maybe it is not able to take part from one controller and part from another, but you need to give it full controller?
     
    • Informative Informative x 1
  5. Michaelflat

    Michaelflat
    Expand Collapse

    Joined:
    Jul 10, 2014
    Messages:
    1,543
    thanks, I looked in the code and the behaviour i am seeing is a precoded fall back when it's not specified.
    upload_2018-6-1_19-13-19.png
     
    #5 Michaelflat, Jun 1, 2018
    Last edited: Jun 1, 2018
  6. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    I did remember now also one thing, in my files there probably is transmission logic that is quite bit different than what is in 0.12 game files, probably much worse because it was one experiment, just so that you are aware of that.

    jbeamdata means that you should be able to override that in your engine or transmission jbeam by just giving available modes, but there needs to be all those modes in lua, which for you need to have that custom controller and modified lua, but that needs to be full logic, if my head is getting around this right way.

    So long since did play with those and I'm so much middle of other things that my poor brain is confused :D

    Anyway in lua there was place called automatic modes where modes have to be presented and then in logic section those modes need to exist and as long as main jbeam points out to valid lua logic of your own, it really should start working, unless there is some bit I'm forgetting again.

    It was fairly simple to do after figuring out all bits!
     
    • Informative Informative x 1
  7. Michaelflat

    Michaelflat
    Expand Collapse

    Joined:
    Jul 10, 2014
    Messages:
    1,543
    thanks, i'll wait for more info in this thread, but don't get too bogged down with this experiment too.
    I see what you mean, the lua file has to contain ALL the tranmission modes. Otherwise it falls back.
     
  8. Josh

    Josh
    Expand Collapse

    Joined:
    Jul 21, 2013
    Messages:
    1,082
    I'd also be great to return manual mode back to how it was before the "revamp". I can't shift up when at a stop now. IRL manual mode lets you shift up to a selected gear (that the PCM deems appropriate) while at a complete stand still.

    For example, my truck allows you to shift up to 3rd and start off (its a 6 speed).
     
    • Like Like x 1
  9. Michaelflat

    Michaelflat
    Expand Collapse

    Joined:
    Jul 10, 2014
    Messages:
    1,543
    There's quite a simple way actually. Something around "auto downshift in M". It's on a thread somewhere
     
  10. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    Ok, I figured it out, you need to have this in your transmission file (change to fit your mod naming):
    "vehicleController":
    {
    "shiftLogicName":"FufsgfenTDrifter",
    "automaticModes":"RND54321W",

    Then filename that contains shift logic module has to have prefix in name, for me that is shiftLogic-FufsgfenTDrifter.lua and that has to be in yourmodname/controller/ folder

    Also copy shiftLogic-automaticGearbox.lua and modify that file to have your custom modes, which for me are:
    Code:
    availableModes = {"R", "N", "D", "S", "1", "2", "3", "4", "5", "M", "W"},
    ---------snip----------------
     if automaticHandling.mode == "1" then
        maxGearIndex = 1
        minGearIndex = 1
      elseif automaticHandling.mode == "2" then
        maxGearIndex = 2
        minGearIndex = 1
      elseif automaticHandling.mode == "3" then
        maxGearIndex = 3
        minGearIndex = 1
      elseif automaticHandling.mode == "4" then
        maxGearIndex = 4
        minGearIndex = 1
      elseif automaticHandling.mode == "5" then
        maxGearIndex = 5
        minGearIndex = 1
      elseif automaticHandling.mode == "W" then
        minGearIndex = 2
    
    This I found from line 833 of vehicleController.lua which tells that game is excepting that shiftLogic- prefix and also that in jbeam keyword excepted is shiftLogicName :
    local shiftLogicModuleName = "controller/shiftLogic-"..(jbeamData.shiftLogicName or gearboxType)

    Not sure if you have already figured it out by yourself, but if anyone needs to do custom logics, that is how you do it in 0.12.3 version of BeamNG.
     
    • Like Like x 1
  11. Diamondback

    Diamondback
    Expand Collapse
    Vehicle Systems Lead
    BeamNG Team

    Joined:
    Apr 8, 2014
    Messages:
    1,957
    Nice to see you guys getting your hands dirty with lua :)
    Just set "autoDownShiftInM" to false in the vehicleController section in jbeam. :)
     
    • Like Like x 2
  12. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    Sorry that it is so slow to learn these things, I always feel bad when you make these changes that add incredible new possibilities and it takes so long from me to figure them out, but at least I hope eventually to be able to do more and more of lua as it really is huge possibility in creative zone, all the crazy and mad inventions of mine require learning these wonderful possibilities so piece by piece, little by little more possibilities are opening.
     
  13. Michaelflat

    Michaelflat
    Expand Collapse

    Joined:
    Jul 10, 2014
    Messages:
    1,543
    Yep, makes a change from me bluntly saying "it doesn't feel right" :p
     
  14. Josh

    Josh
    Expand Collapse

    Joined:
    Jul 21, 2013
    Messages:
    1,082
    Awesome, you always come to the rescue !
     
    • Like Like x 1
  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