Download

Replicating chest contents

Hello, I am trying to find a good way to replicate the contents of a chest. So far my idea is this:

When a player moves near a chest, server replicates all items that are in it, in case he interacts with it. If the player opens the chest, the client will get all actors of items, and check if the the item is in the chest. If it is, add an icon in the UI.
The problem with this approach is that players that do not have access and just walk by will get unnecessary data. Is there a way to replicate the items only to the people who interact with it?

If you want this to run all over the client only, I don’t see why it should be replicated. At least I didn’t get the reason you would replicate.

If it’s the case that the Server is replicating this to clients, you should run all the logic from a Custom Event set to Run On Owning Client.

Well I have an item actor, and a chest actor. The chest actor has an array “Contents” with all the item actors in it. I use an event set to Run on owning client, to send the array to the client. The problem is, all these item actors are invalid in the client, unless replicated. But how will I replicate them only if the player is actually interacting with the chest? Right now I made the item actors attached to the chest, and set it’s radius pretty small so if a player goes near the check, it gets all the item actors that are in the chest, although I have one more problem with it(made another thread about it), looking to find a solution for it atm.