Essentially I’m trying to get a widget blueprint UI to come up once a player’s health is low enough, and I want this UI to stay while the health is low until the player gets it back up.
I’ve looked it up in multiple places but I can not figure out how to keep the widget in the view port for as long as the health of the player is in between a range of two values…
Any help would be very appreciated, but please keep it simple as I’m not the brightest of users out there haha…
Hey there @EnragedRavioli! So there’s a number of ways you can pull this off depending on how you handle your health. The “best practice” way to do something like this would be to send your UI info on when to update so that you don’t check your health every single frame for no reason. That said if you alter your players health in anything other than a function, you’ll have to check it frequently which isn’t efficient but it is easy to implement.
I’ll give you a bit of a glance at how I would do it.
To walk through it, the Begin play event on your player goes ahead and makes sure the UI is spawned and set to hidden immediately in case for some reason it isn’t. (also works if you spawn with less health).
Then whenever you’re damaged it calls this (the most important thing here is the if under 30 then select hidden or visible then set the referenced widget as visible or hidden).
Now I’ll be looking into disabling the visibility once the player’s health goes back up… If you’ve got any suggestions for that part they’re much appreciated!
Ahhh if you wanted severity scaling (and don’t add new images) it may have been better to tap into the color and opacity of the image and have it bound to a variable. Your way works perfectly fine as well though.
As for when the player is healed, do the same check in the same way. If you want, you can clean this up a bit and separate it into it’s own function, just call it “UpdateDamageUI” and have it check where the health is like you have now, but just use that function at the end of heals and damages. This consolidates how your UI updates so if there’s ever an issue you know to check the function or where it calls from easily.
Edit: Another option could be to tap into the one image widget and just change the image if it’s got to change and you don’t want it additive.
I appreciate the tips! I’ll go ahead and use your advice to make it fade out once the player is healed.
The way I organized it has to do with the fact that I’m planning on animating each individual image for the severity scaling, which I’m not too sure of how I’d fit into a single widget quite yet, but it’s certainly something I’ll look into!
The stupid low brightness and red pulsating vignette effect around the screen when at low health has been plaguing this game since it was released. PA has never allowed you to disable it for god know what reason, which is moronic but you just have to learn to live with it because if they haven’t fixed it by now, I highly doubt they ever will.
Hey there @speedin70 ! Welcome to the community. Were you attempting to post in the Ark Survival Modding side? This is the Unreal Engine Q&A side so most of the games discussed here are just developers projects.