FWGS / hlsdk-portable

Portable Half-Life SDK. GoldSource and Xash3D. Crossplatform.
https://xash.su
Other
273 stars 126 forks source link

bind keys to immediately switch to certain weapons #446

Closed nickbailuc closed 8 months ago

nickbailuc commented 8 months ago

Is there any way to bind certain keys to immediately switch to a specific weapon, rather than cycling the slots? For example, binding the gauss cannon to G and shotgun to T or something like that. Would be great, especially in multiplayer (which is very competitive on Xash servers, almost feels like I'm playing Unreal Tournament). I usually end up cycling through weapons in the right order to use the "last weapon used" key.

Not sure if this belongs here on hlsdk or on xash3d, but it's somewhat of a feature request. I think it's minor enough that it wouldn't change the 'vanilla aesthetic' of the engine.

If this is viewed as too big of a change from the original (if there is no way to do this in original), Chocolate Doom is the most vanilla source port in Doom, yet it allows for configuring modern FPS controls (mouselood + WASD).

FreeSlave commented 8 months ago

The feature you're requesting has always existed in Half-Life.

You can bind a weapon name to a key. E.g. bind g weapon_gauss. You need to know entity names of the weapons.

You can add following lines to your gfx/shell/kb_act.lst file if you want to configure keybindings via menu:

"blank"                 "=========================="
"blank"                 "Direct Weapon Access"
"blank"                 "=========================="
"weapon_crowbar"        "Crowbar"
"weapon_9mmhandgun"     "Handgun"
"weapon_357"            "Magnum"
"weapon_9mmAR"          "9mmAR"
"weapon_shotgun"        "Shotgun"
"weapon_crossbow"       "Crossbow"
"weapon_rpg"            "Rpg"
"weapon_gauss"          "Gauss"
"weapon_egon"           "Egon"
"weapon_hornetgun"      "Hornetgun"
"weapon_handgrenade"    "Handgrenade"
"weapon_tripmine"       "Tripmine"
"weapon_satchel"        "Satchel"
"weapon_snark"          "Snark"