Download

Clients Cannot Spawn Weapons Correctly

I hate to just dump a bunch of blueprints in front of you and ask you to find the problem, but I’m at my wits’ end. I’ve been fighting with this for about two months now.

I’ve been trying to merge the weapon tutorials from shootertutorial.com with a modified version of the Multiplayer Blueprints tutorial. ShooterTutorial isn’t designed for mutliplayer, so I’ve been trying to figure out how to get dynamically spawned weapons… to spawn. It works fine on the server, of course, but the client weapons exhibit all kinds of issues.

Currently, the situation is like this:

If the client selects their weapons before the server does, the correct weapons spawn, but they all spawn as visible instead of the second and third being set to Hidden until the client cycles through their loadout. I’m pretty sure the client can’t cycle through their weapons either, since none of the spawned weapons change Visibility values when that event is triggered. I also get a bunch of Accessed None errors in the Change Weapons event so somewhere along the way, we’re losing the weapon variables.

If the server selects their weapons first, though, all the above happens when the client spawns their weapons, with the addition that instead of the correct weapons, the client’s selections are ignored and the weapons that spawn are whatever the server picked.

Thus far, I’ve tried moving the ArmoryWeapons array and its according functions off the Game Instance and onto the PlayerController so that it, in theory, would not be taking the variable from something only the server owns. I’ve also tried moving ChangeWeapons and SpawnWeapons out of function and making them into events. Before I did this, the events wouldn’t run at all on clients, but I’m pretty sure loads of multicast events isn’t what I should actually be doing here. I’m also wondering if maybe the problem is that I’m calling these events from the parent character blueprint and that’s somehow why it can’t tell that X player’s weapons should be different from Y player’s.

Anyway, attached is the process through which my weapons are selected and then spawned. It’s a lot, but I was trying to be thorough. Thanks for your time.