How to enable input for only specific characters?
I was wondering if there is any way to assign specific actions only to specific characters.
For instance, I have an Action Mapping ("Interact") that only one of the three characters in my game should be able to use. In this case, "Interact" happens when the M key is pressed.
I'm creating a single-player game where the player can assume control over any of the three characters in the game by respectively pressing the 1/2/3 key.
Any help is appreciated :)
asked Jul 18 '16 at 02:12 PM in Blueprint Scripting
Since I cannot mark comments as accepted answers, for administrative purposes I will put this comment and mark thread as solved. For future answer-seekers, see comments below for the suggestions that have been given!
answered Jul 18 '16 at 04:15 PM
There is! I assume each character has different interaction logic they will execute? You can use a Enumeration system.. Create a new Enum BP called Possessed Character. Create three options (one for every character that will be possessed). In your Level BP create a new variable that is that Enum BP. Now you want to set the enum variable after you Possession logic (keys 1, 2 and 3). Now you will want to "Switch on Enum" after you "Interact" key event.
This will work somewhat like a boolean.. when interact is called, it will look at the enum and see which character is selected and then only execute that logic.
If you're interested in getting it set up the way I suggested previously, let me know and I can help you get there!
Hope this helps! Matt
answered Jul 18 '16 at 03:43 PM
You should execute your "interact" logic on your Character BPs. That way you are only calling Interact for the character that you have possessed.
answered Jul 18 '16 at 03:18 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here