Starfinder Playlist
Page 1 of 2 12 Last
  1. #1

    [Programming]Rigging PC stats to Combat Tracker?

    I feel quite stumped here. I've got the NPC's health working fine on the combat tracker of my AlienRPG ruleset I've been working on here Link, but I can't seem to get it to do the same for the PC's. I looked at the D&D 5e ruleset, and the number on the combat tracker calls a function on the character sheet. For some reason, I fail to achieve a similar result.

    I looked for extensions for CoreRPG that I might be able to use as an example or template, but supposedly the one which existed has been merged with CoreRPG? I can't seem to find that option either.

    Where are the best places to look for examples to program this? which is the most simple method which still links the combat tracker number to the PC number?

    thanks again for any advice and such, you guys have been awesome helping me thus far.

  2. #2
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,678
    Blog Entries
    1
    You can look at MoreCore and see how that is done.
    There are several places that you need to add code for keeping CT and PCs in Sync.
    NPCs are different because they are actually LIVING in the CT so changes there are the only place the data is stored.
    PCs need to sync from charsheet to CT and from CT to charsheet.

  3. #3
    I think it's built into CoreRPG but look for crosslink.

    Code:
          <number_ct_crosslink name="hptotal" />
    Something like that.
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  4. #4

  5. #5
    Quote Originally Posted by damned View Post
    number_ct_crosslink is definitely the main piece of the puzzle.
    man! i went rooting around your code, compared it to the CoreRPG code, and eventually worked it out based on what you and celestian suggested. it now displays the amount properly! whoo! i've just uploaded it as this will be the last i do to it for at least a day or so. next thing i need to do is make it so i can do on the combat tracker to their health as i can do to their character sheet.

    thank you both!

  6. #6
    Sorry about reviving an old thread, but could someone be more specific about this?
    I've figured out that I need to use a number_ct_crosslink in the xml, and then in the ct_entry.lua add [value].setLink(...) to the value. But that's as far as I could figure out.

    I assume I'm still missing a step because it's not syncing the value between the ct and the player sheet. Could someone help?

    Here's what I have:

    record_char_main.xml
    Code:
    ...
    <number_dropadd name="testvalue" source="test.value">
    	<anchored to="temphp" position="righthigh" offset="15,0" width="40" height="30" />
    	<font>reference-b-large</font>
    </number_dropadd>
    ...
    ct_host.xml
    Code:
    ...
    <number_ct_crosslink name="testctvalue" merge="replace">
    	<anchored to="initresult" width="24" height="20">
    		<top />
    		<right anchor="left" relation="relative" offset="-10" />
    	</anchored>
    </number_ct_crosslink>
    ...
    ct_entry.lua
    Code:
    ...
    function linkPCFields()
    	local nodeChar = link.getTargetDatabaseNode();
    	if nodeChar then
    		...
    		testctvalue.setLink(nodeChar.createChild("test.value", "number"));
    	end
    end
    ...

  7. #7
    Just helpful advice all around, throw debugs into the scripts and see if it's pulling the right information. This helps in hunting down where the breakdown is in the code. Also, check the campaign db.xml and see the values in the ct and the character sheet. As for the code presented it looks right at first glance. Try the above and see if shines a light on the breakdown.
    Dominic Morta
    Ruleset Developer
    Smiteworks

    How to zip up your campaign if the Developers ask for it-How to zip up your campaign if the Developers ask for it

    How to provide an Unity Connection issue?-Connection Issues and What to Provide

    Unity Updater issue?-Updater Issues

    Classic and Unity Port Forwarding?-Fantasy Grounds Connections Explained

    Comcast or Cox ISP User?-Comcast XFinity and Cox Users

    Have a suggestion?-Feature Request

  8. #8
    I've checked the campaign db.xml on a brand new campaign.

    The character has the following stats tracked on them
    Code:
    <test>
    	<value type="number">7</value>
    </test>
    and the same character in the ct has the following stats tracked on them
    Code:
    <testctvalue type="number">0</testctvalue>
    They don't act as linked in any way unfortunately. Is there something I've done wrong or some missing step? As far as I can see, this matches up exactly with how hp.wounds and wounds appear in the db.xml

  9. #9
    What other values are you linking to the CT in that function? Are they linking correctly?
    Dominic Morta
    Ruleset Developer
    Smiteworks

    How to zip up your campaign if the Developers ask for it-How to zip up your campaign if the Developers ask for it

    How to provide an Unity Connection issue?-Connection Issues and What to Provide

    Unity Updater issue?-Updater Issues

    Classic and Unity Port Forwarding?-Fantasy Grounds Connections Explained

    Comcast or Cox ISP User?-Comcast XFinity and Cox Users

    Have a suggestion?-Feature Request

  10. #10
    the default 5E values as they appear in 5E.pak, and yes they appear to be linking just fine.

    Here's the full function as it appears in ct_entry.lua. It's just the bottom one that isn't linking
    Code:
    function linkPCFields()
    	local nodeChar = link.getTargetDatabaseNode();
    	if nodeChar then
    		name.setLink(nodeChar.createChild("name", "string"), true);
    		senses.setLink(nodeChar.createChild("senses", "string"), true);
    
    		hptotal.setLink(nodeChar.createChild("hp.total", "number"));
    		hptemp.setLink(nodeChar.createChild("hp.temporary", "number"));
    		wounds.setLink(nodeChar.createChild("hp.wounds", "number"));
    		deathsavesuccess.setLink(nodeChar.createChild("hp.deathsavesuccess", "number"));
    		deathsavefail.setLink(nodeChar.createChild("hp.deathsavefail", "number"));
    
    		type.setLink(nodeChar.createChild("race", "string"));
    		size.setLink(nodeChar.createChild("size", "string"));
    		alignment.setLink(nodeChar.createChild("alignment", "string"));
    		
    		strength.setLink(nodeChar.createChild("abilities.strength.score", "number"), true);
    		dexterity.setLink(nodeChar.createChild("abilities.dexterity.score", "number"), true);
    		constitution.setLink(nodeChar.createChild("abilities.constitution.score", "number"), true);
    		intelligence.setLink(nodeChar.createChild("abilities.intelligence.score", "number"), true);
    		wisdom.setLink(nodeChar.createChild("abilities.wisdom.score", "number"), true);
    		charisma.setLink(nodeChar.createChild("abilities.charisma.score", "number"), true);
    
    		init.setLink(nodeChar.createChild("initiative.total", "number"), true);
    		ac.setLink(nodeChar.createChild("defenses.ac.total", "number"), true);
    		speed.setLink(nodeChar.createChild("speed.total", "number"), true);
    		
    		testctvalue.setLink(nodeChar.createChild("test.value", "number"));
    	end
    end
    The number box in the combat tracker does not have the chain icon in the corner like wounds, max hp, and temp hp do
    Last edited by GEONE; July 31st, 2021 at 23:47.

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 Character Create Playlist

Log in

Log in