Passing references to Run On Server events change them?
So the basic gist of this one is that when I pass a self character reference to an event that is replicated to the server, it will change the reference. I'm trying to pass the client which initiated the trace event, so I can use that later down the code to add items to that particular client, but as you can see from some screenshots I will post, it changes the clients reference.
Here is the code for the trace call
And here is a debug print that I made to show the clients character and controller ref
But as you can see here, it changes the character reference to an unknown one when passing to the server
Now I could just be doing something really dumb here, but I've been struggling with this for a while now.
Some things to note;
When I change the event type to multicast or run on client, it passes the correct reference, but causes problems down the road in areas like cheat prevention, as the item can only spawn client side.
When the server runs the interact code, it passes all the correct references.
I really have no clue what to do. I tried promoting the self value to a replicated variable, and then passing it. But that did not work either. And I can't make it client side as I don't want people to be able to spawn in items or pickup items that aren't really there.
Any help is appreciated
asked Jan 23 '16 at 06:26 PM in Blueprint Scripting
The problem you are having is with replication. Display name should be a replicated variable that is set server side and then assigned to the client. Thats why it works with multicast and when the server calls the function. If you want any variable to be shared with the server it should be set server side and then replicated, such as this case.
I don't know how you've set the display name but in blueprints it should go something like this:
While your DisplayName variable is set on the client, when you pass it to the server you are actually telling the server to check on that copy of DisplayName in the server, wich is null, as it has never been set on server.
answered Jan 23 '16 at 08:39 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here