Replicating a random int in multiplayer
Hello! I have a power up that i can spawn. This power up spawns with a random material, and light color. This is chosen with a random integer with the range of 0 ->4. This works 100% in single player, and server side. However the client seems to re do the random integer, and thus spawn with a different material, and light color after i set the variable to replicated.
How can i set this integer to be the same for both client, and server side?
asked Jan 30 '16 at 09:31 PM in Blueprint Scripting
You're doing the replication wrong. You want to set the variable to a repnotify, rather than replicated. Then next you want to set the random int on the server(not multicast).
Then go to functions and there you see a newly created function called OnRepSomething and in that variable do the part that comes behind the int set.
Reason why it doesn't work is because you're doing the random on all clients rather than the server.
answered Jan 30 '16 at 09:49 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here