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"

AI Projectile won't damage the player

Pre-warning, still somewhat of a novice when blueprint scripting, so I may not understand certain terminology used when any of you reply. I have a projectile set up so that when the AI fires it at the player, it's supposed to damage the player. Most of the time, it won't damage the player at all (I have set up a print string to display health throughout the entirety), and sometimes it will just insta kill the player without warning, for whatever reason. I did just plug the CastTo straight into apply damage, and that just dealt 60/100 damage straight away and then took nothing after. On those occasions where the player took damage, two more hits after and the game either suddenly stopped, or the player died. I just want to get the damage working and I was wondering if I could get any help as to how I can solve this? Below is a video of what is described above and a screenshot of the projectile code. If you need to see anything else just let me know! :)

alt text


Product Version: UE 4.19
capture.png (145.5 kB)
more ▼

asked May 22 '19 at 10:40 AM in Blueprint Scripting

avatar image

1 1

avatar image Lardo Deepdelver May 22 '19 at 11:29 AM

Your blueprint is a little bit weird, you loop over the enemy table and apply damage as long as Out Row Enemy Actor is not equal to the class of the actor you hit, if it's equal you stop (the break does that)

So if you have let's say three enemies in your table:

  • Enemy A

  • Enemy B

  • Enemy C

and you hit Enemy C you would apply the damage twice

  • Enemy A != Enemy C ... do damage

  • Enemy B != Enemy C ... do damage

  • Enemy C == Enemy C ... Break

but if you resort the order of the enemies in the list the damage would change

  • Enemy A

  • Enemy C

  • Enemy B

hit Enemy C you would apply the damage once

  • Enemy A != Enemy C ... do damage

  • Enemy C == Enemy C ... Break

Probably only want to apply damage on the equal path and then break

That's one thing.

The other one is the delay is problematic it would allow damaging the same target multiple times with the same object, you should store the damaged actors and not apply damage again.

To the strange and different behavior, I don't see why it does no damage sometimes but killing the enemy with multiple hits of the same object is very easy to achieve.

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

0 answers: sort voted first
Be the first one to answer this question
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