How do you make a damage marker for an fps?

I am making an fps game. How would i make a thing that when you are shot it has an arrow on your screen that shows where you’ve been shot from

I’ve not implemented a feature like this before, but this is how I would approach it.

Set up a widget, if you haven’t already. In the middle of that widget, you can add an image or material. When your character gets shot, keep a record of the direction they were shot from as a rotation, probably in world space. You can then add some logic into the widget graph to take that rotation and convert it into an angle. Something like finding the difference between your characters rotation and the rotation of the shot, where if you are facing directly towards the shot it returns a 0 angle and if you are facing away, it returns 180. Makes sense.

You can then use that angle to rotate the image you placed earlier. Widget components have render transform information which includes an axis of rotation. If your logic is correct, you can rotate an image (most likely of an arrow) to point in the direction your character was shot from.

I know there are more complex ways this can be done to allow for multiple arrows, for example, but hopefully this can at least get you started. Hope this helps.

can you put that in simpler terms XD, im VERY new to ue4, i got everything up to keep a record

I can try, but short of programming the entire mechanic I can’t show you the exact logic you’ll need to make this work.

Then your character gets shot, I would imagine this means I function on your character is called to make them take damage. You can extend this function to also keep a record of the angle of the shot. This could be done by getting the direction of the bullet when it hit, or by getting a look rotation to face the character/turret/other that shot you (using the Find Look at Rotation node).

Once you have this, you could break up the rotation to find the yaw (because pitch and roll likely won’t matter) and get the difference between this value and the yaw rotation of the character. This is the angle the arrow on your damage marker should be made to point.

You can pass this value to a widget and store it however you like, but once it’s there you can set the render angle of an image on your HUD (the arrow) to the angle you calculated.

This won’t be perfect functionality right out of the box, but it should get you on the right track.

I’m writing this on the assumption that you know the basics of UE4, like how to pass variables between blueprints and how to make widgets. If not, that’s fine - we all started somewhere - but this isn’t the place to explain them. I’d suggest looking up some documentation or tutorials to help you out. You’ll need this level of knowledge at least in order to do anything even remotely complex in UE4 and a lot of it is pretty straightforward.

Best of luck.

i only want it for any damage, i havent programmed bullets or guns or anything only an object that hurts you, but i want to make the damage marker still point in that direction

Then you can use the look rotation I mentioned to point towards the actor that caused the damage. Everything else should still work the same way.

OOOOOOO that makes sense i thought you mean track the rotation that the player attacked you is facing

nvm i thought i would be able to make the first part but i have no idea