how to make energy decrease in UMG template?

Somebody help me please!

Hi there,

the most basics are already covered in tutorials. I know it is hard to find tutorials if you do not know how and where to start with, so here is what you need:

And here are some basic/short/compact official tutorials I highly recommend you to check out. You will need them to understand the UMG Tutorial. So if you have any questions you probably will find the answer in here for now:

Have fun :slight_smile: Marooney

Since you are new to Answerhub:
Please click the accept answer button on the left side of the answer if it helped you to solve your question. The answer will turn green and the Question is marked as [RESOLVED] for everyone. People who spend time to answer you will appreciate this. Thanks :slight_smile:

thanks but i want make my mood and energy decrease themself not when i jump.

All the logic about your mood, energy and what ever is normally located in your PlayerCharacter.

Most of the time, these values/setups follow a simple rule: You need a “MaxEnergy” and a “CurrentEnergy” value.

“MaxEnergy” is, of course, the maximum the energy can reach and “CurrentEnergy” describes the current value.

Now, inside of the UMG Widget, you will need a Reference to the PlayerCharacter. A simple “GetPlayerCharacter0” is enough for that. Make sure to use “IsValid” on the return value, before using it, since the Player could be destroyed (killed).

Now cast it to your own custom Player Class and get both Variables. All of this should be done in the Percentage Binding of the ProgressBar. Percentage goes from 0.0 to 1.0. So “CurrentEnergy” divided by “MaxEnergy” gives you your “0.0 to 1.0” Range, which you need.

How you actually decrease the Energy or mood (or what ever) is kinda up to you.

A steady decrease over time would be done by using the EventTick function of your Character.
You would do “CurrentEnergy = CurrentEnergy - DecreaseValue*DeltaSeconds”. Where DecreaseValue is up to you and DeltaSeconds are provided by the EventTick Function.

Cheers.

can u post screenshot :slight_smile:
of those maxenergy and current energy variables and all what i need to do
that would be nice:) and awesome!

Well, so i guess you have already set up your Character and Widget like the UE tutorial recommends you to do :slight_smile:

So then: Tutorial + the following solution = you should be good to go :slight_smile:

Hope that helps :slight_smile: Marooney

sorry for wasting ur time but where did u get that energy percentage?
:smiley:

hehe no problem ^^ If I would not have time and motivation to lead you through a problem, then I would not answer this question in first place :slight_smile:

The EnergyPercentage is your own Variable that you need to create along with the EnergyValue. :slight_smile:

is there any online help?? :smiley:

can u just do it for me and then send it ?? :smiley:

Well I am happy to help you with concepts and some calculations, but you need to learn getting things done on your own :slight_smile:
Please watch these tutorials. #33 is what you need in the Playlist. You would have been through the list already, so there is no reason not to learn :slight_smile:

can you give me link?

hmh all i need is decreasing energy :DD and its veeery hard to make and i have noticed there is no good tutorials for it…

Discord put this link in internet you can help more easily its free and you don’t need to make account!

Well oh boy, do you even read what i am trying to tell you XD You try to fight your level 3 boss(idea) and you are level 1. I am sure you know what to do before: Farming Experience to level up. I spent already more time to write than you would have needed to watch the first 20 tutorials. And view minutes later at tutorial 33 you will lern how to handle variables. There is no one better then Epic Games them-self to explain everything in their beginner-tutorials. Please.

Just step back from your idea today, take a deep breath and watch these tutorials. You will like it, because there you will get these weapons dropped that you want to use to make your and others life easier :slight_smile:

hmm yeah i read… but YouTube is full of tutorials and those unreal tutorials are so long (not all) io have spent many hours to try find tutorial how to make decreasing hunger system… then i found UMG UI Inventory | v4.8 | Unreal Engine - YouTube this and i spent many hours to creating that system in last video i noticed i did something wrong… then lose my hope :DD couple days ago i spotted that freaking template in epic games marketplace and i spent many days to try make good game only proplem was that energy and mood bars… and now iam here trying to solve this proplem :DD

because iam from Finland!! :smiley: its easier to watch videos than read! :smiley:
there is some words what i have no glue what they mean D:
so i maybe give up :smiley:

So, well: here you will learn how to create your Variables “EnergyValue” and “EnergyPercentage”. (You would have known this already by just watching the playlist i gave you)

oh i was stupid because i didn’t find that video :stuck_out_tongue: but its basics of variables and i already know them…

i managed to make my energy drop down only 1% of 100% and it won’t go lower? if i make some kind a loop will that work?? and i don’t know yet how to make loops…

it looks like this if i put what ever number between 1-100 in float*float it trying to decrease what to do now??

okay i made it!!! what did i do was i copied campfire and i changed float+float for mood to float-float! i made large trigger what decreases my energy and mood! this is working now! proples SOLVED!