What is the best way to replicate my door bp?
Make a custom event with RunOnServer replication. This is also called RPC or Remote Procedure Call (client wants the server to do something). Make another custom event with Multicast replication and run the logic to open the door. I remember the need to set timeline to replicate. Otherwise the door won’t be correctly replicated to all clients
And where should i attach both events?
Key press to RunOnServer. RunOnServer to Multicast
Have you set timeline to replicate? If not, open the timeline and toggle it.
Is the BP set to replicate?
Please take a moment to download the content examples and look through the networking / replication level. In the far side of the level there are several chest bps that have everything you would need to have the same functionality. They will also help you understand what replication is and how it works.
Here is the sister wiki link.
I watched a lot of videos about that… after that i think that i understand that but it dosent work everytime.
Since i started that post i tried to make it like the chest, but that didnt work. maybe because of the E-Key press.
It works when i open it when the player is overlapping it, but thats not what i want
Right, that’s because the complete solution chest is detecting the player by the overlap portion of it’s parent blueprint. In the top right corner of a blueprint in the editor will have the blueprint’s parent, you can see that the complete solution chest is a child of the no replication blueprint chest.
so you can find the code that does all the “client stuff” ie where the gold fx and chest opening, and where the “client” interacts with said blueprint is the onchesttouch event of the no replication chest, which calls the opening and gold fx.
in the child of the no replication chest, the complete solution, it overrides the onchesttouch event from it’s parent no replication chest, which the complete chest does a set with notify on a bool called chest open. then calls a custom replicated event that plays the fx, this way the chest or door can have effects play when someone opens it but not when someone receives the notification that chest open bool was set. when that bool is set it calls a on rep function called onrep_chestopen. so an open door or chest will be already open when a player sees a previously open chest or door.
Really all the difference in the chest vs your door, is how it’s detected, yours by key and chest by overlap, so we can change the chest into a simple key by changing how we call on chest touched in the no replication bp.
edit: you don’t have to use inheritance, it was just the example they used to accomplish the tutorial. although the system they made allows for single player and multiplayer chests.
Thanks… but i cant get it to work… maybe it is a bug…
Nothing happens when i try to open it with the Client, the server works fine.
And when i try some other stuff, the client can open it but it does not send it to the server
Just found someone with the same problem… but is that really the only way to make it?
It makes sense because of the door isn’t the owning client.
“**Thanks that helped a lot. but i have i problem with the collision (I think). my character is jigglin when I walk threw the door (bouncing up and down). The Server character doesnt do that, but i can see it at the client window. **”
you don’t want the key press in the door bp, it will never receive the press because as you said its not owned by the client. you need to make something call that event function. so either in the player controller or pawn / character you set up something that calls the door open event.
im not trying to be mean but you might find it useful to take some time to make a single player version before trying to make a multiplayer version as it would seem you might not understand the ue4 hierarchy.
No problem I’m still learning it. The Problem is that everything I make normal works when I make it, and that’s the first thing I couldn’t get to work in multiplayer.
I started with the multiplayer thing ~ a week ago and I managed to do everything I want. Animations, Shooting, Damage etc.
That’s the first thing that makes so much problem.
As I posted in my last thread I found something that works, the door opens on every screen, no matter if it is Client1, Client2 or the Server.
The current issue is some weird jiggling when walking trough the door