Announcement

Collapse
No announcement yet.

Possible to change replication settings of actor during game?

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

    Possible to change replication settings of actor during game?

    I'd like to change the bOnlyRelevantToOwner var of inventory items as the player picks-up or places items in storage crates.

    The idea is that when a player is carrying an item it is only relevant to that player carrying the item (which is how inventory items are already setup). But when the item is placed in a storage crate, i'd like to set bOnlyRelevantToOwner to false.

    Is this just as simple as changing the property on the server and client?

    #2
    The basic relevancy settings are fixed for various reasons. The question is: Why would you use inventory instances for that, as Inventory is specifically designed to not be visible to anyone but the player currently owning it. If a weapon or power-up is dropped, its inventory becomes irrelevant until the DroppedPickup is taken by another player and the Inventory gets added to that player's list.

    Comment


      #3
      Thanks for your response @Wormbo. Well, inventory instances are really just a few tweaks on top of a basic actor extension aren't they..? The only real difference I can see between the inventory instances and dropped inventory instances is the replication setup and that one has a static mesh component an the other not.

      In this situation, the items are still "inventory" items, but are in a storage container of some sort (not currently owned by a player). I still need to be able to perform nearly all my inventory actions with these items (like moving to specific slots, various scaleform GFX drag and drop actions, etc). So they're not really "dropped" items when they're in external storage containers.

      I started playing around with using my inventoryPickupItem classes for when I add these items to external storage containers, but they are really designed for when the item is dropped in-world. Which is why i started thinking maybe I could just modify the replication settings when moving items in and out of external loot containers.

      My other thought is to extend both playerOwnedInvItems and unownedInvItems from a single inv class, and just change the replication settings for each...?

      I'd love to hear any thoughts you have on how I should handle loot in storage containers, which the player can interact with when viewing the container.

      Comment


        #4
        Ok, let me ask you a question: Why do you want those Inventory actors to be relevant to players other than an owner? Or actually, what exactly are you trying to achieve?

        In theory you are right, Inventory classes are just Actor subclasses. But practically there is a reason for the various classes' replication configurations. Parallel inheritance hierarchies are a "code smell" and usually are a result of poor class design. You might want to read into the topic of "design patterns" to come up with a better solution. For example, why don't you let the player own the container and its content while viewing it?

        Comment


          #5
          Thank for your advice @Wormbo. I decided to try your suggestion of assigning ownership to the player who is inspecting the loot container. It's working quite nicely, i just have a few bugs to iron out.

          Comment

          Working...
          X