Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

HUD Progressive %

I want to show the hud like Virus gauge of Resident evil Outbreak!alt text

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 alt text

Product Version: UE 4.19
more ▼

asked Jun 21 '18 at 02:40 PM in Blueprint Scripting

avatar image

3 1 2

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

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.

alt text alt text alt text alt text

capture.png (274.4 kB)
capture1.png (205.2 kB)
capture2.png (99.5 kB)
capture3.png (240.7 kB)
more ▼

answered Jun 21 '18 at 03:53 PM

avatar image

10k 33 8 23

avatar image ThompsonN13 Jun 21 '18 at 03:56 PM

oh and if you just want the widget to show when you open the inventory then you just need to change where you create the widget. so when you create the inventor widget then create this one as well, or make this widget a child of the inventory so they are created at the same time.

avatar image Piniin Jun 22 '18 at 02:27 AM

Thank you so much! it works smoothly

(comments are locked)
10|2000 characters needed characters left

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.


more ▼

answered Jun 21 '18 at 03:53 PM

avatar image

Nebula Games Inc
4.6k 27 9 14

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question