Please or Register to create posts and topics.

Keybinding

Page 1 of 2Next

I have an idea in the back of mind, but it would really only work under one particular condition:

Is there any way to bind a player's key to trigger an entity in a map? Not necessarily trigger I suppose -- sending outputs at all would be one thing -- but that if the player presses, for example, F a particular logic_relay would be triggered.

Is this something that can be done with Hammer wizardry? Or would that take more elaborate coding?

It can be done with Hammer, although in multiplayer or in challenge maps it requires cheats (since the player could use this to activate a distant button or trigger, or even summon a cube from across a pit).

To look at standard keys (fire, use, jump, crouch) you can use a game_ui or logic_playerproxy. To use other ones, you can place a point_servercommand in your level (which lets you use the console), then have a logic_auto (or a trigger, perhaps?) OnMapSpawn > servercommand > Command > bind f ent_fire f_button_pressed trigger. Then whenever f is pressed, the f_button_pressed relay triggers. If you used a trigger or something to bind the key, you can take away that power later by disabling the relay or firing > servercommand > Command > unbind f.

Falsi sumus crusto!

Just for correctness, because it could maybe cause problems, use "" when using bind commands.
bind f "<COMMAND>", since the console maybe could see a space (for example between ent_fire and the targetname) as end of the whole command.

Won't using ""-tags in hammer destroy the Hammer file, as it is built using the same system?

The Aperture Alpha
A map pack coming soon. - click for more information
Image

Trying this out I've run into trouble.

Entering bind f "ent_fire temp_relay trigger" straight into the console works fine. Pressing f then triggers temp_relay

However, when I add an output to an entity (this failed for both logic_auto and logic_relay) that goes OnTrigger > servercommand > Command > bind f "ent_fire temp_relay trigger" the console says "f" = "+mouse_menu"

I tried other letters, "q" = "+mouse_menu_taunt", "t" = "say", evidently these keys are already bound and trying to change them via in-map entities doesn't work

I tried to bind an unbound letter, it says "z" is not bound

q is gestures, t is say, and f (I think) is the new "play test" menu thing.

I wouldn't try to bind a certain key seeing as anyone could have a custom keybinding.

I would try to use the keys available to use in a game_ui. Perhaps you could have a key-combo instead of just one key. (using logic_branch etc)

?????????????????????????????TWP Releases | My Workshop

It does seem like the "s are messing things up, because an entity calling <bind f "ent_fire temp_relay trigger"> appears to ignore everything in quotes so the command ends up looking like <bind f>

Using the default bindings via game_ui and logic_playerproxy (especially multiple keys) just feels like an unpleasant solution. "Yes player, I'm going to need you to crouch-jump every time you need to activate the thing". The best that could come of that is probably having them hit both moveleft and moveright at once do it, but that still feels weird.

I've tried using escape characters, like <bind f "..."> but apparently vbsp doesn't like that and it crashes the compiler

My last resort would probably be kindly asking the player to open up the console and type in the thing themselves, but obviously that has its own drawbacks. I'm assuming more than half the playerbase has never used the console and it would ruin the whole immersive gameplay experience

Yeah, I only use a playerproxy because crouching is half of the behavior I need.

Falsi sumus crusto!

"F" is my right strafe key since I use ESDF for movement in every game, and A is use, G is next weapon, etc.... I would be really pissed off if something rebinds my keys. I also have a binding for all unused key, usually for mapmaking, turning things on/off.

-= Check out my maps: workshop, and their .vmf sources: homepage =-
Page 1 of 2Next