At some point I wanted to add a reload function for a weapon and went nearly insane. This was because I already had like four different keybinds to three different reload execs or something similar. Unreal keeps keybinds all in the same place, unless you're using a mod from within the mod menu that has it's own setup. So every custom gametype and mutator within the normal UT2004 has to share all the same keys.
When I was writing something like UXL, with lots of gametypes and mutators - it seems too constraining. So I wrote Versatile Key Binds to solve the problem. Basically VKB's are just an interaction which holds some arrays. These arrays are virtual keybinds that the interaction waits patiently for and then executes.
So, it flows like this:
- The player controller sets up the VKB interaction.
- The VKB interaction has a set of config vars which contain arrays the mod's binding functions (key,command,description).
- At any time, the player can open a menu to alter the keybinds.
- The VKB interaction watches player input and executes commands if it registers that a key matches on of it's arrays.
The only real problem I've encountered is that since VKB's run on top of the normal player input, any keybind that is duplicated in a VKB will actually trigger both events. So if you have the Speech Menu assigned to V and you assign your flashlight exec to a VKB and use the V key, you'll flash your light anytime you tell Malcolm to go take a hike.