Please or Register to create posts and topics.

Add a custom key/button

Page 1 of 4Next

Hi there,
I need to add a custom action to the game that the player would be able to bind to a button of choice.
I know how to do it if it were a mod, but this should work for a map in the workshop, i.e. I cannot overwrite existing files (right?).

the alternative is that I "hard-code" it via console command, but it isn't ideal:
1) not customizable
2) could overwrite existing options

any idea?

EDIT:
related topics
post92071.html?hilit=custom%20binding#p92071 (UNSOLVED)
post69091.html?hilit=custom%20binding#p69091 (partially solved)

You could use a point_clientcommand to bind a key. You have to be careful with this kind of thing though, because you never know what binds people already have that you might over-write. But this will probably work.

Alternatively, game_ui.

ImageImage

Logic_playerproxy gives you jump and duck as well.

Falsi sumus crusto!

How about explaining what it does/what you want it to do and how to bind it to a key in loads of different languages in an image editor. Then spice it up a bit and make it look like an information panel/poster etc for the style of map you're creating. Converting it into a custom texture file and placing it in a "set-up" room before your main map. Make it so you can't possibly miss it and have the room exit somehow need your custom action to get out and into the main map..

Kindly asking the player to do it themselves in this kind of manner is the only option I can think of that won't mess up any previously set custom bindings by the player.

hehe, I thought about the room as well, but seems so cheap ;)
I should recreate a full keyboard with all the possible bindings, without excluding that someone playing in a cave would be glad to use "f12" instead of the default "alt".
more: I have to do it for controllers as well.

I would rather use the method suggested in the second thread I linked...

spongylover123 wrote:
First, you need to make a cfg file. Those manage the custom key bindings (make a backup first).
Then, add your key binding
bind "SHIFT" "ent_fire logic_relay trigger".
Then in your map, map a logic_auto and add this output
OnMapSpawn - @command - exec yourconfigname
And when you reach the end of your map, add the trigger
OnTrigger - @command - exec config_default
Remember to do the last output, since steam cloud will upload your key bindings and it will be like that forever until you reset the config file

...but what if the player exit before being able to reset the config?
I'd go for this route if I can write a config that ADD parameters, without changing the existing ones.
Also, by publishing the map in the Workshop, would the config file be included?

I'll test all the stuff above, but maybe you already know better.

Sounds good.. but you run into the same problem using the @command>exec method, config_default will reset the key bindings to the default. If the player has set custom/personal keybinding (like "n" for noclip 1) it won't get reset... it's not part of the default config.

Good luck to finding a method that works for you. It would be interesting to know what you decide to do.

Would it be possible to use the existing player controls in a new way to activate the effect? For example, you could have it activate when the player double-taps the "duck" button.

(Maybe you can explain what the effect is without spoiling too much?)

Sendificate series: Sendificate | A Beam Too Far | Airtime | 302
Other Portal 2 maps: Medusa Glare
Portal 1 maps: Try Anything Twice | Manic Mechanic

What if I use another action available in coop and unused in single, like "quick_ping"? I've to figure out how to do it though.

Yours is interesting too. another suitable one would be pressing attack1 and attack2 at the same time.

What do you think if I just use the "duck" button? you still crouch but also trigger the new action.
No problem while flying, just a little stutter when on ground.

the last one is easily achievable with logic_playerproxy, though I'd prefer "quick_ping"...

I've remapped duck to a new action in three separate maps: time-travel in Braid, shield in Bastion, and create shadow in Shadows of Time. So far it's always worked. :)

Falsi sumus crusto!
gallardo wrote:
What do you think if I just use the "duck" button? you still crouch but also trigger the new action.
No problem while flying, just a little stutter when on ground.

If you can do that without causing problems with normal ducking, then I'd say go for it.
I've played Felix's "Shadow of Time" and I think it works fine there.

Sendificate series: Sendificate | A Beam Too Far | Airtime | 302
Other Portal 2 maps: Medusa Glare
Portal 1 maps: Try Anything Twice | Manic Mechanic
Page 1 of 4Next