Announcement

Collapse
No announcement yet.

Networking weapon system

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Networking weapon system

    Hi,

    I've been learning networking with blueprints for a while now, trying to get a solid understanding of how ownership and RPCs and replicated variables work. I've come pretty far, and been able to execute a lot of functionality that is replicated to all clients and the server but I'm struggling now with an issue that I thought was relatively straightforward and was wondering if anyone had any ideas how I might handle this.

    I have a weapon class, that is spawned when the game starts and attached to my character. I have a first person character mesh, and a third person character mesh, with respective Owner no See and Owner Only See flags. What I am attempting to do is attach my weapon to a slightly different location depending if the character is the owner of the weapon or not. If the character owns the weapon, it should snap to his hand socket on the first person mesh, while if he does not own the weapon (aka he is looking at a different pawn character in the game, and looking at HIS gun), the gun should snap to the hand socket on the third person mesh.

    My actor is set to replicated, which if I understand, doesn't necessarily mean that the exact location would be replicated, just that the existence of the actor would be true for all clients, but I thought maybe I could attach it to a different location depending on it it was the client's gun or not... Any help or insight will be greatly appreciated

    I've posted my event graph (This is inside an actor component that acts an an inventory manager for each pawn). Its worth noting that for some reason I get errors of an unknown reference to my Owner Character Ref variable in some of the Multicast events... I've no idea why, as the reference is set right after Event Begin Play to the Owner of the actor component

    What happens in game using this current code, is that the listen Server version of my game, has his weapon attached to the FPS hands for ALL clients. While the client actors have the weapon attached to the Third person mesh for ALL clients. What Im hoping for is for the Weapon to only be attached to the FPS hands if the client is the owner, and attached to the third person mesh if he is not...

    Thanks



Working...
X