Getting an integer from a key input

Hi,

I’m wondering how to get an integer value from a key input.

I have an array of floats that I set up, and trying to set a variable based on that array, and for the integer input that decides where on the array to get from, I want to set that up to be linked to a key input.

I have a feeling that there is some process or component that I don’t know about that would be able to easily do this.

Thanks!

You can get the int from the key like this:

( Drag out from Key, type get, drag out from GetDisplayName type string, then drag into SwitchOnInt )

Thanks for your help. So this set up was meant for me to be able to control what part of my array was being called using a click event.

I wanted to set it up so that clicking “1” was able to set my damage variable to the first integer in my array, “2” for the second etc.

After playing around with it for a while I still haven’t been able to get that to work. I added the blueprints you suggested to the original blueprint i had screenshot. Any tips would be much appreciated. Thanks!

Sorry, need a bit more explanation, I mean what’s to stop you doing this:

285858-setvalue.jpg

Why have the values in an array?

Or do you mean, you want to set health to slot 2 from the array etc. In which case you need two key hits for each settings…

Ahh…, or maybe you mean like this:

:slight_smile:

Thanks man! really appreciate it

You’re welcome ( feel free to mark my answer as correct :slight_smile: )