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.
asked Nov 10 '18 at 11:44 PM in Blueprint Scripting
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.
answered Nov 10 '18 at 11:53 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here