Check whether character is controlled by current player or not (from thirdparty BP)

Hey!

I do have a blueprint called Fog. It doesn’t belong to anyone, but once a player gets in, I want to make it see whatever’s inside, and make it disappear to the outside world.

The thing is: since the Fog belongs to no one, it’s complicated for me to distinguish who’s the player controlling the character that got in and who’s not.

My current progress is that I can make it disappear and appear once he’s inside or outside. Am doing this through multicasting, but naturally, it affects the player himself, making it disappear to himself as well. Tried to hide it using running on Owning Client, but it also affects all the other clients.

Ideas?

Thanks.

If it multiplayer game, why you need “current” player? I mean, is this code must work on server without “owning player”?
You can easily get owner of character by APawn->GetController() method.

If it is client side, you can just call GetController then check it for null because clients cannot access other PlayerControllers.

Hey @Angel Phosphoros. Thank you for your answer.

Well, I want the server to validate the “fog of war” to avoid cheating. I don’t want players to be able to reveal the content of a fog without being actually inside it.

Also, since it’s a TopDown game, the controller of the pawn is the AI, and not the Player Controller. I’ve tried to use GetController(), yes, but without success.

In the end, I changed the design of my solution a bit. Now, the server only manages an array containing who’s inside the fog and nothing else. The actual visibility is exclusively managed by the client, using the array the server manages as a reference.

Thanks again! Cheers!