x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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: alt text 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: alt text

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 :-)

Product Version: Not Selected
Tags:
more ▼

asked Sep 12 '14 at 12:05 PM in Blueprint Scripting

avatar image

NoMonkey89
134 9 14 21

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered Sep 12 '14 at 02:15 PM

avatar image

Duncan Dam
3.1k 121 50 164

avatar image NoMonkey89 Sep 12 '14 at 04:25 PM

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 Duncan Dam.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question