x

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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

HUD - Add 0's to unused number places.

Just wondering-

I have a HUD for my shooter that has the number of pieces of ammo go down every time you shoot. Problem is, my max ammo is 150, and I want it to go down to 000 when I'm out, but instead it just shows 0. How would I add 0 to a number to a number place I'm not using in my HUD?

Thanks.

What I'm talking about (the zeros I would want added are bolded.):

150 - 100

099 - 010

009 - 001

My Blueprints:

In my HUD: http://i.imgur.com/IZf5wwR.png

In my Event Graph in my character: http://i.imgur.com/WUR4m0h.png

Thanks, Joel.

Product Version: UE 4.9
Tags:
more ▼

asked Dec 10 '15 at 02:31 AM in Blueprint Scripting

avatar image

IceCubeCat
36 6 9 12

avatar image IceCubeCat Dec 10 '15 at 06:06 AM

Bumperoo!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

in the HUD, instead of casting the Int into Text, you should first cast it into a string. as a string, you can use Len to get the number of characters in the string, as an integer.

you can make an integer variable called MinimumDisplayDigits, and set its default value to 3. if the Len of the string is less than MinimumDisplayDigits, you can subtract the Len of the string from MinimumDisplayDigits, and use the result as the LastValue in a ForLoop, which can append placeholder 0s to the string. when the forloop completes, or when the Len of the string is not less than MinimumDisplayDigits, you can cast the string to text, and display it in your HUD.

more ▼

answered Dec 10 '15 at 06:43 AM

avatar image

ScottSpadea
9.6k 319 205 449

avatar image IceCubeCat Dec 10 '15 at 02:11 PM

Hey, I'm working on it, but I'm more of a visual- are you able to provide one?

Sorry, a tad bit new to the HUD.

Thanks mate. (If you want my Skype, just ask.)

avatar image ScottSpadea Dec 10 '15 at 06:26 PM

alt text

leadingzeroes.png (113.5 kB)
avatar image IceCubeCat Dec 11 '15 at 01:51 AM

I will love you forever. The day I met you, champagne fell from the sky. Butterflies filled the air. It was beautiful, because you are. I will eternally hold you deep within my soul. You are the apotheosis of human excellence, progressiveness, and knowledge.

Thank you Omnicypher <3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Another way to do this is to append your number as a string to a set number of zeros and then use the "right" bp function to only take the right part of the string that you want. Example: I want a character string representation of a number that has a leading zero if only one character. In other words if the value is 0-9 then display as 00-09, but if 10-99 then display 10-99.

alt text

capture.jpg (19.6 kB)
more ▼

answered Aug 16 '18 at 05:36 PM

avatar image

Modeus Games
131 10 8

avatar image Spencer.Luebbert Mar 28 '19 at 02:16 PM

Much simpler solution than accepted answer.

avatar image IceCubeCat Mar 29 '19 at 04:13 AM

A shame he was about three years late lmao

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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