Download

Damage displayed

Hi guys was wondering does anyone know how to display the damage you do to a character like in borderlands numbers appear above the head and fade away ?

A Text Render Component or a Billboard Component do the trick.

Or use a widget:

The widget is quite plain. You can add colours, crit sfx, alter font size, add outlines and so on.

widget.png

On Construct you position it in the viewport via an exposed variable and you set a target location for it to move towards to. The fading animating starts playing immediately.
Event Tick will update its position. The animation changes text’s opacity from 1 to 0 over 1s and once it’s over, the widget gets removed from the viewport and garbage collected.

Looks decent enough imho:

Looks spot on thanks I’ll give it a go and keep you posted

I was wondering what is better and has less influence on perfomance. Is it using animation from Widget Designer panel, or using Event Tick and Set Position in viewport.
I’d like to use Animation, but i have no idea how to use it in my case. I mean i’d like numbers to spawn on screen and go to random places every time.

Canvas. Put a text box in a canvas and shift it around. You could achieve it with a widget animation. The stuff above is already using an animation for the fade out, so you can just hop on the bandwagon there and animate both. This will most likely be slower than moving it in the viewport because now every widget has a canvas. Alternatively, you could add it to another widget’s canvas, like a master widget layer responsible for displaying just the flying numbers but I’d only go that way if I needed a separate layer for some additional reasons.

Dunno. Make 5000 of them and watch it burn. :wink: From my experience, the complexity of the widget has the biggest impact rather than what you do with it. Ensure that everything in the widget is set to Self/HitTestInvisible bar the vital, interactive stuff.

I know this is old but i cant figure out how to pass in the initial screen loc and the damage value, and i also cant find the settext node. Could you help?

The *Initial Screen Loc *and *Dmg Val *variables are Exposed On Spawn - this makes them visible on the widget creation node. Select a variable and have a look at its details panel.

Text boxes are not exposed as variables by default; there is a tickbox at the very top of their details panel that overrides this setting and allows you to see the text box’s reference in the details panel.

Thanks, i could also hand on the damage by creating a variable and binding the text to it, and just updating the variable.

If the damage displayed will change dynamically, then yes. Bare in mind that anything that is bound get executed every frame, adding to the performance cost. Probably negligible in this case, though.

Can somebody please tell me why this doesn’t work? The Damage appears for a split second then disappears.

How long is the animation? Also, the Interp Speed is 0 so nothing is going to interpolate / move.

The animation is 5 seconds long.

Your target location is always off-screen. You’re not adding Initial & Target like it was suggested in the example you copied from - you’re just using flat values.

The problem fixed I changed the Interp speed but now the text just flies in the same direction.

Oh sorry I didn’t see that until now ill try that.

Sorry, I don’t understand because I’m New to unreal. Where does the Initial and target get added?

Here, you’re missing this bit:

https://forums.unrealengine.com/core/image/gif;base64

You can right click pins to *split *them. Essentially, Target is *Initial *+ Random Offset.

Thank you I will try that.

It works now, Thank you so much for your help.