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
Can I do something like that somehow?
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
Can I do something like that somehow?
Like this
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
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.
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: 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