How to kill the character if one of multiple values are less than 0?

If have the first person character and i have set multiple values (player stats). These are an energy value, a drink value, a food value and of course the health value… but I dont know how to kill the player if one of these values are less than 0. I already tried to make a branch so if (for example) the helath value is less than 0 the game closes, but this didnt work because the default values are 100 % bc when the game starts they all should be at 100% … if someone knows how to kill the player if one variable is less than 0, it would be really nice :slight_smile:

Dont change variables anywhere, make an event for it.

I mean, if your hunger changes when player press button, dont just “Get Current Character Hunger → add 10 → Set Current Character Hunger” in that widget. Make an Event “Remove hunger” in your character blueprint (whatever bp contain the value) with value to remove as input, and call this event every time when hunger need to be removed.

In That case you would be able to detect and control changes to this variables locally, which means when you call event, you can check in that event, is there are enough hunger to begin with, if not, check all other stats like health and stuff, if they are low - > kill character.

ok I understood, but is there another easier way to do this because my adding food is coming form my item blueprint and with multiple items this could be difficult with custom events u know?!

You need to make one event “Change %StatName” for each Stat in Blueprint which hold current value of your player %StatName. And that event would be called from every object what you have.

In Character it would look like that http://puu.sh/osYoU.png and in your widgets and other stuff which can affect it it would be look like that http://puu.sh/osYvE.png

Do what he said. Each stat should be controlled by the character itself. With that setup every time the value changes you can check your death conditions. All you need to do from “Item BP” is to specify the amount. Such as Add Health (amount)

ok i will try this out!

ok this should work, butI still have one question… If i click the button in my inventory what should i do there? Do u have a script for this too or some ideas what is to do?

I don’t understand question, but it sounds so basic so i think you should follow some tutorials, “drag and drop” one is good for UI stuff.

ok thank you

it works thank you so much :slight_smile: