Hold down buttons to do somthing

So I’m trying to make a dev character for may game. So when they join the game the can hit a secret button combos to turn in to that character. Ex: hold Shift + a + b= character change. i have it set up for one button but anyone can hit random buttons to figure it out, but this way makes it a little bit harder. Does anyone know how to do it? Thanks :).

Make a variable called secretButtonCount of type Integer. Then you take the event for each of the buttons you want, lets say shift + A + B and from the PRESSED pin you add one to the secretButtonCOunt. On RELEASED you subtract one.

After each addition on the PRESSED execution path you check if the secretButtonCount == 3. If it is, then you call a function called ChangeToDevChar and change it there.

Now you can press the three keys in any order. If you want it to be in a specific order you have to make a bool for each key and then check on the last key, in my case B, if the shift boolean is set and if true, check the A boolean. If A is true you can call the change function.

I understand this to a point. I’m currently a student, so I’m pretty new with Coding especially blueprints. I’ve done a little bit of coding in high school but nothing big. Are you able to attach a picture of the blueprint. I know I’m asking a lot. If you don’t want to its 100% alright. I can ask my professor about what you typed and or figure it out myself haha. Thank you tho :slight_smile:

I cant give you a blueprint, but I can write code:

This is the second solution
if ShiftIsPressed {
if AIsPressed {
if BIsPressed {
//do the change
}
}
}

This is the first:
if numPressed == 3 {
//Do the change
}

Now you have to use the input events for the keys you want to use to set the variables IsPressed or to set the variable numPressed as described.

Try making something and then after getting stuck post a screenshot of your solution. I can help you from there.

Something like this: http://puu.sh/r6Xdo/c3229a3807.jpg
If you want to do it time based you have to set a timer and is slightly harder.

Or is there a way if you hold down a button for a X amount of time then action will take place?

See I’m trying to do this but with more then one key pressed at the same time to change the player model or hold down a key for X amount of time

So i add my input events for the keys in 1,2, and 3 then when i hit them together my action will happen and i add my action to the end of print string?

Thank you so much! That’s the key counter right?

Thank, will do. I’m adding it right now to test it.

Yes. It counts how many of the keys are pressed. If yyou want more, just add another key. Just remember to increase the number in the check.

Yes. If this solved your question remember to mark the answer and vote it up for future users.

You make it. Its a variable.

Just make a variable. The type is integer and you make it by clicking the plus sign next to Variables on the left of the bp editor.

Last Q. where do i get the “Key Counter” at?

I’m learning so much from you more then my teacher hah. can you show me the one in the picture?

Ohhh I fell dumb. I should Know this by now. lol

106475-capture.png

This is what i have i put jump just for a test

Nvm I figured it out. I had to put a value for the variable. and it WORKS! Thank you so much!!