Toggle pawn sensing on an off

hi, i have a flip flop for my character pawn, toggle cloaked and visible.

Do you guys know how I can toggle pawn sensing on and off, when the player is cloaked they dont attack you.

Thank you,

alt text

The way we have done this in the past is get NPCs (AI) to look for players with a Tag (Native to all actors) of something like “PLAYER” and when you are clocked, remove the tag “PLAYER” from to player character, now your AI will not see them. Then when you want them to see the player again add the tag “PLAYER” back to the player character.

265254-4aba7c16953fa6affff1ee004d650ddc.png

the first thing that springs to mind would be to cast to identify the target to see if its a class that can cloak then get the value of their cloak variable and use that in a branch (as seen at the top of the picture below). in the example below i wrote the script so that it looks for a class that would have the cloak and if the target is not of that class then shoot them, and if they are of the class and not cloaked then also shoot them.

personally i usually use AI perception for my characters. if you were using ai perception you could easily just unregister the perception stimuli source in the player controlled character. this would make it so the enemies can sense you (see, hear, damage, etc). this method makes things a bit simpler and more modular to implement in this case.