Thread: Modification Tutorial
-
December 9th, 2004, 16:54 #1
Modification Tutorial
I'm going to start this thread as an introduction into creating and modifying rulesets for use with Fantasy Grounds.
Beyond this point, I'm going to assume that- You have installed the ruleset source files (an optional component in the full license installer)
- You have a preliminary familiarity with working with XML files. If you don't, do a quick search on google to find a lot of information on the subject.
To start off, you need to create a new ruleset. The d20 ruleset is protected, and any modifications you might make into the files won't work with the software. The files are there just to serve as examples.
There's a folder called "rulesets" under the FG install folder. Go there, create a new folder, and name it for your ruleset. I'm going to call mine "Goblin-King's Houserules". Go into the "rulesets\d20" folder, and copy the base.xml file from there into your newly created ruleset folder. Now witness the power of this fully operational clone of the d20 rules by starting up FG, creating a new campaign and selecting it from the list of rulesets.
Cool, but not very effective. Now, copy the file "charsheet.xml" from the d20 folder to your ruleset folder. Open up "base.xml" in your ruleset, and change the line:
Code:<includefile source="rulesets\d20\charsheet.xml" />
Code:<includefile source="rulesets\Goblin-King's Rules\charsheet.xml" />
This was pretty basic, but should give you an idea of how to make modifications. What's essential is that everything but the charsheet is still linked to the d20 default content. Whenever someone connects to your session, they'll automatically get the new files (only the new files) and run them.
Coming soon, lesson two...Tero Parvinen
Fantasy Grounds Guru
-
December 10th, 2004, 09:24 #2
Often, it is more convenient to just add data such as custom spells, feats, or other material instead of changing the sheets that display the data. For this example, we're going to be adding a house rule that will be displayed in the d20 reference book.
There's support for this built into the default d20 ruleset, but no content, so we'll get by just adding the information. To do this, a database definition file is needed. Create a file in your ruleset folder (I called mine "houserules.xml"), and open it in your favorite text or XML editor.
Here's what I typed in:
Code:<root> <node name="houserule"> <node name="00001"> <stringvalue name="name" value="Weapons" /> <formattedtext name="text"> <h>The Quarterstaff</h> <p>If proficient with it, you can use the quarterstaff for blocking blows using the rules for the buckler. If you forego the off-hand attack, you get a +1 shield bonus to AC, otherwise, attack with the off-hand as normal, not applying the AC bonus for the round.</p> </formattedtext> </node> </node> </root>
Code:<root> </root>
Code:<node name="houserule"> </node>
Code:<node name="00001"> </node>
Code:<stringvalue name="name" value="Weapons" /> <formattedtext name="text"> <h>The Quarterstaff</h> <p>If proficient with it, you can use the quarterstaff for blocking blows using the rules for the buckler. If you forego the off-hand attack, you get a +1 shield bonus to AC, otherwise, attack with the off-hand as normal, not applying the AC bonus for the round.</p> </formattedtext>
The second, "text" is a formatted text field, which is a bit more complicated. It has a HTML-like syntax, meaning you can format the text inside some special tags. It is different, however, from HTML in that it is picky in the sense that all tags have to be closed, and everything has to be inside a paragraph tag of some sort. In this example, there are two paragraph types used, heading (<h>...</h>) and normal paragraph (<p> ... </p>). If you ever run into trouble getting this right, one option is to write it up in FG into a story book entry first, and then cut and paste the contents from the campaign's db.xml file :roll:
Now that the houserules.xml file is done, it's time to include the data into the ruleset. Open up "base.xml" and add the following line (the location doesn't really matter):
Code:<staticdata source="rulesets\Goblin-King's Rules\houserules.xml" />
Tero Parvinen
Fantasy Grounds Guru
-
November 27th, 2005, 15:33 #3
Is it me ?
I've tried this and it does not work; "House Rules" does not appear when the d20 reference book is clicked and the menu appears ...
Stuart
-
November 27th, 2005, 19:00 #4
Not really helpful
THe coding is beyond the understanding of a lpeabian like me.
two, I only have the player version of the gameNobody has fun til sombody gets hurt
-
November 27th, 2005, 23:47 #5
Hmm, Ill have a look at my custom ruleset when I get home. Should be able to help with getting at least one House Rule entry to appear (couldn't get more than one to appear in the list myself . . .)
-
November 28th, 2005, 06:20 #6
Actually I have partially solved this .. the answer was so obvious that I'm too ashamed to admit what the solution was !
Stuart ops:
-
November 28th, 2005, 07:16 #7
ops: ops:
That goes double for me. I finally figured out why I couldn't get more than one houserule to show up. No matter how I formatted my houserule xml.
Inside d20_reference.xml there is a node called
<windowclass name="referenceroot">
That node has a sub-node that looks like this:
<windowlist class="houserulesmall">
<bounds rect="253,189,200,125" />
</windowlist>
For some reason my ruleset looked like this:
<windowlist class="houserulesmall">
<bounds rect="253,189,200,25" />
</windowlist>
25 is just big enough to show one line of text, but not two ... D'OH!
-
January 28th, 2006, 15:04 #8
- Join Date
- Mar 2005
- Posts
- 671
Speaking of....
I was fooling around with classes.xml. What I wanted to was nest links within links. In other words, have the races link go to a page with a link to an individual page for each race.
So, looking at the xml sheet, and noticing that each link off the main page was nested within a node, as an experiment I nested the human race within a second layer of nodes.
What happened was that the humans disappeared. So apparently, I was incorrect. Is how classes.xml being displayed defined in another xml file, or is it in the core program? If its in another xml file, could someone direct me so I could examine it?
Also, I noticed that when I added additional elements to classes.xml, they would disappear once hitting the bottom. Obviously, they are being contained within a framework that I exceeded (as well as exceeding the graphics). Where is the size of that frame being defined?
I'm an experienced C++ and VB programmer, but my xml, though not beginner level, is a bit weak. So I appreciate the tips in advance (and it also reduces my having to hunt everything down manually, heh )
Thanks!
-
January 28th, 2006, 17:24 #9
I have rudimentary xml skills so beware what I'm about to say !
classes.xml is a file that actually defines what appears when you click the reference book.
Node 2 contains :<link class="reftxt" recordname="humans">Humans</link>
link class (as I understand it) links to a window class definition in d20_reference.xml and defines how to display the data found at the node name="humans" (line 1345 in reftxt.xml).
The size of the frame for the reference book when clicked is (I think ... Toadwart, Ged ?) limited to the size of the png but the text is scrollable. So ... if you add nodes to classes.xml (left side of reference book) OR equipment.xml (right side of reference book and ends with Common Modifiers etc) you can still access them by scrolling.
I hope all this helps ... it has taken me two months and lots of help from bery generous people to get this far, good luck ! Fancy creating a Rolemaster ruleset with 1.06 ?
Stuart
-
January 29th, 2006, 02:54 #10
- Join Date
- Mar 2005
- Posts
- 671
Stuart, thanks for the info thus far. I do know xml, although not at expert level. That helps some.
I'd really like to find how to nest links deeper from the original links off the srd file.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks