[SOLVED] How do I add global bindings in mod?

Discussion in 'Content Creation' started by Agent_Y, Jul 12, 2021.

  1. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,062
    Either I'm blind or this is not documented and I have no idea how to do this. I want to create global inputmaps instead of copy+pasting the same file with the same bindings to every single vehicle in the mod. In the documentation it says that global actions are defined in lua/ge/input_actions.json. But such directory does not exist??? Instead there are multiple files in lua/ge/extensions/core/input/actions folder, and they define the input. Inside these files it says that you can't modify them but you should read the documentation instead, but that points to a non-existent file... The readActions(vehicleName) function points to the correct directory, so the documentation must be wrong. Unless this one directory is checked by some other function.
    That's only half of the problem. Where are the bindings (inputmaps), not only does the documentation point at the wrong directory but it also doesn't metion global inputmaps at all. It only says where regular and user bindings go (but where are the default settings/inputmaps/*.json files if the settings folder is in the user directory?), and there is a whole (terribly old, from version 0.5) page about vehicle-specific bindings and how to add them (without even explaining properly how to add new bindings to vehicles that already have bindings), but doesn't explain the global ones, only says that it is very important to add them or else the user will be confused, but how do I add them??? The bindings.lua file only refers to /settings/inputmaps folder, so this might not be a thing at all, but then what do I do, do I have to make my mod override the user's settings somehow just to add a few global bindings? Or do I have to use the deprecated input keys and hope the user hasn't mapped anything to them?
    This is all a mess, please explain...
     
  2. marmon1973

    marmon1973
    Expand Collapse

    Joined:
    Jul 18, 2017
    Messages:
    3
    I'm not much of a programmer, but maybe try to create "lua/ge/input_actions.json" and see if it can read an input map you put in there. Knowing know where to put the file is the problem. Love the car values mod btw.
    Maybe @AR162B would know more than i as he added bindings to the D-Series.
     
  3. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,062
    I tried but without inputmaps files it does nothing, also I don't wanna follow what AR162B did as his method breaks vanilla bindings.
     
  4. S.Ali.M

    S.Ali.M
    Expand Collapse

    Joined:
    Jan 12, 2021
    Messages:
    1,079
    Figured these out in last week when was working on my map.

    • Adding a new global binding.
    1. Move your input_actions_xxx.json to lua/ge/extensions/core/input/actions/
    2. Open it and write these 2 words/variables for each binding:
    bandicam2021-07-1219-08-56-911.jpg

    3. Idk it's needed or not but I renamed the file name and deleted the "input_actions_" text.
    4. Now it can be found in the vehicle category without overwriting the default bindings.
    Oh btw there's a bug, it will not work if you do these on a unpacked mod, when you're done, launch the game and compress this mod, next close the game and launch it again. Then, these bindings will show up in the vehicle category.
    But there's still a problem, how to make a default key for these bindings?
    5. Well, to found the original default bindings, in the beamng.drive folder, you'll see a .zip file called "gameengine.zip". Open it, go to settings/inputmaps and copy the "keyboard.json" file (or extract it, then copy it), then, go to your mod's file. Make these new folders: settings/inputmaps. Next paste the keyboard.json file. Open it and add your custom inputmaps in the last lines:
    bandicam2021-07-1218-56-26-365.jpg

    Now they can be found in the vehicle category with default key controls:
    BeamNGdrivex642021-07-1219-10-28-564.jpg

    This way doesn't overwrite the user's custom bindings. As you can see here, the vehicle selector key is "Control E" BUT when I added these new custom bindings, my custom control (V) didn't replace with Control E:
    bandicam2021-07-1218-56-18-790.jpg

    BeamNGdrivex642021-07-1218-57-49-724.jpg

    But tbh, it's a non-standard way to add custom default key control and ONLY 1 mod can use this technique at a time. But you have no other ways to do it, so it's the best way.

    Hope this helps!
     
    • Like Like x 3
  5. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,062
    Thank you so much for this, it solves all the problems I had. The downside is that I'll have to update the file with every game update or else it will break global bindings, I wish it could work by adding custom ones. And turns out the only thing I was really missing here was the folder structure, the rest was in the documentation but I must have misinterpreted it.
     
    • Like Like x 2
  6. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,062
    Small correction: They work in an unpacked mod when you make the order setting very big for some reason like 1000, again thank you very much for this
    assdsd.png
    (At this point I feel like setting the order to a very big value can solve any bug with inputmaps lol, this is not the first time it helped)
     
    #6 Agent_Y, Jul 13, 2021
    Last edited: Jul 13, 2021
    • Like Like x 2
  7. Vantello

    Vantello
    Expand Collapse

    Joined:
    Sep 1, 2018
    Messages:
    375
    U making weapons in player mode?
     
  8. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,062
    Planning to, so far only the jump system is done but I'm planning arcade-like stuff like shield, guns, missles, etc. that would kinda work in a Twisted Metal way but keeping all the softbody physics and realistic damage of BeamNG, so no health points or anything, all physics. It will take literally years to finish though.
     
    • Like Like x 1
  9. psycophonic

    psycophonic
    Expand Collapse

    Joined:
    Jul 30, 2021
    Messages:
    3
    Forgive my coding ignorance but could you not "borrow" some stuff off Gmod as they are written in the same language (lua) to speed it up a bit. Maybe you'll need to site and credit the original source though. Just a thought.
     
  10. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,062
    Lol how would it work if Gmod doesn't have Jbeam, the most I could borrow is stuff that has nothing to do with physics so things like UI elements, so the least important stuff
     
    • Agree Agree x 1
  11. psycophonic

    psycophonic
    Expand Collapse

    Joined:
    Jul 30, 2021
    Messages:
    3
    I did mention my coding ignorance didnt I... also new to beam.ng and no idea what jbeam is. Maybe I should have stayed out of convo but thought I had a good idea about borrowing weapon skin and attributes etc. Anyway...
    --- Post updated ---
    NewI did mention my coding ignorance didnt I... also new to beam.ng and no idea what jbeam is. Maybe I should have stayed out of convo but thought I had a good idea about borrowing weapon skin and attributes etc. Anyway...
     
  12. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,062
    Skins can actually be borrowed too but idk how I would get the permission for that
     
  13. psycophonic

    psycophonic
    Expand Collapse

    Joined:
    Jul 30, 2021
    Messages:
    3
    --- Post updated ---
    Try just going on the steam forum for gmod and talk to the coders who make the add ons for that. Maybe they'll only ask for accreditation or something. Their community workshop is free just like Beam.ng appears to be.
     
  14. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,062
    As I said it's not worth it just for some code and graphics when 99% of the work has to be done in Jbeam and those games don't have it so I need to do it myself.
     
  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