Help me about Question system blueprint.

I want to decrease energy value when click button.

Energy Blueprint ( Hud Widget)

I want this blueprint decrease energyT value when click on button. ( Question Widget)

This is Wrong Widget

//Sorry my bad english

Hey there, from what you show, it doesnt make any sense to me.

You have a Delay within the widgets tick event, where i assume it is never triggered since the delay (or Timer) will be reset every frame.

Then you have a “Character” and a “Energy(float)” variable which seem to be indepenedent from each other.

Then you show us a widget which creates an other widget when you click some button “Wrong Widget”.

You should provide us some more information with what should happen in your logic flow, by the way there are many tutorials out there showing how to create healthbar (or any kind of progress bar) where they show you how
to set up a communication between widgets and character stats

So what you should do:

  • be more precise :wink:


Please help why wrong widget not decrease energy value from (My energy value are in Hud Widget)

This is Wrong Widget

Help me it make me very confuse.

That delay on tick is a little scary… I wouldn’t recommend that. On top of that, you’re creating the widget and then a second later destroying it. I have no idea what’s going on in that last screenshot. You have some widget type variable that only has a reference to self that doesn’t do anything. And you’re setting it twice to nothing.

Okay i’ll try again.

Well what shall he reduce when you give him a nullreference (-Energy) to get the actual Energy(float) value out of it?

You will need to get the right reference of the object containing such an energy value.

You should start at the blueprint where you call the node “Create Widget” get the reference of that widget and save it.
Provide a function in your widget blueprint (f.e. SetEnergy which has a float as input).
Then inside the blueprint where you created and saved the reference, take that reference and call SetEnergy.

The function now wants a float as input from you, so you will need to do something like this:

  1. GetPlayerController (in case you arent inside a Playercontrollerblueprint)
  2. GetPawn/Character ->Cast to CharacterClass which has the energy property
  3. GetEnergy and take the output into your SetEnergy call.

Inside your widget you will have a variable of floattype “f.e. CurrentEnergyRatio”.
Inside your SetEnergy function take the input map the float between 0 and 1 and set CurrentEnergyRatio with that value.
Create a binding for your progressbar value.
This will create a Getter Function for you where you take your CurrentEnergyRatio value and drag it into the output of the Return node.


Thankyou. I’ll try.

Now we can do it!!! Thank you very much you very genius guy. I own you one.

Thread Closed