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. 

Is overlapping component for attacks

Hi,

I'm trying to hit my enemy with the "is overlapping component" node that checks my own collision with the enemies' collision. This is what I made, but it's currently not working:

alt text

It used to work with the "On component begin overlap", but the problem with that was that it didn't always register my attacks, only when it started to overlap with the enemies' collision. I wanted the attack to go through, even if the 2 colliders were already overlapping on start of the attack.

alt text

Thank you for helping me out with this problem <3

Product Version: UE 4.21
Tags:
more ▼

asked Feb 03 '19 at 03:57 PM in Blueprint Scripting

avatar image

Azyra_
1 1 1

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

1 answer: sort voted first

it looks to me like your issue lies in your cast. in your on overlap example you are casting the other actor to the enemy class, but in the attack event you are casting your player to the enemy class.

what you should probably do is to on attack event get overlapping actors then for each cast to enemy then do your script.

oh and your know theres built in nodes for applying and receiving damage right so you dont need to make your own custom events for that. this could possibly eliminate the need for you cast.

more ▼

answered Feb 03 '19 at 04:15 PM

avatar image

ThompsonN13
10.1k 33 9 23

avatar image Azyra_ Feb 03 '19 at 05:40 PM

Hi and thanks again for helping me out!

I tried to follow the suggestion you gave me but it's still not working, I think I must do some stuff wrong. I guess the second check with the mouth collision becomes redundant too then? I set the "get overlapping actors" filter to that of the ThirdPerson_Enemy, so it doesn't have to check everything in the game it overlaps with.

alt text

avatar image ThompsonN13 Feb 03 '19 at 07:23 PM

your still doing basically the same thing. im assuming that this script is meant to be used by the player right since its a input action. also im assuming that your player is not of the class enemy right. given those two things you have several issues here. first your player would not inherit from the class enemy so everything beyond the cast would not run. with that even if it did run you are targeting the player to damage. lets not dwell on all this however.

i made a very simple example that you could use (see below picture). when the attack event is called (input in your case) we get the actors overlapping the component we decide (a weapon in my case). then we use a for each loop which runs the rest of the script once for every overlapping actor. so for each overlapping we actor we ask is this actor of the enemy class, if yes we apply damage, if no we do nothing.

writing script is like asking a series of questions. in your case the questions asked are: is X overlapping Y, and is the other actor a enemy. theres many ways to ask these things so theres no one answer. in my example we answer is x overlapping Y via the get overlapping actors node. we answer the question is the other actor a enemy by identifying it via a cast. if you want to add in more conditions (questions) before applying damage then by all means, but thats the basics.

alt text

capture.png (129.1 kB)
avatar image ThompsonN13 Feb 03 '19 at 07:26 PM

oh yea and you can actually eliminate the cast in my example if you wanted to and just use the class filter of the get overlapping actors node. the filter will do the identifying for you so then all you need to worry about is the apply damage.

avatar image Azyra_ Feb 04 '19 at 11:11 AM

Thank you for your thorough explanation, I understand it way better now and it works!

(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