Download

Spawning Weapon Replication

Hi, I’m trying to replicate my weapon swapping and drawing, it all worked fine until I tried to replicate the actual spawning of the weapon actor, because I have to use an event which can’t return an output which is vital to the function, is there any way around this?

Didn’t know I could simply run the function on the server event and just call the event instead of the function whenever it’s called, that fixed spawning them, now destroying them isn’t working though, even though they’re calling the Server_DestroyActor event (which works fine with other things like lootables), they’re not being removed on client, only on Server.

I get the error saying it couldn’t find the ‘Target’ in the DestroyActor, even though it is destroying it on the server editor window, just not for the client windows. Plus before the ‘Server_DestroyActor’ event is called it uses a validated get, so it should definitely exist, and it’s even printing the correct display name for the target when called!

Edit: I just realised I had ‘Replicates’ unchecked in the Weapon BP, so I just checked it to see if that works, and now it spawns and instantly destroys itself in the Server window, but does the same thing as it was doing before on the Client window…

Edit 2: I kept the ‘Replicates’ checked in the Weapon BP, and deleted the Multi_SwitchWeapon event, and instead just used the Server_SwitchWeapon and it all works fine now. I hate replication, this makes no sense, but at least this issue is sorted!

Hey Mike, Typically you’d spawn the weapon on the server then let it replicate (Actor replicates[ticked]). Same applies to destroy…typically.

v4.22.0+ supposedly allows the client to destroy server spawned actors on the local proxy. I haven’t tested this though.