View Full Version : 4e ruleset to SWSE ruleset (armor check penalty modifier/widget)
gandhi39
February 20th, 2012, 19:03
Hello, my friends.
I'm working on my own Star Wars RPG SE (house-ruled) ruleset by modifying the 4E ruleset (release 20) that comes with FG 2.8.1.
I don't know much about XML and Lua editing, but I managed to do some things, like changing the skills list on the character sheet.
But I'm stuck when it comes to customising armor check penalty modifiers and widgets.
On charsheet_skills.xml we have a script function that goes like this:
function onSourceValue(source, sourcename)
if sourcename == "trained" then
if source.getValue() == 1 then
return 5;
end
return 0;
elseif sourcename == "...encumbrance.armorcheckpenalty" then
if StringManager.contains({"strength", "dexterity", "constitution"}, window.statname.getStringValue()) then
return math.min(source.getValue(), 0);
end
return 0;
end
return super.onSourceValue(source, sourcename);
end
On charsheet_skillisitem.lua we have a function that goes like this:
function onStatNameUpdate()
stat.update(statname.getStringValue());
if StringManager.contains({"strength", "dexterity", "constitution"}, statname.getStringValue()) then
armorwidget.setIcon("indicator_armorcheck");
else
armorwidget.setIcon(nil);
end
end
I believe that makes all "strength", "dexterity" and "constitution" associated skills to have the armorcheck widget and the armorcheck penalty applied.
The thing is: on my house rules armorcheck penalty (as long as the widget) does not apply to Pilot (dex), and armorcheck penalty applies to Use the Force (cha). And I haven't been able to put on these exceptions.
Adding "charisma" to the lists and adjusting data_common.lua as below did not solve the problem:
-- Skill properties
skilldata = {
["Acrobatics"] = {
stat = "dexterity",
armorcheckmultiplier = 1
},
["Athletics"] = {
stat = "strength",
armorcheckmultiplier = 1
},
["Deception"] = {
stat = "charisma",
armorcheckmultiplier = 0
},
["Endurance"] = {
stat = "constitution",
armorcheckmultiplier = 1
},
...
["Persuasion"] = {
stat = "charisma",
armorcheckmultiplier = 0
},
["Pilot"] = {
stat = "dexterity",
armorcheckmultiplier = 0
},
["Ride"] = {
stat = "dexterity",
armorcheckmultiplier = 1
},
["Stealth"] = {
stat = "dexterity",
armorcheckmultiplier = 1
},
...
["Use the Force"] = {
stat = "charisma",
armorcheckmultiplier = 1
}
Can anyone help me?
gandhi39
February 20th, 2012, 19:18
It would be great if, when filling in the sheet at the game, I could choose which skill has armorcheck penalty by clicking a widget.
Moon Wizard
February 20th, 2012, 19:52
You could make a widget to do that, but you would need to add a field to track the information and a control to manipulate the field.
You can try looking at the 3.5E skills code, since the armor check penalties for 3.5E are tied to the individual skill instead of the attribute used.
Cheers,
JPG
gandhi39
February 21st, 2012, 00:34
Thanks for the reply. I managed to work around my checkpenalty and checkpenalty widget problems by mixing bits from 4E and 3.5E.
gandhi39
February 21st, 2012, 07:55
I have a new question...
Consider the following script: ("classskill" and "trained" are checkboxes, and named as sources for the script)
<script>
function onSourceValue(source, sourcename)
if sourcename == "classskill" then
if source.getValue() == 1 then
return 3;
end
return 0;
elseif sourcename == "trained" then
if source.getValue() == 1 then
return 5;
end
return 0;
end
return super.onSourceValue(source, sourcename);
end
</script>
If, for "trained", I want a return = character level (instead of return 5) or = half character level (instead of return 0), how would I script that?
gandhi39
February 24th, 2012, 06:12
How can I make a checkbox (as by the original template and script from the 4E ruleset) return the value of another control (such as "levelbonus") instead of the usual "1"? Someone help me, please!
Moon Wizard
February 24th, 2012, 06:31
You would have to get the database node of the character, and look up the information in the database for the character.
Example: To get the level of the character from a field within a specific skill window, you could use:
window.getDatabaseNode().getChild("...level").getValue();
or
NodeManager.get(window.getDatabaseNode(), "...level", 0);
* The window.getDatabaseNode() will return the database node of the specific skill within the character record.
* The getChild("...level") will go up 2 levels in the database (skill list, then top of the character record), then it will access the level field of the character record.
* Finally, the getValue() call returns the value of the level field entry in the database.
* The NodeManager.get function just wraps some of that functionality up in a nice function, plus provides a way to specify a default value in case the field does not exist in the database.
Hope that helps,
JPG
gandhi39
February 24th, 2012, 07:25
Thanks. Sounds hard, but I'll give it a try.
gandhi39
February 24th, 2012, 17:00
Thanx, it worked!
gandhi39
December 29th, 2017, 18:02
After years I restarted my project of making a starwars saga ruleset based on the 4E ruleset. Back then it whas 2.8.1 (2012). Now it's 3.3.3 (2017). The 4E ruleset changed a bit, and my problem comes back requiring a new solution. The 3.5E changed too.
The 4E ruleset ignores the "armorcheckmultiplier" skill property on data_common.lua.
How can I make it not ignore "armorcheckmultiplier" for a charisma based skill like "Use the Force"?
gandhi39
December 29th, 2017, 18:14
*** Code from "char_skill.lua" ***
function onStatUpdate()
stat.update(statname.getStringValue());
if StringManager.contains({"strength", "dexterity", "constitution"}, statname.getStringValue()) then
armorwidget.setIcon("char_armorcheck");
else
armorwidget.setIcon(nil);
end
end
*** Code from "template_char.xml" ***
<template name="number_charskilltotal">
<number_linked>
<frame name="fieldlight" offset="7,5,7,5" />
<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 source.getValue() == 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(source.getValue(), 0);
end
return 0;
end
return super.onSourceValue(source, sourcename);
end
function action(draginfo)
local nodeWin = window.getDatabaseNode();
if nodeWin then
local rActor = ActorManager.getActor("pc", nodeWin.getChild("..."));
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>
</template>
*** Code from "manager_char.lua" ***
function getSkillValue(rActor, sSkill)
local nValue = 0;
local sType, nodeActor = ActorManager.getTypeAndNode(rActor);
if sType == "pc" then
local nodeSkill = nil;
for _,vNode in pairs(DB.getChildren(nodeActor, "skilllist")) do
local sName = DB.getValue(vNode, "label", "");
if sName == sSkill then
nodeSkill = vNode;
break;
end
end
if nodeSkill then
local nLevel = DB.getValue(nodeSkill, "...levelbonus", 0);
local nAbility = DB.getValue(nodeSkill, "stat", 0);
local nMisc = DB.getValue(nodeSkill, "misc", 0);
nValue = nLevel + nAbility + nMisc;
local nTrained = DB.getValue(nodeSkill, "trained", 0);
if nTrained == 1 then
nValue = nValue + 5;
end
local sAbility = DB.getValue(nodeSkill, "statname", "");
if StringManager.contains({"strength", "dexterity", "constitution"}, sAbility) then
local nACPenalty = DB.getValue(nodeSkill, "...encumbrance.armorcheckpenalty", 0);
nValue = nValue + math.min(nACPenalty, 0);
end
else
local rSkill = DataCommon.skilldata[sSkill];
if rSkill then
if rSkill.stat then
nValue = nValue + ActorManager2.getAbilityBonus(rActor, rSkill.stat);
end
if rSkill.armorcheckmultiplier then
local nArmorCheckPenalty = DB.getValue(nodeActor, "encumbrance.armorcheckpenalty", 0);
nValue = nValue + (nArmorCheckPenalty * (tonumber(rSkill.armorcheckmultiplier) or 0));
end
end
end
end
return nValue;
end
damned
December 29th, 2017, 23:28
Without looking at the code - if the 4E ruleset is your base and the 4E ruleset ignores armorcheckmultiplier why dont you remove it and work out how to apply something similar for the Force attack.
How much automation are you working towards?
How will the system know you are using a Force Attack?
gandhi39
December 29th, 2017, 23:40
Without looking at the code - if the 4E ruleset is your base and the 4E ruleset ignores armorcheckmultiplier why dont you remove it and work out how to apply something similar for the Force attack.
How much automation are you working towards?
How will the system know you are using a Force Attack?
My intent is to manage the "Use the Force" skill from the "skills" tab of the character sheet, not from the "powers" tab. I could type the check penalty manually on the "misc" space but, as the ruleset already calculates it for Str/Dex/Con skills, having that also for Use the Force would be handy. In my house rules "Use the Force" suffers armor penalty, although it is based on charisma.
gandhi39
December 30th, 2017, 00:42
Among the code we see:
elseif sourcename == "...encumbrance.armorcheckpenalty" then
if StringManager.contains({"strength", "dexterity", "constitution"}, DB.getValue(window.getDatabaseNode(), "statname", "")) then
return math.min(source.getValue(), 0);
end
return 0;
end
Is there a way to say: if sourcename == "...encumbrance.armorcheckpenalty" then if the skill name is "Use the Force" then return math.min(source.getValue(), 0) ?
Something like that
Powered by vBulletin® Version 4.2.1 Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.