Any way to automatically set variable to null or 0 if a boolean in the struct is false?

Might be confusing but I’ll try my best.

I’m setting up the item structure for my game. I have certain boolean variables setup in the struct to state whether the item is equipable, craftable, consumable, etc.

Basically wondering if there is any way to automatically set variables in the struct to zero-based off of a boolean status from the same struct? Hoping there is a way to do this, so that I don’t have to go set every variable to 0 for certain things.

Example: If consumable is set to false, I want the food it provides or the hydration it provides (Both integer variables in the item struct) to automatically be set to 0.

Thanks for the help

You can do something like this if it needs to be done during runtime.

You can execute a function or an event that checks the status of the Consumable. If it is false, then set food and hydration to false as well. Food & Hydration is false because the checkboxes next to the names aren’t checked.

2 Likes

Awesome, thanks!

No worries @FungalMist.1, feel free to mark my answer as the solution to your issue! :slight_smile: