8 votes

Possible to create a totally new keybinding in Cyberpunk?

Hello all,

So I built a new rig with some of the great CPU bundle deals that came along recently, and now I'm enjoying Cyberpunk with the absolutely glorious pathtracing+DLSS combo - thoroughly enjoying it. I've been customizing a lot of the keybindings to my exact preferences by editing the InputUserMappings.xml and UserSettings.json files and have been able to figure everything out except one.

I have installed a number of mods, one of which allows me to customize the first person driving camera to be much better for my setup. One thing I cannot change, however, is radio volume while I'm in the car.

So, I was wondering if it's possible to make a new keybinding that changes the CarRadioVolume setting in UserSettings.json up and down. Ideally, I'd bind it to my mousewheel so it would be like having a volume knob while I'm driving around. There are also some keybinds located in this same file, but they are a different type of value (a name) whereas the CarRadioVolume is an int value. I have not seen any other settings that are of the type I'm trying to make: a keybind that changes an int value up and down. If I did, I'd just try and copy that.

So, as someone very unfamiliar with programming, I was wondering if this is even possible to make a keybind for this without making a mod/extra script to do it? Or does the game's engine/logic have to already have this type of keybind built into it in order to edit it? Thanks in advance for any info!

3 comments

  1. [3]
    cfabbro
    (edited )
    Link
    Edit: The Pocket Radio mod looks like it adds the ability to set keybindings for toggling the radio on/off and adjusting radio volume up/down. So that's probably your best bet, although it's worth...

    Edit: The Pocket Radio mod looks like it adds the ability to set keybindings for toggling the radio on/off and adjusting radio volume up/down. So that's probably your best bet, although it's worth noting this line from that Steam setup guide I linked to: "I noticed you must turn the radio off then back on for volume adjustments to go into effect".


    Have you tested to see if editing the UserSetting.json CarRadioVolume value while the game is already running immediately changes the in-game radio volume? Asking because I would assume the game would need to be reloaded before any changes to the json file would go into effect. And if that is the case then there is probably nothing you can do without a mod that adds that functionality and a keybinding into the game

    If it does actually immediately effect the volume though, you may be able to write an autohotkey script bound to mousewheel up/down which can automatically edit the json file and adjust the CarRadioVolume value. See, similar example here.

    6 votes
    1. [2]
      Tynted
      Link Parent
      Hey thanks for the response! Yeah I saw that mod when googling around about this, but some of the posts mentioned the audio quality is different/not as good, and that using it in the car can be...

      Hey thanks for the response! Yeah I saw that mod when googling around about this, but some of the posts mentioned the audio quality is different/not as good, and that using it in the car can be quirky. I probably will give it a shot though if I can't figure something else out.

      I'm partially interested in this question because I feel like if I could figure out how to do this, I'd understand a lot more about how scripting and doing stuff like this in games in the future works. It seems like it should be a thing I could define and set a key bind to, since the settings I need to change are already defined in these same config files, but I'm just not sure where/how to do it. For example, it seems like I should be able to define something very simple somewhere like "If the key H is pressed, change CarRadioVolume down." It's already got a step value defined, so it would then go down by that step value each time I press H. If not, then I guess you have to define every bindable command in the game's engine code itself in order for it to be bindable in a config file?

      I will give editing the json file while in-game a shot, but like you I believe it is not going to go into effect immediately. I appreciate your feedback!

      1 vote
      1. cfabbro
        (edited )
        Link Parent
        TVW! BTW, if you want to explore this more yourself, PocketRadio utilizes the Cyber Engine Tweaks framework. So it's likely possible to create a mod using that framework which only adds the...

        TVW!

        BTW, if you want to explore this more yourself, PocketRadio utilizes the Cyber Engine Tweaks framework. So it's likely possible to create a mod using that framework which only adds the keybinding functions for volume control, without all the rest. They have a wiki with a section on hotkeys and various game system functions if you want to look into it some more:

        https://wiki.redmodding.org/cyber-engine-tweaks/
        https://wiki.redmodding.org/cyber-engine-tweaks/cet-functions/hotkeys

        And you can also look in the PocketRadio files to figure out how it accomplishes everything. After a quick glace at them myself, I think PocketRadio's settingsUI.lua is where most of the relevent code is. E.g.

            radio.settings.volumeIncrease, changed = ImGui.InputInt("Volume Increase in Combat", radio.settings.volumeIncrease, -9999, 9999)
            radio.settings.volumeIncrease = math.max(0, math.min(10, radio.settings.volumeIncrease))
            if changed then config.saveFile("data/config.json", radio.settings) end
        

        The mod does actually appear to be editing the data/config.json file, so you may actually be able to accomplish the same simply using an autohotkey script like I linked to above. You will probably just need to turn the radio off and on again before the volume changes made via the config file edit take effect. But at least the whole game doesn't seem to need to be restarted like I originally assumed.

        2 votes