MadBeardMan
September 23rd, 2018, 18:12
Greetings all,
I've got a list of attacks all storing the various 'numbers' that are used to build up the final attack.
However when I'm trying to use 'onSourceUpdate' I'm not able to link the nodes local fields.
<source>
<name>skillDM</name>
<op>+</op>
</source>
<source>
<name>characteristicDM</name>
<op>+</op>
</source>
<script>
function onSourceUpdate(source)
local nValue = calculateSources();
setValue(nValue);
end
</script>
The XML is stored as such:
<id-00013>
<holder name="Greg" owner="true" />
<ammocost type="string">15</ammocost>
<attack type="number">2</attack>
<auto type="string">6</auto>
<characteristic type="string">dex_mod</characteristic>
<characteristicDM type="number">1</characteristicDM>
<cost type="string">1,000</cost>
<damage type="string">3d6</damage>
<heft type="number">0</heft>
<isidentified type="number">1</isidentified>
<magazine type="number">40</magazine>
<mass type="number">3</mass>
<name type="string">Advanced Combat Rifle</name>
<notes type="formattedtext">
<p>The ultimate evolution of the conventional firearm, advanced combat rifles are the weapon of choice for many military units. Standard equipment includes an electronic battlefield sight, incorporating both light amplification and IR abilities (see page 96), visual magnification up to 5x zoom, and a laser range finder which may also be used as a target painting device (reveals exact distance to target). The weapon is also gyroscopically stabilised during firing (as a gyroscopic stabiliser, already included in the stats).</p>
</notes>
<range type="string">Ranged (rifle)</range>
<ranged type="number">1</ranged>
<recoil type="number">0</recoil>
<recordtype type="number">9</recordtype>
<shortcut type="windowreference">
<class>item</class>
<recordname>....inventorylist.id-00024</recordname>
</shortcut>
<skill type="string">Gun Combat (Slug Rifle)</skill>
<skillDM type="number">2</skillDM>
<skilllink type="string">charsheet.id-00002.skilllist.id-00012</skilllink>
<subtype type="string">Slug Throwers</subtype>
<tl type="number">10</tl>
<type type="string">Weapon</type>
</id-00013>
The idea is if a skill is changed in value, or a characteristic then their DM's are updated, which then causes the attack value to be recalculated, however I can't seem to attach it to the local node fields.
Can anyone point out what I'm doing wrong?
Cheers,
MBM
I've got a list of attacks all storing the various 'numbers' that are used to build up the final attack.
However when I'm trying to use 'onSourceUpdate' I'm not able to link the nodes local fields.
<source>
<name>skillDM</name>
<op>+</op>
</source>
<source>
<name>characteristicDM</name>
<op>+</op>
</source>
<script>
function onSourceUpdate(source)
local nValue = calculateSources();
setValue(nValue);
end
</script>
The XML is stored as such:
<id-00013>
<holder name="Greg" owner="true" />
<ammocost type="string">15</ammocost>
<attack type="number">2</attack>
<auto type="string">6</auto>
<characteristic type="string">dex_mod</characteristic>
<characteristicDM type="number">1</characteristicDM>
<cost type="string">1,000</cost>
<damage type="string">3d6</damage>
<heft type="number">0</heft>
<isidentified type="number">1</isidentified>
<magazine type="number">40</magazine>
<mass type="number">3</mass>
<name type="string">Advanced Combat Rifle</name>
<notes type="formattedtext">
<p>The ultimate evolution of the conventional firearm, advanced combat rifles are the weapon of choice for many military units. Standard equipment includes an electronic battlefield sight, incorporating both light amplification and IR abilities (see page 96), visual magnification up to 5x zoom, and a laser range finder which may also be used as a target painting device (reveals exact distance to target). The weapon is also gyroscopically stabilised during firing (as a gyroscopic stabiliser, already included in the stats).</p>
</notes>
<range type="string">Ranged (rifle)</range>
<ranged type="number">1</ranged>
<recoil type="number">0</recoil>
<recordtype type="number">9</recordtype>
<shortcut type="windowreference">
<class>item</class>
<recordname>....inventorylist.id-00024</recordname>
</shortcut>
<skill type="string">Gun Combat (Slug Rifle)</skill>
<skillDM type="number">2</skillDM>
<skilllink type="string">charsheet.id-00002.skilllist.id-00012</skilllink>
<subtype type="string">Slug Throwers</subtype>
<tl type="number">10</tl>
<type type="string">Weapon</type>
</id-00013>
The idea is if a skill is changed in value, or a characteristic then their DM's are updated, which then causes the attack value to be recalculated, however I can't seem to attach it to the local node fields.
Can anyone point out what I'm doing wrong?
Cheers,
MBM