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"

Widget to show Text instead of Progress Bar

Hi

I have seen how I can put a Widget with a Progress Bar into a Player BP and show health, but what I am looking for is how to display text, such as name, money, alliance, etc.

I know how to cast to a progress bar, but can not seem to find a away to cast to a text.

alt text

Product Version: Not Selected
Tags:
capture.jpg (56.1 kB)
more ▼

asked Jan 26 '15 at 04:54 AM in Blueprint Scripting

avatar image

Narghile
1.7k 74 38 109

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

2 answers: sort voted first

Hey,

what you are looking for is not the progress bar. You will need a textfield.

A text field is a different object which you will have to place in the editor view of your widget. There are a couple of different things you can use and place. An image, a textfield, a textblock (in which the player can then input some text), buttons and a few others. All serve only their specific purpose.

I would recommend watching the tutorial series by epic about UMG:

https://www.youtube.com/watch?v=RQm6cm05SLc&list=PLZlv_N0_O1gZo6zXTHGGSH8gxaA7a_zCt

or the tutorial for a very basic menu by Tesla:

https://www.youtube.com/watch?v=yua1KSjJDdY

Both show off the basics pretty well.

I hope this helps.

Cheers

more ▼

answered Jan 26 '15 at 12:47 PM

avatar image

Erasio
5.9k 291 86 293

avatar image Narghile Jan 27 '15 at 02:05 AM

Cheers Erasio.

The issue I am having is how do I put data into a Text field in the widget. The screen shot above allows me to modify my heath and the bar goes left and right.

What I would like to do, is to have for example "Money" which I would like to display as "$XXXXX" or something similar.

I can not find away in BP to transfer the money variable in my character to the widget in my character BP.

There are going to be multiply versions of the same BP in the level, so it needs to draw the Data from a specific BP.

If I have the Widget seperate, it only draws the data from the first BP in play.

I hope I explained it better then I did before.

Regards

Narg

avatar image Narghile Jan 27 '15 at 02:48 AM

This is what I am looking for.

Cheers

Narg

link text

avatar image Erasio Jan 27 '15 at 08:29 AM

The unreal tutorial had pretty much exactly this in their series.

It's simply a text field with a bind. You provide a reference to your character BP and then just use the variable from there to display whatever variable you'd like. Maybe append it with some other text.

I'll make a few pictures of maybe a video about what exactly I mean this evening alright buddy? :)

avatar image Narghile Jan 27 '15 at 09:13 AM

Thank you.

I made it work, but had issue with it collecting only from 1st BP in game.

Here is example how it only reference 1st BP.

alt text

Thanks for helping again.

Narg

avatar image Erasio Jan 27 '15 at 09:22 AM

Well you have a few options. It really depends on how exactly it should work.

If all of them should always have the same amount like a bank you could think about saving this amount either in your player character, controller, or player state. Maybe even in a savegame directly (those are surprisingly fast and perform surprisingly well).

If it's more like a few different entities who have something similar you could use the game state or (which is a quite bad solution though) get in your construction script "all actors of class" and scan through if there is one of this type without a reference to another set or if any of those exist at all. If there is one without a reference pick this as reference and use the money variable in there. Otherwise leave it empty and use the own variable.

It really depends on your specific usecase and coding preferences ;)

avatar image Narghile Jan 27 '15 at 09:35 AM

Cheers for response,

I want for example, 3 factories that produce metal. I am playing 1st person. So I would like to walk up to each factory, each is the same BP, get how much output it has, how much it has stored and level.

Later on, I want to hire AI to collect the produce.

I hope this helps you help me.

Regards

Narg

avatar image Erasio Jan 27 '15 at 09:49 AM

I would probably suggest you to store structs of all this data in a savegame. It works fast, reliable and through all levels while you can have multiple once really easy (if you use it to store the data by default you won't have to add it later when actually saving the game. Even better you might not even need to save at all!

Here's the documentation for savegames in blueprint:

https://docs.unrealengine.com/latest/INT/Gameplay/SaveGame/Blueprints/index.html

A struct is basically a collection of variables (in this case level, production per second / minute / hour, current stock and whatever you wanna save).

avatar image Narghile Jan 28 '15 at 12:54 AM

Cheers again for your help.

It is the binding issue I am having. Binding to Progress bar - easy. do not have a clue how to bind to text.

I will start searching for bindings and see what I find.

Regards

Narg

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

SOLVED

more ▼

answered Jan 28 '15 at 01:29 AM

avatar image

Narghile
1.7k 74 38 109

avatar image Erasio Jan 28 '15 at 10:13 AM

To mark the answer as solved you can just click the accept button (just below the voting arrows of an answer). This will mark that answer as accepted and the questions as solved.

Cheers ;)

(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