Download

Change stats based on string?

If I have a custom function in my character with a string input and an float input, can I read the string and change the character variable it matches to the float value? For example

441b578e252519e4d21ec55b65715661d9d7ba15.png

Can I do something like that somehow?

Like this

181bb25c8dcb5d34e26c84faf81ea4c804242ae9.jpeg

Narg

How do I plug in the value though? That part disappears

Not quite sure what you mean, which part dissapears?

Like I can plug in a string so that it reads the name of the variable, but then I can’t set the value of the variable. It just says “Speed” or whatever, like in your example. My setup looks like this
jiiiRKf.png
I have a custom function with the inputs of a string and a float. I want to change the variable in my character that has the same name as the string, and change it by the float value. The problem is that I have nothing to connect the float to

OK, how many of these to you need to change, that could mean 2 ways of doing it.

If only 1 or 2, you could just use a bool.

I larger, use an array with a bool.

Narg

It’s gonna be quite a few, but I’m still confused on how to do this. Do I have to have a set node for literally every different variable that I need to set? That just seems really clunky and obnoxious. Right now what you told me is wrong, what that does is set a variable I came up with before hand (in my example it was the Air Control variable of the Character Movement component) to the string. It sets my characters air control variable to a string. All I want is for it to read the string value that comes in, figure out which variable it needs to change based on that string, and then set that variable to the value that the function receives. I can parse the string with an array like you said, thank you, but then how do I set the correct variable?

Ok

So you want to change a variable based on a text field/string.

The easiest way I could think of would be an array of structs.

One Variable, one what you want the string to match up to.

String: Speed
Variable: Float

String: Max Height
Variable: Float.

Then you run an array, look for that string, if it matches, change that variable.

When you need that variable, say set Zvelocity, call that struct and set jump height

Ok, so I have to have a separate Set node for every variable I want to set. Thanks