Combat Tracker: where would code that initializes NPC fields go?
Yet another CT question.
A bit of background. I’m in the process of writing an extension, to the Basic Roleplaying ruleset, adding support for “strike ranks” (SR). So far, I have modified the PC sheet and the NPC sheet. Both now handles and updates SR as per the rules. Now I’m working on making entries on the CT handle and update SR as required. Linking PC sheets was easy, I just modified the function linkPCFields() in ct/ct_entry.lua. Getting NPC records to work has been more troublesome.
NPC records are copied to the CT, as I understand it, and my problem is where to put the code that initializes and updates the variables used to set up SR. Currently, the code is in ct/ct_entry.lua. But it seems like the NPC node isn’t 100% copied, DB nodes that exists in the NPC node are not available in the CT node until the ruleset is reloaded.
I’ve tried to add an onDrop function, but it didn’t have any effect, as far as I can tell.
What kind of code and where would I put it to make sure that a given node is created and populated or copied from the NPC node?