SieferSeesSomething
June 11th, 2025, 05:16
I'm trying to add a new type of bonus that gets added to a character's skill (in addition to their ability score, trained bonus, armor check penalty, and misc bonus) for a DnD 4e extension. I've managed to add the bonus as a new tag to each individual skill in the skill list in the database, but I can't figure out the best way to merge windowclasses or templates or whatever to make that database value get added to the skill total value.
After doing some investigation, here's what I found.
I found record_char_skill.xml. In there, I found the charsheet_skills windowclass and char_skill windowclass. In there, in the sheetdata tag, I found this:
<number_charskilltotal name="total">
<anchored width="44" height="20">
<top offset="2" />
<right parent="rightanchor" anchor="left" relation="relative" offset="-5" />
</anchored>
</number_charskilltotal>
Which led me to this template:
<template name="number_charskilltotal">
<number_linked_framed>
<displaysign />
<rollable />
<hideonvalue>0</hideonvalue>
<source>
<name>stat</name>
<op>+</op>
</source>
<source>
<name>...encumbrance.armorcheckpenalty</name>
<op>+</op>
</source>
<source>
<name>...levelbonus</name>
<op>+</op>
</source>
<source>
<name>trained</name>
<op>+</op>
</source>
<source>
<name>misc</name>
<op>+</op>
</source>
<script>
function onSourceValue(source, sourcename)
if sourcename == "trained" then
if DB.getValue(source) == 1 then
return 5;
end
return 0;
elseif sourcename == "...encumbrance.armorcheckpenalty" then
if StringManager.contains({"strength", "dexterity", "constitution"}, DB.getValue(window.getDatabaseNode(), "statname", "")) then
return math.min(DB.getValue(source), 0);
end
return 0;
end
return super.onSourceValue(source, sourcename);
end
function action(draginfo)
local nodeWin = window.getDatabaseNode();
if nodeWin then
local rActor = ActorManager.resolveActor(DB.getChild(nodeWin, "..."));
local sLabel = DB.getValue(nodeWin, "label", "");
local sStat = DB.getValue(nodeWin, "statname", "");
ActionSkill.performRoll(draginfo, rActor, sLabel, getValue(), sStat);
end
return true;
end
function onDragStart(button, x, y, draginfo)
return action(draginfo);
end
function onDoubleClick(x,y)
return action();
end
</script>
</number_linked_framed>
</template>
Which leads to this template:
<template name="number_linked_framed">
<number_linked>
<frame mergerule="replace" name="fieldlight" offset="7,5,7,5" />
</number_linked>
</template>
So it seems that I need to be able to add a new type of source to that list of sources I bolded above in the number_charskilltotal template under the number_linked_framed. I've tried combinations of merging the windowclass and templates and can't get it to add. Except once, when it added ONLY my bonus, and none of the other bonuses that exist now lol. Any advice is appreciated!
After doing some investigation, here's what I found.
I found record_char_skill.xml. In there, I found the charsheet_skills windowclass and char_skill windowclass. In there, in the sheetdata tag, I found this:
<number_charskilltotal name="total">
<anchored width="44" height="20">
<top offset="2" />
<right parent="rightanchor" anchor="left" relation="relative" offset="-5" />
</anchored>
</number_charskilltotal>
Which led me to this template:
<template name="number_charskilltotal">
<number_linked_framed>
<displaysign />
<rollable />
<hideonvalue>0</hideonvalue>
<source>
<name>stat</name>
<op>+</op>
</source>
<source>
<name>...encumbrance.armorcheckpenalty</name>
<op>+</op>
</source>
<source>
<name>...levelbonus</name>
<op>+</op>
</source>
<source>
<name>trained</name>
<op>+</op>
</source>
<source>
<name>misc</name>
<op>+</op>
</source>
<script>
function onSourceValue(source, sourcename)
if sourcename == "trained" then
if DB.getValue(source) == 1 then
return 5;
end
return 0;
elseif sourcename == "...encumbrance.armorcheckpenalty" then
if StringManager.contains({"strength", "dexterity", "constitution"}, DB.getValue(window.getDatabaseNode(), "statname", "")) then
return math.min(DB.getValue(source), 0);
end
return 0;
end
return super.onSourceValue(source, sourcename);
end
function action(draginfo)
local nodeWin = window.getDatabaseNode();
if nodeWin then
local rActor = ActorManager.resolveActor(DB.getChild(nodeWin, "..."));
local sLabel = DB.getValue(nodeWin, "label", "");
local sStat = DB.getValue(nodeWin, "statname", "");
ActionSkill.performRoll(draginfo, rActor, sLabel, getValue(), sStat);
end
return true;
end
function onDragStart(button, x, y, draginfo)
return action(draginfo);
end
function onDoubleClick(x,y)
return action();
end
</script>
</number_linked_framed>
</template>
Which leads to this template:
<template name="number_linked_framed">
<number_linked>
<frame mergerule="replace" name="fieldlight" offset="7,5,7,5" />
</number_linked>
</template>
So it seems that I need to be able to add a new type of source to that list of sources I bolded above in the number_charskilltotal template under the number_linked_framed. I've tried combinations of merging the windowclass and templates and can't get it to add. Except once, when it added ONLY my bonus, and none of the other bonuses that exist now lol. Any advice is appreciated!