Stuck with widgets

I have been messing around with this for 30mins and cant find out how to get it working i havent messed around with widgets much i am trying to make it so when you kill an enemy it will change the “0 killed” to “1killed” i have the death setup but the number 0 isnt there when i start the game or it doesnt change to 1 and the “get number killed text 0” is binded to the text “0”

][2]

First of, it is BOUND.

Secondly, remove the tick from the die function and check after you lower the health. That is much cheaper.

Finally, you have to access the Widget and then call a function that updates the text. Then you just call the widget function as you would any class. The widget function simply takes the new value and convert it to text and then replaces the widget text variable with that.

HTH

UPDATE:

Example code.
The widget code. It initializes to 0 and then sets the new value every time it updates.

http://puu.sh/rbfja/127c8f74ae.png

The Blueprint code. I just used time, but the tick function would be replaced with your die event.

http://puu.sh/rbfLD/36e8f766a1.jpg

im not quite sure how to do the final step “Finally, you have to access the Widget and then call a function that updates the text. Then you just call the widget function as you would any class. The widget function simply takes the new value and convert it to text and then replaces the widget text variable with that.” do i do this in the health bp or widget? sorry if its a noob question only just getting back into blueprint scripting

do i do this in the health bp or Main menu widget?

You do this in the BP that handles the logic for counting the kills. Whenever you get a kill you increase the counter somewhere. There you also, at the very end, call the widget function. First you need a reference to the widget class though. You can store that reference when you make the widget.

Hey ,

The idea of the Bindings is to reach into the other classes and get data from them. It’s not really about setting anything from UMG.

As an example, to get Kills from a player, you would get the Player Character and then Cast it into your Player Character class and then your Character class would have Kills. From that, you can display the kills from the value in your Character.

Then, in your game logic, you can have Kills be set when your Player Character kills something and UMG will pickup on the change when “Kills” gets changed.

thanks for all the replys i understand it more now the only problem is the number wont show on screen. on the widget screenshot it says “0killed” but when i load the game it just says “killed” the number 0 has gone. I used a print screen on the health to see if it is getting the +1 after death it gets the number value and stores it in the variable so its just the widget now that wont display it.

thanks for all the replys i understand it more now the only problem is the number wont show on screen. on the widget screenshot it says “0killed” but when i load the game it just says “killed” the number 0 has gone. I used a print screen on the health to see if it is getting the +1 after death it gets the number value and stores it in the variable so its just the widget now that wont display it.

Let me quickly show you. Ill link the images in my answer with an update.

Make sure it is not a static text object.

I have ran into a problem when using this i have made a quick video showing the problems the “0 killed” doesn’t go and “1 killed” is overlapping it and when i kill more than one the counter doesn’t go up it stays at “1 killed”

Hey ,

Here is a video showing how I set it up as a whole.

It is fast because I can’t take a ton of time explaining whats going on but you should be able to follow it.

[][1]

[1]: