x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Rebinding keys no rama

How create a rebinding input keys system in blueprints; no using rama's plugin.

Product Version: UE 4.9
Tags:
more ▼

asked Sep 04 '15 at 03:44 PM in Using UE4

avatar image

olegfresi
52 29 45 58

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

5 answers: sort voted first

What is in rama plugin, is not exposed to blueprint by default and you can do that only on C++, rama plugin primarly exposes feature not exposed to blueprint. But look on API refrence:

https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/GameFramework/UPlayerInput/SetBind/index.html

Set bind function is also command in console which oyu can call from blueprint

more ▼

answered Sep 04 '15 at 04:05 PM

avatar image

Shadowriver
37.2k 936 172 1116

avatar image Alfffffffffff Nov 03 '16 at 02:26 PM

I am trying to do this, but i cant figure it out what i have to enter in the "command" field in the execute console command to use "setbind" function, could you please make a pic or a example?. Ty in advance and sorry for the noob question.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

you can bind keys in blueprints, just make a data table that converts the Key's display name into an integer, and use an array of integers to relate each index to a numbered function.

like this: alt text

the CSV spreadsheet text would look like this:

 "Name","ActionID"
 "A",0
 "B",1
 "C",2
 "D",3
 "E",4
 "F",5
 etc... listing every input along with a unique number to identify it.

then you can create a blueprint struct with a single integer named ActionID, and use that to import the CSV as a data table.

rebinding a key is just changing the value of an integer in an array of integers. the index is the keyID, the value is the FunctionID.

since custom action events don't show up when you press the AnyKey, you need to add them separately, with a macro similar to my MapKeyToAction, but instead of passing in a Key struct, you can pass in an IntegerID, and skip the datatable part. so in the event graph, you would hook up your custom action mapping events to the macro and pass in a literal int for the KeyID. the integer should be a number that is higher than the highest number on your data table, and each action mapping event should use consecutive IDs, so you don't waste space in the array.

you can use the InputTable RowNames and ListOfActionNames to populate your menus with widgets, passing in the index from the ForEachLoop to set the index of each menu card. when you click on a card, you can use the index to determine what keyID to bind, and what ActionID to bind it to.

the custom action events would be bound similar to the V, B, and N keys in this image: alt text

but the KeyID will be a much higher number so it doesn't conflict with all the keys from the datatable.

more ▼

answered Sep 05 '15 at 04:06 PM

avatar image

ScottSpadea
9.6k 320 205 450

avatar image olegfresi Sep 05 '15 at 05:17 PM

More more thanks i am very grateffuly

avatar image olegfresi Sep 05 '15 at 06:06 PM

Where i find the "call function by key id" and "punch,grab,ckick,open inventory" and "rebind key" functions?

avatar image ScottSpadea Sep 06 '15 at 02:16 AM

those are all either macros or custom events, and all of them are shown in the images above.

avatar image MeshMyster Aug 19 '16 at 10:01 PM

Have they added any new functionality since you posted this solution? It seems you're completely bypassing the settings in Engine Input correct?

avatar image ScottSpadea Aug 20 '16 at 07:33 PM

Blueprint still doesn't have a way to bind key input dynamically, so without c++ this is still probably the best method using only blueprints.

with an array of integers, you can have a set of input numbers that map to a set of output numbers, and change that mapping dynamically by setting elements in the array. it works just like equipping items in an action adventure game: you have an item slot number for every input key, and you have an item ID number mapped to that item slot.

even if blueprint had custom functions for binding keys dynamically, i would still choose to use an array of integers instead, because its easy to debug, its efficient enough, its simple to understand, its easy to save the data, its easy to port it to another game engine, and there will never be a scenario where this technique is unavailable. this technique would work on a gameboy or a graphing calculator or a cell phone etc... it works in almost any programming language and will be compatible with any game engine.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hello! Since Version 4.17 there is now a better, official way of rebinding keys with blueprints only! please watch this video:

https://youtu.be/VqHEr2b6r5Q

I know this is an old thread, but I think this might be helpful to someone :)

more ▼

answered Jan 31 '18 at 11:24 AM

avatar image

substract
15 1 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

To create the setbind console command as above you need to create a class that can run console commands and be saved. Normally you would do this in the gameInstance class since it stays the entire game run-time.

The gameInstance class doesnt allow the ExecuteConsoleCommand node however.

So I suggest creating a blueprint interface with a function in it that called RunConsoleCommand with a stringinput "ConsoleCommand" that simply executes a console command in from that string with the "ExecuteConsoleCommand" node and it has to have a dummy return so just add a boolean output on the function and dont connect anything to it.

NExt in the blueprint interface add "GetSettingsInstance" which simply takes nothing in and outputs "gameSettings" (this will be a save game class you create next)

Then create a savegame class that saves all your key bindings.

Now take a class that the user will interact with and add the BPI and for the RunConsomeCommand under "Interfaces" on the left hand tool bar with the blue f simbol, input a string for setting the bind to whatever key and whatever your binding. You can then set that string with an append node to format it however you want and call it wherever to do those binds and it will be saved in your savegame class.

Then create a macro library that takes in an input executution pin, a string "saveGameFile" "saveUserIndex" int and a blueprintinterface (the one you created above) that loads a saved game file like SettingsSaveFile (in your savegameclass make it so it outputs a .sav file to /saved/savegames/ called something like MyGameSettingsFile) and outputs it to an execution pin and a gameSettings pin (save game class) and connect it to the EventInit() event node on your game instance and then promote the gameSettings output pin to a variable called game settings.

In your macro create one last macro called "GetGameSettings" that does exactly as it sounds, it takes in an input execution pin and an input for GameInstance (which you will always connect with a GetGameInstance node) and it outputs an output execution pin and a gameSettings output (your saved game class) it loads the save-game file or class from your savegameclass and then outputs gameSettings in the line earlier which you can bind to a variable like "savedSettings" in any class you want to load the saved bindings from. Make sure these macros are in amacro library so they can be called from any class.

Lastly make sure your either setting up a widget to call those bindings in the function that uses the RunConsoleCommand blueprint interface or you have them called in the class that has that interface added.

Any classses that you want to bind keys from, as well as your gameinstance will have to have that blueprint interface added.

Its a bit more complicated than that but that should get you started.

Don't forget to accept an answer that best clears your question up or answers it so when the community finds your question in the future via search/google they know exactly what you did to fix it/get it going.

more ▼

answered Sep 04 '15 at 07:20 PM

avatar image

Nsomnia
1.8k 67 27 137

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hey. I am late, but i was searching for this myself. I am making a simple Game just trying myself out here and there cause i am totally new to this. My problem was that my GF uses an AZERTY Keyboard. but i figured out a workaround. Tho you might want to save the Booleans somewhere else, Im currently figuring out how to save it to a SaveGame file.

Heres my solution.

Home it helped! :)

more ▼

answered Feb 19 '16 at 04:55 PM

avatar image

sikator
1 1 1

avatar image MeshMyster Aug 19 '16 at 09:14 PM

this has nothing to do with rebinding keys at runtime.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question