-
November 30th, 2014, 03:40 #11
Is the <number_ct_crosslink> template usable for multiple datasources? eg I can use it for Wounds and Armour Rating?
You are correct - you roll from the Character Sheet but its not storing it there.
So if I change that Im going to have to unpick some of what we did last time maybe...
I have to work out how the Character Sheet can connect to the right Actor in the Combat Tracker....
-
November 30th, 2014, 03:49 #12Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
November 30th, 2014, 11:43 #13
I have started to redo the Initiative based on the C&C version. As you said it does not store INIT in the Character Sheet side of the DB. It works in that INIT rolls automatically update the CT. I changed the Dice to roll 2d10 instead of 1d10.
Im really stuck with the syntax to reference the Characters SPEED-TEMP and ARMOUR-PENALTY from the Character Sheet. Previously we ran the INIT script inside the record_char_combat.xml so we could reference window records. Now I need to reference the database for records belonging to the current actor and Im lost.
Ive rolled record_char_combat.xml back to:
Code:<number_charinit name="initiative" source="initiative.total"> <anchored to="initframe" position="insidetopleft" offset="85,17" width="32" height="20" /> </number_charinit>
Code:<!-- Begin Init Roll --> <template name="number_charinit"> <number_chartotal> <rollable /> <displaysign /> <tooltip><text>Initiative. Double Click to Roll. 2d10+Speed. Highest Initiative Acts First.</text></tooltip> <modifiersize>mini</modifiersize> <description textres="initiative" /> <modifierfield>initiative.temporary</modifierfield> <source><name>initiative.misc</name><op>+</op></source> <script> function action(draginfo) local rActor = ActorManager.getActor("pc", window.getDatabaseNode()); ActionInit.performRoll(draginfo, rActor); return true; end function onDragStart(button, x, y, draginfo) return action(draginfo); end function onDoubleClick(x,y) return action(); end </script> </number_chartotal> </template> <!-- End Init Roll -->
I adjusted the dice here but based on what we did last time I need to retrieve SPEED-TEMP and ARMOUR-PENALTY from the DB and set nMod or rRoll.nMod = nSpeedTemp - nArmourPenalty
But first I need to retrieve those.
Looking at linkPCFields() in CoreRPG there is only 1 entry:
Code:function linkPCFields() local nodeChar = link.getTargetDatabaseNode(); if nodeChar then name.setLink(nodeChar.createChild("name", "string"), true); end end
Code:function linkPCFields() local nodeChar = link.getTargetDatabaseNode(); if nodeChar then name.setLink(nodeChar.createChild("name", "string"), true); hp.setLink(nodeChar.createChild("hp.total", "number")); hptemp.setLink(nodeChar.createChild("hp.temporary", "number")); nonlethal.setLink(nodeChar.createChild("hp.nonlethal", "number")); wounds.setLink(nodeChar.createChild("hp.wounds", "number")); init.setLink(nodeChar.createChild("initiative.total", "number"), true); move.setLink(nodeChar.createChild("speed.total", "number"), true); bth.setLink(nodeChar.createChild("attackbonus.base", "number"), true); ac_final.setLink(nodeChar.createChild("ac.totals.general", "number"), true); ac_flatfooted.setLink(nodeChar.createChild("ac.totals.flatfooted", "number"), true); ac_touch.setLink(nodeChar.createChild("ac.totals.touch", "number"), true); sr.setLink(nodeChar.createChild("defenses.sr.total", "number"), true); end end
ct-name.setLink(nodeChar.createChild("db.xml entry", "number"));
If so Ive added these thee lines
Code:-- Damian Values armourrating.setLink(nodeChar.createChild("ac.totals.penalty", "number")); speedtemp.setLink(nodeChar.createChild("speed.temp", "number")); mywounds.setLink(nodeChar.createChild("wounds.wtotal", "number"));
-
November 30th, 2014, 15:44 #14
Do one thing at a time. Forget about the linked fields for now they have nothing to do with rolling INIT.
In the C&C manager_action_init.lua file, look at the performRoll function. The lines after -- Determine the modifier to use for this roll get the relevant fields from the character sheet section of the database to be applied as a modifier. Change these entries to use the database fields and logic required from your ruleset.Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
November 30th, 2014, 20:52 #15
Ok - so those strings are only doing the Linking/Monitoring...
I need a pointer on accessing the DB values for the characters:
this uses the notifyApplyInit function at the end of the result handler onResolve to send the init result to the GM (via OOB messaging) to be added to the combat tracker initresult field using DB.setValue(ActorManager.getCTNode(rSource), "initresult", "number", nTotal);
I can see an example fo a DB.getValue here:
local sAbility = DB.getValue(vSkill, "attribute", "");
Im after an attribute - speed-temp - is this correct in that situation?
local sSpeed = DB.getValue(vSkill, "speed.temp", "");
-
December 1st, 2014, 01:05 #16
DB.getValue is described here: https://www.fantasygrounds.com/refdoc/DB.xcp#getValue
You'll need to look at your database structure to find out exactly what you need to use for the subpath parameter. The best way to do this is to create a couple of PCs in a campaign and open the campaign db.xml file and look under <charsheet> for example records.
If you have the source actor record (say this is stored in nodeActgor), then you should be able to use DB.getValue(nodeActor, <Name of the database field>, 0); to get the value of the <name of the database field> from your <charsheet><id-0000X> character sheet database record.
This is shown in the performRoll function in the C&C manager_action_init.lua script, as mentioned in one of my posts above.Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
December 1st, 2014, 01:22 #17
I know... Im just pretty thick when it comes to this programming thingamyjig.
I have that page in my list of Start pages in my browser.
In the DB the record looks like this:
Code:<speed> <holder name="Dark Dweller" owner="true" /> <score type="number">40</score> <temp type="number">44</temp> <used type="number">0</used> </speed>
Code:<abilities> <speed> <holder name="Dark Dweller" owner="true" /> <score type="number">40</score> <temp type="number">44</temp> <used type="number">0</used> </speed> </abilities>
I would use local nSpeed = DB.getValue(nodeActor, "abilities.speed.temp", 0)?
-
December 1st, 2014, 01:42 #18Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
December 1st, 2014, 01:50 #19
ok.... so next dumb question... how do I execute this?
I tried just inserting the following code into manager_action_init.lua inside function performroll where other actions were taking place:
Code:local sSpeed = DB.getValue(nodeActor, "abilities.speed.temp", 0) Debug.console("sSpeed = " .. sSpeed);
-
December 1st, 2014, 03:15 #20
Assuming that manager_action_init.lua is registered as a global script called "ActionInit" then it will be executed with: ActionInit.performRoll(draginfo, rActor);
Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks