HUD Progressive %
I want to show the hud like Virus gauge of Resident evil Outbreak!
Here's a video too https://youtu.be/yJzYSzBbT-g?t=719
It goes up to 100% progressively, i have my event tick on my version of the code, but i'm not able to do something like that, the close im from that is using a Print String but it show on the left corner always, i just want to show it when im in my inventory, , and it increase with damage too, i just started to use UE4 so i dont know alot :( all help is welcome thanks! here's my code from the Event tick Virus
asked Jun 21 '18 at 02:40 PM in Blueprint Scripting
heres how i would do this setup. first setup the basic functionality in the character by dragging off of event begin play and using the set timer by event node, this will control the increase in the virus level overtime so you will want to set the time interval and set it to looping. after creating the loop you are going to want to create the widget and add it to the viewport but as we dont have a widget yet you can do this later. the next thing to do is to drag off of the timer event pin and create a custom event, this is the event that will actually increase the virus level. ok so create a variable named virus level then drag it into the graph and select a get version. drag off the get and search for + which will give you an add node (this is how mush to increase the virus per time interval). once the addition is complete we just need to set the variable. we will then check to see if the virus level has reached its max level, if true we destroy the character. now the last bit is the increase virus on damage which is simple enough just use the event any damage and do the same as above (get variable, add amount, set variable).
now create a widget and add a progress bar and a text component. the progress bar bill be the graphical representation and you can change the look by setting the background and fill images (thats how you make it look fancy like the picture). so once you have those components added you will want to go to the event graph by clicking graph at the top right, then you are going to want to create the script in the second picture below. you will need to get player character then cast to the class that your character will be, then right click the as class pin (it will say your classes name here) and select promote to variable (this will create a variable and set its type for you). you will then need to create bindings for the text and progress bar. for the progress bar go into the designer and select the progress bar then in the details panel look for progress section then percent and finally click bind then create binding. for the text it will be under the content section and look for text. the last step is to assign values to the bindings (picture 4). for the progress bar you just need to take the character reference that you made into a variable in the event graph and from that drag off and search for the virus level variable, we then need to convert this value to a number between 0 and 1, we do this by using the normalize to range node, lastly connect this to the return node. for the text its a similar process except we need to convert the virus level from a number to text then connect to the return pin, you may also want to set how many decimal places are shown to match the look you want.
the last step is to assign the widget to be the once used in the create widget node in the character bp as shown in the first steps and picture.
that should cover everything but if you have questions just ask.
answered Jun 21 '18 at 03:53 PM
So from the looks of it, you have a bit of work to do. You need a widget, a text variable to display the "percentage", a float variable to hold the value of the "percentage", a method to increase the "float" variable over time and finally you need to link the float and text output variables. I made a tutorial for a racing game timer that has all the basic things you will need to implement to get something working. You will need to modify the code a bit if you only want it to come up with an "inventory" (also another widget), and I used an integer variable so my numbers are whole not decimal but that is a simple switch from integer to float variables. Anyway, check this out, try and get a basic system working first and then I can help you go from there to get specifically what you want.
answered Jun 21 '18 at 03:53 PM
Nebula Games Inc
Follow this question
Once you sign in you will be able to subscribe for any updates here