cscase
November 3rd, 2013, 05:22
Question:
I'm trying to get a combat tracker working with the ruleset I've been putting together, but am running into a problem. For NPC entries, the values for things like HP are stored in the root of the object as "hp," which seems to be what the combat tracker is looking for, so for NPCs the HP value populates automatically when I drag an NPC into the tracker. So far, so good.
But for PCs, I have the HP value stored another layer or two deep in the database, and it has a slightly different name than just "hp." As a result, the combat tracker is not wanting to pick up values for PC HPs when I drag them in, and instead it just gives me a blank box with the chain links icon.
What is the best way to resolve this? I was thinking that maybe I could add an invisible control to the character sheet that is set with its source to be the DB node that contains player current HP. The idea being that this would be basically a "shortcut" to the HP and maybe the combat tracker would be able to reference the HP value through that. I set that up like this, but it doesn't seem to work:
<numberfield name="hp" source=".stats.Health.pool">
<anchored>
<to>hpframe</to>
<position>insidetopright</position>
<offset>0,0</offset>
</anchored>
<noreset />
<invisible />
</numberfield>
One thing I'm not 100% clear on is whether the CT is looking for a sheet control called "hp" or a DB node. If the latter, I guess I could put an onValueChanged call on my HP field that would write the new value into a DB node at the root of the character? Would that work? And if so, would it be horribly ghetto and a bad idea? It doesn't seem like a "best practice" sort of solution but I'm a bit over my head messing with the CT anyway so I'm willing to do whatever works for now :P
Or would there be an easier/better way to tackle this problem?
I'm trying to get a combat tracker working with the ruleset I've been putting together, but am running into a problem. For NPC entries, the values for things like HP are stored in the root of the object as "hp," which seems to be what the combat tracker is looking for, so for NPCs the HP value populates automatically when I drag an NPC into the tracker. So far, so good.
But for PCs, I have the HP value stored another layer or two deep in the database, and it has a slightly different name than just "hp." As a result, the combat tracker is not wanting to pick up values for PC HPs when I drag them in, and instead it just gives me a blank box with the chain links icon.
What is the best way to resolve this? I was thinking that maybe I could add an invisible control to the character sheet that is set with its source to be the DB node that contains player current HP. The idea being that this would be basically a "shortcut" to the HP and maybe the combat tracker would be able to reference the HP value through that. I set that up like this, but it doesn't seem to work:
<numberfield name="hp" source=".stats.Health.pool">
<anchored>
<to>hpframe</to>
<position>insidetopright</position>
<offset>0,0</offset>
</anchored>
<noreset />
<invisible />
</numberfield>
One thing I'm not 100% clear on is whether the CT is looking for a sheet control called "hp" or a DB node. If the latter, I guess I could put an onValueChanged call on my HP field that would write the new value into a DB node at the root of the character? Would that work? And if so, would it be horribly ghetto and a bad idea? It doesn't seem like a "best practice" sort of solution but I'm a bit over my head messing with the CT anyway so I'm willing to do whatever works for now :P
Or would there be an easier/better way to tackle this problem?