DICE PACKS BUNDLE
Page 2 of 3 First 123 Last
  1. #11
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,678
    Blog Entries
    1
    Quote Originally Posted by Trenloe View Post
    In the Castles and Crusades ruleset see ct\scripts\ct_entry.lua - the linkPCFields() function defines the database links in the charsheet record and ties these with the relevant controls in the combat tracker - the controls have to be defined using the <number_ct_crosslink> template - see the entries in ct\ct_host.xml. Once these links are defined then if the linked field in the database changes then the field in the linked control will be updated.
    Is the <number_ct_crosslink> template usable for multiple datasources? eg I can use it for Wounds and Armour Rating?

    Quote Originally Posted by Trenloe View Post
    That's not how it's done in any of the main FG rulesets (3.5e, Pathfinder, C&C, etc.). Having an initiative total on the character sheet is a waste of space on the character sheet as it is only relevant to an entry in the combat tracker. Yes, a player may roll INIT before being placed in the combat tracker, but this would be a rare occasion - just get them to roll again or manually populate it with the original roll once the PC record is in the combat tracker; this is what all the other main rulesets do.
    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....

  2. #12
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,402
    Quote Originally Posted by damned View Post
    Is the <number_ct_crosslink> template usable for multiple datasources? eg I can use it for Wounds and Armour Rating?
    Yes. Look at the linkPCFields() function I reference above.



    Quote Originally Posted by damned View Post
    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....
    See what I say in post #36 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!

  3. #13
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,678
    Blog Entries
    1
    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>
    And pretty much cut and paste into template_char.xml
    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 -->
    and then in manager_action_init.lua we have lots of stuff...
    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
    whilst in Castles&Crusades there are a dozen...
    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
    Do I need to add my own in here - what is the Syntax? Its quite opaque to me!

    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"));
    Ahhh.... Im so bloody lost!

  4. #14
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,402
    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!

  5. #15
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,678
    Blog Entries
    1
    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", "");
    How do I *know* what to use in place of vSkill? in place of attibute?
    Im after an attribute - speed-temp - is this correct in that situation?
    local sSpeed = DB.getValue(vSkill, "speed.temp", "");

  6. #16
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,402
    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!

  7. #17
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,678
    Blog Entries
    1
    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>
    so it should be speed.temp or does it need more....

    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>
    and so... abilities.speed.temp

    I would use local nSpeed = DB.getValue(nodeActor, "abilities.speed.temp", 0)?

  8. #18
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,402
    Quote Originally Posted by damned View Post
    I would use local nSpeed = DB.getValue(nodeActor, "abilities.speed.temp", 0)?
    Based off the data you've shown, yes.
    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!

  9. #19
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,678
    Blog Entries
    1
    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);
    but I dont get any output or errors...

  10. #20
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,402
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Starfinder Playlist

Log in

Log in