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 check for 2 different types of actors begin component overlap?

Hi, I have an enemy actor with a CollisionBox and I want him to do different behaviours depending on whom it overlaps with.For example, I want to have a "route" that checks if its the thirdpersoncharacter actor and then do something, and if it is a different actor class(for instance an npc allied to the player) do something else(while ignoring all other types of actors)

How do I go about it?

thanks in advance.

Product Version: UE 4.20
more ▼

asked Nov 10 '18 at 11:44 PM in Blueprint Scripting

avatar image

50 2 5 8

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

1 answer: sort voted first

you just need to have the logic to do a basic check. for example for the check to see if its the third person character you could just cast the other actor to thirdpersoncharacter class. if you wanted to see if the other actor was the player then you could use the equal (==) node, plug the other actor pin from the overlap event into the first input on the equal node and a get player character node into the other input, then use a branch. for checking npcs as you mention you will need to have a way to determine if the npc is allied to the player which can be done with tags, so you could take the other actor and then use the actor has tag node to check is the actor has the tag and therefore is an allied npc. how you implement it will determine the scope, for example casting to character will return true more often then casting to third person character.

more ▼

answered Nov 10 '18 at 11:53 PM

avatar image

10.1k 33 10 25

avatar image fabiomsilva Nov 11 '18 at 01:19 AM

thank you, so something like this? I guess this will work, but is there a cleaner way that doesnt resort on so many branches to say what it should do? alt text

avatar image ThompsonN13 Nov 11 '18 at 02:03 AM

yea thats the basic idea. as for a cleaner way its difficult since your trying to target such specific cases. its alot cleaner in code but in blueprint you have to get creative so things dont seem so complex.

avatar image fabiomsilva Nov 11 '18 at 04:35 AM

Thank you I really appreciate your help!

(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