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"

how to damage a AI or character with Line Trace.

I am trying to make TPS game and I want to damage ai or any character with line trace and I search everywhere for this but I can't find. if you can tell me then plz tell....Thanks in advancealt text

Product Version: UE 4.14
Tags:
more ▼

asked Feb 01 '17 at 04:51 PM in Blueprint Scripting

avatar image

BlackGoku36
11 7 7 9

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

4 answers: sort voted first

I problem is solve. I spawn projectile with line trace and the projectile damage the character and line trace can Also damage character...

more ▼

answered Feb 18 '17 at 08:41 PM

avatar image

BlackGoku36
11 7 7 9

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

I also have that kind of similar set up and it looks like this.

This is my line trace. After it hit something I take the Hit Actor and cast it to my character to check if it has indeed hit my character and after validating that I would call the damage function on my Character's Blueprint (which is S39_Player) and apply damage to that hit character. alt text

I tested the apply damage node in my Project and it worked for me, just add a damage causer in the apply damage node.

[2]: /storage/temp/124568-line+trace+part+2.png

more ▼

answered Feb 02 '17 at 12:35 AM

avatar image

StillAlive039
182 9 10 19

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

Did you check if your line trace was actually hitting your target? You can debug that in many ways, I like to turn on the debug draw from the line trace and/or watch the value of "Hit Actor".

I might be wrong, but I'd use "Get Forward Vector" instead of "Get RotationXVector". I never used that second one actually, but if I understood it, you're getting the direction of the X axis of the controller.

more ▼

answered Feb 01 '17 at 05:21 PM

avatar image

tslimone
38 3 4

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

to better visualize whats going on - set the debug trace to frame or duration, also check your boolean hit results before applying damage with an if statement

more ▼

answered Feb 02 '17 at 02:04 AM

avatar image

BPANDREW
1k 22 27 125

(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