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. 

Projectile hitmarker

Anyone has idea how can I make a hit marker for projectile? Basically when I hit an enemy with bullet (projectile) I want hit marker to appear on top of my crosshair. I know how to do it for hit scan, but can't figure our exactly how to do it for projectile.

Product Version: UE 4.19
Tags:
more ▼

asked Jun 07 '18 at 08:50 AM in Blueprint Scripting

avatar image

Freymox
36 2 2 7

avatar image SenToRious Jun 07 '18 at 12:21 PM

The idea is to know who fired that bullet so that when the bullet hits a player it knows who to tell. When you spawn the projectile there's an option to pass an instigator, this basically means who made this happen, there you can pass the player who fired that projectile, when the projectile hits something Get Instigator Cast to whatever CharacterClass or PlayerControllerClass if you passed a player controlled then call a function that shows the hit marker.

Hope this made sense.

avatar image Freymox Jun 10 '18 at 11:07 AM

Basically I need to do these right? https://gyazo.com/b43e5fc07a748d2039dfbfee5eb3f918 And how can I set that it shows widget (hit marker) when I hit someone? Ok I know I should "Create a widget" and add it to view port. but how can I set Owning player?

avatar image Freymox Jun 10 '18 at 07:22 PM

With print string I checked, that "Get instigator" works good. It gives me back right value. Only Idk how to get a widget.

avatar image SenToRious Jun 14 '18 at 05:55 PM

In your character BP when using the create widget node, make sure to save that widget in a variable by right clicking on the result of the node and select promote to variable. Right click somewhere in your Character BP and create a custom event let's call it "ShowMarker" now in your projectile blueprint when hitting someone get Instigator then cast to your character class, and call the ShowMarker event. In the ShowMarker get the widget you saved and show the marker.

avatar image Freymox Jun 17 '18 at 10:02 AM

Can you please give me an example? O can't make it work. Object is biggest issue for me. Can't figure out right one from what I need to cast.

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

3 answers: sort voted first
more ▼

answered Jun 18 '18 at 08:02 PM

avatar image

Freymox
36 2 2 7

avatar image SenToRious Jun 18 '18 at 09:14 PM

Make the ServerHitMarker event Run on owning client

avatar image Freymox Jun 19 '18 at 04:04 PM

It works. Thank you!!!

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

Be sure to set up the instigator of the projectile (which is the controller that owns your weapon) when you spawn it. Then on the Event Any Damage, which is called on the Actor which received said damage, you can get the "Instigated by" to access the controller who instigated the damage to that actor.

Then you can cast to your controller class and call a hitmarker function which will show the little cross on your UI.

more ▼

answered Jun 07 '18 at 11:05 AM

avatar image

vorixo
326 2 6 13

avatar image Freymox Jun 10 '18 at 11:08 AM

My comment above!

avatar image vorixo Jun 13 '18 at 06:04 AM

Hi,

On the begin play of your controller you need to create your HUD widget and cache it in a variable. This can be done with the node CreateWidget and selecting your widget in the class variable. Then you would save the blue output reference on a variable.

Next, you need to create in your widget an animation that will play with the alpha (opacity) of the hitmarker over time (see documentation of how to make animations on UMG). Then you need one function or event on your widget blueprint that will play that animation.

Next you need to create one event on your controller named: "DisplayUMGHitmarker" or similar. This event will call the widget function you created. In order to call it you need to use the variable we setted previously when we created the widget.

Then on event any damage you can cast to the controller and call the event you created on the controller.

vorixo

avatar image Freymox Jun 14 '18 at 04:52 PM

If I set instigator as object it gives me an error, that pawn will always fail.

avatar image vorixo Jun 17 '18 at 12:08 AM

What do you mean, do you care to elaborate? Done that setup several times already on different projects.

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

Anyone? Please?

more ▼

answered Jun 13 '18 at 04:42 AM

avatar image

Freymox
36 2 2 7

(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