DICE PACKS BUNDLE
  1. #1

    CopyNode Issue Help

    Hello,

    I have been struggling with this for a while now and it has been driving me nuts!

    FGU
    5E
    My extension is loaded.

    My code works so that a user can reset their actions form a saved copy in the database. In this scenario a player is resetting the actions for a spell.

    I have a copy of an Actions node in my DB:

    Code:
    						<original_actions>
    							<holder name="Houndy" owner="true" />
    							<id-00001>
    								<holder name="Houndy" owner="true" />
    								<onmissdamage type="string">half</onmissdamage>
    								<order type="number">1</order>
    								<savemagic type="number">1</savemagic>
    								<savetype type="string">dexterity</savetype>
    								<type type="string">cast</type>
    							</id-00001>
    							<id-00002>
    								<holder name="Houndy" owner="true" />
    								<damagelist>
    									<holder name="Houndy" owner="true" />
    									<id-00001>
    										<holder name="Houndy" owner="true" />
    										<dice type="dice">3d6</dice>
    									</id-00001>
    								</damagelist>
    								<order type="number">2</order>
    								<type type="string">damage</type>
    							</id-00002>
    						</original_actions>
    I want to delete the actions childrens node and replace it with these.

    so I do:

    Code:
    	local nodeActions = powerNode.createChild("actions");
    	for _,v in pairs(nodeActions.getChildren()) do
    		v.delete();
    	end
    	
    	DB.copyNode(originalActionsList, nodeActions);
    The result in the database is as I would expect:

    Code:
    					<actions>
    						<holder name="Houndy" owner="true" />
    						<id-00001>
    							<holder name="Houndy" owner="true" />
    							<onmissdamage type="string">half</onmissdamage>
    							<order type="number">1</order>
    							<savemagic type="number">1</savemagic>
    							<savetype type="string">dexterity</savetype>
    							<type type="string">cast</type>
    						</id-00001>
    						<id-00002>
    							<holder name="Houndy" owner="true" />
    							<damagelist>
    								<holder name="Houndy" owner="true" />
    								<id-00001>
    									<holder name="Houndy" owner="true" />
    									<dice type="dice">3d6</dice>
    								</id-00001>
    							</damagelist>
    							<order type="number">2</order>
    							<type type="string">damage</type>
    						</id-00002>
    					</actions>
    For the DM the power appears as it should:



    However, for the player it does not update the actions properly:



    If I quit as the player and rejoin, it then shows as expected.

    If I debug the node, it points to the correct path in the DB, but it seems the values of some of the children are not there.

    It seems to me that for the player, the reference to the DB is not being updated. This particular causes an issue if the player then tried to change or manipulate the broken references, as it will then break for the DM also.

    Edit: Everything works fine if it is the DM who is doing the restoring.
    Edit: I also manually added a method so I could update the display of the actions, to see if it that was the issue, but that did not work. I think it must be to do with lists and the node reference or, communications between the player and DM.

    Any help would be gratefully appreciated!

    Thanks,

    Houndy
    Attached Images Attached Images
    Last edited by Houndy; May 20th, 2020 at 11:28.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
5E Product Walkthrough Playlist

Log in

Log in