I am unable to use a custom event to send information to the server and AI_controller. I have created a custom event in the ASP_Character BP that should at least give a print screen. However the function never gets called.
The Custom Event never changes to say it replicates. Not sure if this is a bug or not. I have changed it to non-replication and the blue one changes, I change it back the blue changes again, but the red does not. I am not sure if this text change is signifying that I am doing something wrong or if it doesn’t even matter.
Please let me know if I am missing something or if I am going about this completely wrong. Thank you very much for any help that you can provide.
Client-to-server RPCs only succeed if the calling actor is owned by the client. Clients that are not the listen server generally just own their player controller and their own pawn.
Is the client that calls ServerLocationMoveTo the net owner of the ASP_Character? Likely not if its an AI character. If this is the issue here are some things you can do:
- Get ownership of the actor before calling the RPC, you can’t do this via blueprint but you can via C++ if the server calls SetOwner(YourController).
- “Enter” the server via an actor of which the client does have ownership- examples are his PlayerController and his default spawned Pawn- then call the ServerLocationMoveTo, which will succeed now because the call is now done by the server (although initiated by the player).
I hope that helps.
Thank you for your fast reply. You are correct, the client does not own this Pawn. I didn’t even think about that. It makes since, I will take a crack at the c++ in it tonight when I get home. Though I am a novice with c++. If not I should be able to find a work around now that I realize what the problem is.
Thank you again.
You’re welcome, best of luck.