No announcement yet.

Replicate static array in enemy pawn to all clients?

  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    Thanks for your response @RattleSN4K3, that helps a lot.

    The items need to have persistent properties, such as condition etc, so storing just the class in the array won't be enough.

    I am already using 'pickup' classes for when the items are dropped in-world, which extends from actor and hold some basic properties of the item (including a static mesh component of the the item). Do you think it would be too expensive on bandwidth to replicate these pickup classes in the pawnInv array?

    Leave a comment:

  • replied
    Instances of MyInventoryItem (assuming it's type of Inventory) only exists for the owning player (the one who's holding that inventory) (as bOnlyRelevantToOwner is true for a Inventory).

    You can use classes instead (class<MyInventoryItem> PawnInvClasses) replicate these classes and display a static image. Once the player chooses to take the item, change the owner of that specific item (of the given class) to that client whos demaning the item. Take a look at Inventory items in general and the class DroppedPickup. And of course the related code which is dropping the inventory (Inventory::DropFrom(..)).

    Leave a comment:

  • Replicate static array in enemy pawn to all clients?

    I have an enemy pawn that has a replicated static array.

    I want all surrounding players to be able to access the contents of this array, but for the clients it's always empty, even though the server can see items in the array.

    In my enemy pawn:
    var MyInventoryItem pawnInv[10]; 
    For other replicated vars (such as bools and strings) they are replicating fine. It's just the static array that isn't. Could anyone help me understand why?

    Thanks in advance