Set Actor Location on client / replication
Hey there, I have a blueprint actor and set replicate and replicate movement to true but when I use "Set Actor Location" with the client the object only changes location in the clients window. At the server window the object remains at it's original position. Any idea what might went wrong?
asked Aug 04 '14 at 10:43 AM in Blueprint Scripting
Everything that is replicated and what you want on every client/server, needs to be set by the server. So if you let the client Set an Actor location you need to call a custom Replicated event that is "RunOnServer" and got an Input of the VectorLocation and the Actor you want to set. So the Blue Custom Event Call node of your new replicated event will get the Vektor and the Actor as input and the red one that will be run on the server will have these two as outputs to actually set the actors postion.
Here is a picture:
For the actor you can use the one you want to change (i used the actor i run it on (self) for this) and the Vector in the blue node can be set to what ever is on your mind. I left it empty at this point.
These two variables will be passed to the Red node that is run on the server and, like you can see on the screen, will change its location.
(: Hope that works for you mate
answered Aug 04 '14 at 10:53 AM
I was running into a similar issue, even using a run-on-server RPC function. The problem in my case turned out to be the "net load on client" flag under replication on the actor itself; it should be OFF.
I think what's going on here is net load on client basically tells connecting clients to load all objects in the level during client connection from the client's hard drive; I think it does this to save bandwidth by not having to send all the information about the level. So if your actor is already in the level (which mine was) and you are trying to move it after the fact during level or game mode BeginPlay or similar, you want the client to get information about the actor directly from the server when loading the map, instead of loading the initial start locations from the map it already has (which is normally safe for objects that won't need to move, hence the default to "net load on client" being sane)
I also checked "replicate movement" but i'm not sure if that was necessary. If your actor exists in the level itself at load, I think this should fix your issue.
answered Sep 03 '16 at 12:43 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here