Access blueprint from client that is owned by server

Hello,

this is my setup:

2 player game (1 client, 1 server).
The server spawns a character (Character_NPC_Generic) and its default AIController (AIController_NPC). The character is set to replicate but the AI is not (I guess this is reasonable because I only want the server to influence the characters behaviour).

The client player is a ghost that can haunt NPCs. So what I want to do is if the player haunts I want to call a function on every AIController_NPC to check if they are scared. This was my first appraoch:

However the “get controller”-node returns none. I guess this is because in the world of the client, the AIController does not exist.

So I figured maybe I have to replicate an event and run it on server. This is how I did it:

This doesn’t seem to work either, the event never gets called. I guess the “if owning client”-phrase it, prevents it form fireing since the client does not own the Character_NPC_Generic because it is spawned by the server.

Any suggestions on how to solve my problem? Thanks in advance :slight_smile:

AI system is designed so it can only run on server, so anything to do with AI you must do it on server side.

Why don’t you just check fear on server side, and send info back to client.

And for any actor to run function on server side, owner of actor must be player controller or a pawn that is controlled by player controller.

I check fear on server side but it has to be triggered when the client (ghost) presses the button for haunting. There is no need for sending feedback back to the client, if the NPC is scared it sets its behaviour tree to another status and runs away.

Update:
I guess I figured it out. I made an event for the player controller of the client that is set to run on server. From there I iterated over all NPCs and triggerd their “check fear” function. Thanks for the advice .