This blueprint is not setting widget health bar or number but will set it out side of the function. Does it look like there is anything wrong with it or some box I need to check for passthrough values?
Does it print where you say bug?
Thanks so much for replying everynone!
yes I simplified it even more it refuses to set the text
with both the setText function and the Set of the variable with the target of health num
could it have something to do with where the text is in the widget?
- could you clarify: does it print where you say bug? Not sure whether you’re confirming it or not.
- could you also show this bit for the text you’re trying to set:
- and lastly, could you show / tell how you add this widget to the viewport / screen
I am grilling you because the script you’re showing seems fine at a glance There’s a chance we need to look elsewhere for the culprit; merely trying to eliminate the typical scenarios that may cause issues.
Yes bug printed every time with the correct text that I wanted to add but text never changed. The only way I could change text is by setting it when the widget is constructed or on tick. The text bot has no default text and has is variable checked as well as the progress bar but I’m not even thinking about him rn.
- could you also show this bit for the text you’re trying to set (What’s in the Bind? Is there anything there?):
-
how and when is
SetHealthBar
called? You’re not storing a reference to the widget, hard to imagine how it’s called. -
what calls Start Game?
Potentially irrelevant at this point but, from the design point of view, is there a reason why the Player Controller creates the health bar widget? Isn’t Annie more than capable of handling her own health updates? Do tell, you may be juggling a bunch of characters and have a good reason for doing it in the PC. It just sounds counterproductive.
start game is called by pressing the play button on main menu
I was under the impression I should have the value health for characters in the PC so that if a player in the game disconnects then it is still stored because PC will not reset until level is changed which will never happen as it is just an arena game no other maps.
oh usually set health bar is connected and works i’ve moved things an dput it back so you can see
My best bet atm is that you’re updating the wrong widget. Here you create it:
It’s not referenced at all, yet you:
What’s up with that? Where is this var coming from and what is it referencing?
its the health bar widget
Yeah, but how do you set the value? Creating a variable does nothing without setting the value and you do not set it. Are you not getting any errors?
At some point you said this was printing OK:
But you’re not accessing this widget at all, judging by this:
Are you, perhaps, using a widget component? And then create another widget that simply overlaps it?
Which widget is this variable pointing to:
Because it’s not pointing to this one:
omg man I’m so dumb. This blueprinting is making me forget basic codding update health now works. I was doing just what you said adding text values to a widget that sure wasn’t on the viewport. Can’t wait to clean this spaghetti up, if you would indulge me with this last question, where would you put the stats for health that will be changed periodically when the character level is increased?
Thanks again for all the help you’ve given in this thread
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.