-
November 6th, 2010, 00:06 #1
- Join Date
- Apr 2010
- Posts
- 243
Expanding the Stat Bonuses past 102?
I was wondering how hard would it be to expand the Stat bonus progression past 102 (i.e. 103= +40, 104 +45, 105 +50, 106 +55, etc.) I know this can be done by just adding things to the misc. bonus column, but I would also like to expand this so the Development changes, etc.
Pretty limited right now in my .xml knowledge right now, is this incredibly hard? OR, has anyone already done this?
-
November 6th, 2010, 08:07 #2
Modifying Ability Bonuses and DPs
This is quite straightforward by using an extension to override the internal bonus calculation function. Extensions are installed on the GM's machine and then apply to all games where the GM selects the extension at launch.
Anything redefined in an extension overrides the same object defined in the underlying ruleset, and in this example you just need to redefine the object that controls how abilities are laid out on the character sheet (a windowclass called 'abilitywindow'). Although this is a fairly big bit of xml, the modifications are quite minor and I've shown them in red:
Code:<windowclass name="abilitywindow"> <sizelimits> <maximum> <height>20</height> </maximum> <minimum> <height>20</height> </minimum> </sizelimits> <script> function refresh() local tot; bonus.setValue(getBonus(temp.getValue())); tot = bonus.getValue() + race.getValue() + special.getValue(); total.setValue(tot); dp.setValue(getDPs(temp.getValue())); dp.setVisible(getDev()); windowlist.setDPs(); end function getBonus() local val = 0; if not win or not win.temp then return 0; end val = win.temp.getValue(); if val > 99 then return (val-95)*5; elseif val > 97 then return 20; elseif val > 94 then return 15; elseif val > 89 then return 10; elseif val > 74 then return 5; elseif val > 24 then return 0; elseif val > 9 then return -5; elseif val > 4 then return -10; elseif val > 2 then return -15; elseif val > 1 then return -20; else return -25; end end function getDPs(val) if val > 101 then return val-91; elseif val > 99 then return 10; elseif val > 94 then return 9; elseif val > 84 then return 8; elseif val > 74 then return 7; elseif val > 59 then return 6; elseif val > 39 then return 5; elseif val > 24 then return 4; elseif val > 14 then return 3; elseif val > 4 then return 2; else return 1; end end function setDev(status) if status then dev.setValue(1); else dev.setValue(0); end refresh(); end function getDev() return (dev.getValue()~=0); end function onInit() refresh(); temp.getDatabaseNode().onUpdate = refresh; race.getDatabaseNode().onUpdate = refresh; special.getDatabaseNode().onUpdate = refresh; end </script> <sheetdata> <numbercontrol name="order"> <bounds>0,0,0,0</bounds> <invisible/> </numbercontrol> <numberfieldX name="dev"> <bounds>0,0,0,0</bounds> <invisible/> </numberfieldX> <stringfieldX name="label"> <anchored> <position>insidetopleft</position> <offset>0,4</offset> <size> <width>35</width> <height>17</height> </size> </anchored> <font>sheetlabel</font> <static/> </stringfieldX> <numberfieldX name="temp"> <anchored> <position>insidetopleft</position> <offset>40,1</offset> <size> <width>35</width> <height>18</height> </size> </anchored> <font>sheettext</font> <frame> <name>modifier</name> <offset>4,4,4,4</offset> </frame> <keyeditframe> <name>sheetfocus</name> <offset>4,4,4,4</offset> </keyeditframe> <script> function onValueChanged() if getValue() < 0 or getValue() > window.potential.getValue() then setInvalid(); window.potential.setInvalid(); else setValid(); window.potential.setValid(); end end function onInit() if super and super.onInit then super.onInit(); end onValueChanged(); end </script> <tabtarget> <prev>special</prev> <next>potential</next> </tabtarget> </numberfieldX> <numberfieldX name="potential"> <anchored> <to>temp</to> <position>right</position> <offset>5</offset> <size> <width>35</width> </size> </anchored> <font>sheettext</font> <frame> <name>modifier</name> <offset>4,4,4,4</offset> </frame> <keyeditframe> <name>sheetfocus</name> <offset>4,4,4,4</offset> </keyeditframe> <script> function onValueChanged() if getValue() < 0 or getValue() < window.temp.getValue() then setInvalid(); window.temp.setInvalid(); else setValid(); window.temp.setValid(); end end function onInit() if super and super.onInit then super.onInit(); end onValueChanged(); end </script> <tabtarget> <prev>temp</prev> <next>race</next> </tabtarget> </numberfieldX> <numbercontrolX name="bonus"> <anchored> <to>potential</to> <position>right</position> <offset>5</offset> <size> <width>35</width> </size> </anchored> <font>sheettext</font> <frame> <name>modifier</name> <offset>4,4,4,4</offset> </frame> <displaysign/> <readonly/> <hideonvalue>0</hideonvalue> </numbercontrolX> <numberfieldX name="race"> <anchored> <to>bonus</to> <position>right</position> <offset>5</offset> <size> <width>35</width> </size> </anchored> <font>sheettext</font> <frame> <name>modifier</name> <offset>4,4,4,4</offset> </frame> <keyeditframe> <name>sheetfocus</name> <offset>4,4,4,4</offset> </keyeditframe> <displaysign/> <hideonvalue>0</hideonvalue> <tabtarget> <prev>potential</prev> <next>special</next> </tabtarget> </numberfieldX> <numberfieldX name="special"> <anchored> <to>race</to> <position>right</position> <offset>5</offset> <size> <width>35</width> </size> </anchored> <font>sheettext</font> <frame> <name>modifier</name> <offset>4,4,4,4</offset> </frame> <keyeditframe> <name>sheetfocus</name> <offset>4,4,4,4</offset> </keyeditframe> <displaysign/> <hideonvalue>0</hideonvalue> <tabtarget> <prev>race</prev> <next>temp</next> </tabtarget> </numberfieldX> <numberfieldX name="total"> <anchored> <to>special</to> <position>right</position> <offset>5</offset> <size> <width>35</width> </size> </anchored> <font>sheettext</font> <frame> <name>modifier</name> <offset>4,4,4,4</offset> </frame> <readonly/> <displaysign/> </numberfieldX> <numbercontrolX name="dp"> <anchored> <to>total</to> <position>right</position> <offset>5</offset> <size> <width>35</width> </size> </anchored> <font>sheettext</font> <frame> <name>modifier</name> <offset>4,4,4,4</offset> </frame> <readonly/> </numbercontrolX> </sheetdata> </windowclass>
The changed definition then needs packaging up into an extension by adding some enclosing xml, and saving it in a file called extension.xml
Code:<?xml version="1.0" encoding="iso-8859-1"?> <root version="2.0"> <properties> <name>Extended Bonuses</name> <version>1</version> <author>Stuart Woodard</author> <description>Extends ability bonuses beyond 102.</description> <ruleset> <name>RolemasterClassic</name> <minrelease>1</minrelease> </ruleset> </properties> <base> YOUR WINDOWCLASS DEFINITION GOES HERE </base> </root>
Code:<application data directory> +-extensions +-extendedbonus +-extension.xml
Hope that helps
Stuart
-
November 6th, 2010, 23:07 #3
- Join Date
- Apr 2010
- Posts
- 243
This more than helps. Wow thank you!
-
November 7th, 2010, 07:28 #4
If you are having difficulties, you might want to open the log window (type /console in the chat box) and see if there are any errors being reported. You can also add diagnostics to the code using the Lua 'print' command, such as print("line 7"); or print("value is "..value); and you can see which bits of code are executing and why.
Stuart
-
November 7th, 2010, 07:33 #5
I just noticed an error in the code I posted, it was lifted from another routine without me taking enough care. Replace the getBonus() function with the following:
Code:function getBonus(val) if val > 99 then return (val-95)*5; elseif val > 97 then return 20; elseif val > 94 then return 15; elseif val > 89 then return 10; elseif val > 74 then return 5; elseif val > 24 then return 0; elseif val > 9 then return -5; elseif val > 4 then return -10; elseif val > 2 then return -15; elseif val > 1 then return -20; else return -25; end end
Stuart
-
November 7th, 2010, 15:23 #6
- Join Date
- Apr 2010
- Posts
- 243
Thank you so much for all this! I hope to get better at all this, but I am learning.
-
November 7th, 2010, 20:42 #7
- Join Date
- Apr 2010
- Posts
- 243
By the way, you should officially post this. It works very nicely!
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks