I am new to Unreal, and am used to a different visual scripting method. How do I check whether or not a variable is set? There doesn’t seem to be a “check variable” node.
What I want to do is “If variable is set then ___ happens”. Not sure how to translate that thought process to Unreal.
For example, I want different drop down menu options to do different things when selected. How do I make sure a SPECIFIC option is selected, and that SPECIFIC option is creating a result? I tried making it to where a specific UI element, when selected, printed “Hello”. All UI elements printed it though, no matter what I selected.
Again, I am very new. So I apologize. Pictures or examples would be helpful.
Usually variables have default values so even though you didn’t set their value to something else, they’re already set to something. If by that you mean how to check if variables are not null, you can use the “Is Valid” node (with the question mark)
This worked. Alternatively, if you have a number variable, how do you check that? For example, if you have a health bar. How do you do “Check if HP is 0. If 0 then ___”.
There are a few different ways of assigning a variable a value based off of conditions, I believe they’ve all been mentioned above. The " select" decision would be one, you also have branch decision Wich execute a branch of your graph based off of a boolean value. To verify a variable holds a value, you could use an “is valid” check if it’s a reference to an object or class, or if simply a number or string type variable you can call “print” at the point in your graph your wanting to verify it has a value
In the example I showed, I added the == node to show if you wanted to check for if it was 0 exactly instead, it’s not actually hooked up there.
The execution in pseudo code is:
CheckHP event is called
Get the health
Compare health (in this case the one thats actually hooked up is the Less than or equal to<=
That node gives a true or false (boolean). If it’s less or equal, it’s true, otherwise it outputs false.
Then the branch node takes that boolean, and decides which way to continue the execution from CheckHP.
You could instead of checking <= you could check == for exactly 0. I only added it below to show your options. Does that make sense?