[info] how to hack in a mousewheel bind for existing actions

+
Modified from OnToggleSigns() [playerInput.ws], with a bit of trickery, but can be repurposed to perform custom functions.

Of course, you could just do this in mouse software or autohotkey without needing to compile scripts.

It would also be much simpler if IK_MouseZU (up) and IK_MouseZD (down) were separate keys instead of an axis. Although, I suppose you must retain the axis for scrollbar context functions, or maybe not. Actually, now that I think about it... I haven't tested this in that context, but it works for OnToggleSigns(); similar context. :D
theInput.RegisterListener( this, 'OnToggleSwords, 'ToggleSwords' );
...
event OnToggleSwords( action : SInputAction )
{
var tolerance : float;
tolerance = 2.5f;

// wheel down
if( action.value < -tolerance )
{
action.value = -action.value; // set value positive to detect button press
action.aName = 'SteelSword'; // replace with an actionName
OnCommSteelSword(action); // replace with actionEventName
}
// wheel up
else if( action.value > tolerance )
{
action.aName = 'SilverSword'; // replace with an actionName
OnCommSilverSword(action); // replace with actionEventName
}
}
Standard config files for key bindings:
ref: input.xml
ie: <Var builder="Input" id="ToggleSwords" displayName="modName_localString" displayType="INPUTPC" actions="ToggleSwords"/>

ref: input_qwerty.ini
ref: [BASE_DRAW_SWORDS_KEYBOARD]
ie: IK_MouseZ=(Action=ToggleSwords)
Add localization text for keybinds menu if desired, and update input.settings with BASE_DRAW_SWORDS_KEYBOARD as well. Set previous IK_MouseZ to IK_None if already bound to 'ToggleSigns', or unbind it using the menu.

In hindsight, although not as simple, setup matching 'input_overlap' tags in input.xml for whichever 2 keybinds you want to be able to bind 'mousewheel' to? Awkward since you could just bind any key to them both.
 
Last edited:
Ahhh I NEED this soo bad, was google searching for this for an hour and then found it in the recommended section of this forum from a post from 2015 lol. Can you pretty please break down how I can implement this into my game? Im new to Witcher 3 modding
 
Modify playerInput.ws, register an event listener (ToggleSwords), add an event handler (OnToggleSwords).

'ToggleSwords' is the 'action' name in keybindings. You need a reference in input.xml file to be able to bind the key in the menus, and another reference in input_qwerty.ini to be able to bind the key in the first place. You then need to delete the input.settings file in my documents (or update it manually as instructed, although it has a different layout), which will reset all your keybindings, in order for the new 'default' keybindings from input_qwerty.ini to be applied and a new input.settings file generated.

If you ever update the game or verify game files, you must edit those files again.

Localization configuration for the keybinding name in menus and general modding instructions are beyond the scope of this post.
 
Last edited:
Top Bottom