Hunger and Thirst (health and stamina)

Hi guys hope you can help.

I have followed this tut : https://www.youtube.com/watch?v=kRzmKy6aQz4 and the next two after that.

At this stage I have working Health - I can add health , Stamina takes away when run, Hunger & Stamina going down and when at 0 it will start draining health. So all yey…

Now the stuck part.

I’m trying to make object that I can walk over, and that will add hunger and thirst. I was hoping some one could give me some ideas how to get that working.

I have tried to make new new BP and add Sphere to it as collision and then when I walk over I get hunger. But it’s not working.
I’m including my screen of hunger and thirst.

Hope you can help.

Thanks

Jiri

Hello,
Have a look in the content example and the blueprint_hud map. You will find a pick up system in it. This pick up is a child. To see events, you’ll have to find the pick up parent bp in content browser (by clicking on pick up child in scene outliner to open it and clicking on find in cb in blueprint) then you’ll see 3 different pick ups all based on the same parent. Open the parent to see all the process (basically, a trigger for overlapping and a mesh)

Hi,Thank you for your response.

Sadly I’m still unsure on the next part. So I can create pick up - so when I walk over the object it will be destroyed. Okay.
Now how can I make sure it will add hunger or stamina. I used the UGM and included the all blueprints in Character_BP. So when I create new blueprint. How can I reference the Character_BP’s variables? The content example is using “Apply Damage” which adds health. If i can reference the Variable’s then I could add hunger to it.

Any ideas?

Thanks

Jiri

You will be sure of the effect because you will do it. For example : On your overlap, you do a “cast to” your character, to , first, ignore all other overlap, second be able to select elements from your character. Then from the blue output you drag a wire and type the variable you want to change. Then you make the change you want (+ or -) and there it is. If you have do your hud set up for example with umg like in the umg quick start guide, then you’ll see your health down if you overlap a “trap” or up if you overlap a “heal box” and your hunger back to 0 if you overlap a “fruit box”

For casting from your character you can right click on the graph and place the node “Get Player Character”.
From this, you drag a wire off of the returned value pin and place the node Cast to MyCharacter (or whatever blueprint your player character is using). In current versions of UE4, casting like this is context sensitive and requires you to do it off of another pin.
On the casting node, there will be a return node that allows you to essential perform actions as if you were using the desired blueprint.
Off of that pin, you should now be able to access variables, functions, etc. from the blueprint your character is using, allowing you to Get and Set your Hunger, Thirst and any other variables that you need.

Okay… Thanks… I will give that a go… You wouldn’t happen to have 10 mins on skype for me would you :stuck_out_tongue:
Thanks Jiri

EDIT: Have to retract this for now, meeting came up.
I can help you on skype later tonight if you still need help, Fen may be able to help you before then.

Never Mind… I got it! I’m not stupid anymore!! Thank you both… I shall sacrifice a donkey in your names!

Cool, good to hear you got it working properly

anyone idea how to save this to a SaveGame blueprint? The normal way to save Variabels seems doesn´t work with the Progressbar :confused:

Save the value of the variable that you send to your progressbar

this is what i doing…
but if i use a SaveGame Blueprint for the progress bar, the bar doesn´t work…

I haven’t work on it but i suppose the good way is to send from the character the value to hud when playing, send to save game instance when end and load save game to set character on load. If this is what you did, it needs a bit more deep research.

i love you! :smiley: