Add a custom key/button
Quote from gallardo on January 31, 2014, 10:46 amHi 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 optionsany idea?
EDIT:
related topics
post92071.html?hilit=custom%20binding#p92071 (UNSOLVED)
post69091.html?hilit=custom%20binding#p69091 (partially solved)
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)
Quote from srs bsnss on January 31, 2014, 11:18 amYou 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.
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.
Quote from FelixGriffin on January 31, 2014, 12:58 pmLogic_playerproxy gives you jump and duck as well.
Logic_playerproxy gives you jump and duck as well.
Quote from RustyDios on January 31, 2014, 5:41 pmHow 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.
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.
Quote from gallardo on February 1, 2014, 4:38 amhehe, 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.
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...
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.
Quote from RustyDios on February 1, 2014, 4:51 amSounds 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.
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.
Quote from HMW on February 1, 2014, 2:39 pmWould 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?)
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?)
Other Portal 2 maps: Medusa Glare
Portal 1 maps: Try Anything Twice | Manic Mechanic
Quote from gallardo on February 1, 2014, 4:36 pmWhat 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"...
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"...
Quote from FelixGriffin on February 1, 2014, 5:49 pmI'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.
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.
Quote from HMW on February 2, 2014, 9:52 amgallardo 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.
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.
Other Portal 2 maps: Medusa Glare
Portal 1 maps: Try Anything Twice | Manic Mechanic