ShooterGame Client Weapon Pickups

Hello. Thanks for checking out my question. I’m not around my code atm so I’ll keep this question as general as possible.

I’ve been studying the ShooterGame example, and I’ve added my own weapon (ShooterWeapon > MyWeapon_Projectile). This goes onto my own character (ShooterCharacter > MyShooterCharacter). These classes don’t change much from their bases and mainly reuse the base code. One big difference is that MyCharacter begins with an empty inventory, and weapons must be picked up.

The listen server player is able to pickup MyWeapon and use it just fine. The client players are NOT able to pickup the weapons. The weapons are spawned for them, but they are placed off-map at location(0,0,0). So if a client picks up X many weapons, then X many weapon actors are created and placed at location(0,0,0) where they do nothing.

I’ve combed through the forums quite a bit to find out what the issue is and I believe it has to do with replication. Specifically, I don’t believe the weapons are being told “SetOwner” is the client. I’ve also seen that this is something the server needs to remotely tell the client to do in their own function (I think. I’m really not sure about this part). I haven’t changed the “OnEquip”(and it’s helpers) so that’s still all stock code from the example.

TL;DR

So, does anyone have ideas as to why the ShooterGame project doesn’t seem to support client’s picking up new weapons?

Also, how would one correctly implement a client picking up a weapon and having it placed into her inventory (in C++)?

I checked another one of Rama’s godlike posts and found this one about "OnRep"s (https://wiki.unrealengine.com/Network_Replication,Using_ReplicatedUsing/_RepNotify_vars).

I think this will be a possible fix. When I get back to my code I’m going to set up a bool (or something) to make the server notify client’s via an “OnRep” to locally set the weapon’s pawn ownership and to put that weapon into their inventory.

I’ll post back here about my success.

Found the solution!

Did more tinkering. Read more forum posts, specifically this one (https://answers.unrealengine.com/questions/86434/replicated-functions-and-pointers.html).

OBJECTS NEED TO BE CREATED ON THE SERVER AND REPLICATED DOWN TO CLIENTS.

This was my issue. I made my weapon pickup method a server method (_validate, _implementation). This made it so the weapon creation/assignment process was performed ON THE SERVER then replicated down to the client.

My players can now all pickup my custom weapons and use them as intended.

So, once again, DON’T spawn and assign your weapons to players on the client side of your networked multiplayer game. I hope this helps anyone else encountering this issue.