Overlap specific

I was wondering, I want to set things up so when my pawn overlaps a certain object it loses health and if it overlaps another object it gets points.

My problem is that if I code an object of a specific type to give the player points with overlap, I can only do it so it gives points with overlap in general, so if the object overlaps with another object then the player gets points as well.

How do I script so that only when the pawn overlaps with an object the event happens?

you just need to add a little check to make sure the overlapping actor is the player before completing the rest of the script. an easy way to make sure that the script only suceeds when the player is overlapping is to us a get player character, equal (==), and a branch. to set this up you take the get player character and plug it into the second pin of the equal node, then take the other actor pin from the overlap event and plug that into the first pin of the equal node. last plug the output of the equal node into the branch and also plug the exe pin from the overlap event into the branch node. if you plug the rest of your script into the true pin of the branch then it will only execute when the overlapping actor is the player.

Thanks…

I don’t understand fully, if I set up a branch and as condition I set up the pawn and the object as equals?

Like this?

nope like the below picture. the other actor pin is the actor that set off the overlap in your current bp. so if say a chicken walked into your obstacle then the value of the other actor would be chicken. knowing this we want to compare the value of the other actor to a know actor aka the player character. so we ask the question of is the other actor the same as the player character. in the example of the chicken assuming your character isnt a chicken, it would ask is the character currently possesed by the player this chicken, and the answer would be no. but if the player walked into the obstacle then it would ask is this character that just overlapped me the same one possesed by the player and that would be true. its a basic comparison, does this equal that. this method is very specific meaning it can differentiate between different actors of the same class. so if you had say two third person characters, one possesed by the player and one ai, this method could tell the difference since its using actor references. if you wanted a check that only checked for class and not a specific actor then you could just use a cast.

Thanks!!!

Or you can use the Other Actor output and plug that in to your character like below.

[https://pasteboard.co/JuHI7xm.png][1]

(external link because my image will not upload for some reason).