HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: [Resolved] _ItemContainerOwner replication problem  (Read 775 times)

adamjmac

  • World Owners
  • ****
  • Posts: 3
    • View Profile
[Resolved] _ItemContainerOwner replication problem
« on: May 17, 14, 10:34:35 PM »

I'm having trouble getting replication working with _ItemContainerOwner.

I have set E_player_character on the server and client to have this parent class. This should provide a map of item containers in both places, and my understanding is that since the field _itemContainerMap is enabled for replication, the map should be synced using the default character replication group.

On the server, I created a container and added some items successfully, but then on the client, the map is still empty. The "Item System" wiki page seems to cover everything up the point of replicating the map itself, so I'm stuck.

Any possible reasons why? Thanks in advance.
« Last Edit: May 22, 14, 05:23:44 PM by HE-Cooper »
Logged

AWW_boss

  • General Accounts
  • *
  • Posts: 846
  • gdfgd
    • View Profile
Re: _ItemContainerOwner replication problem
« Reply #1 on: May 17, 14, 11:45:49 PM »

I have this piece of code in server E_AccountClassMethods, method HE_PostCharacterActivated:

    //replicate player inventory to client
    pcTopLevelContainer as NodeRef of Class _ItemContainer = pc._GetItemContainerByName("pc_top_level_container")
    if (pcTopLevelContainer<>None)
      pcTopLevelContainer._GetReplicationGroup(true)
    .


See if that helps you.
Logged

Jrome90

  • General Accounts
  • *
  • Posts: 330
    • View Profile
Re: _ItemContainerOwner replication problem
« Reply #2 on: May 18, 14, 12:02:03 AM »

Boss' solution should work.
Another option is:
Under the same method "HE_PostCharacterActivated" suggested by Boss:

pc._ReplicateAllContainers()
Where "pc" is the PlayerCharacter noderef

"_ReplicateAllContainers()" is in the "_ItemContainerOwner" class
« Last Edit: May 18, 14, 12:04:20 AM by Jrome90 »
Logged

adamjmac

  • World Owners
  • ****
  • Posts: 3
    • View Profile
Re: _ItemContainerOwner replication problem
« Reply #3 on: May 18, 14, 08:22:17 AM »

Thanks, that was needed to get the containers themselves to be replicated. However, my problem was also that the field on the character which maps the containers by name was not replicating. As it turns out, shutting down and restarting in the morning magically fixed the issue.

I think there may be an issue related to changing a class definition in the DOM, and then those new fields are not replicated until HeroBlade is restarted.
Logged

adamjmac

  • World Owners
  • ****
  • Posts: 3
    • View Profile
Re: _ItemContainerOwner replication problem
« Reply #4 on: May 18, 14, 08:29:53 AM »

RestartReplicationGroups( QueryReplicationGroups())

A new test field was not replicated on the client until I called this function. Good to know.
Logged