PDA

View Full Version : Modification Tutorial



Goblin-King
December 9th, 2004, 17:54
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:


<includefile source="rulesets\d20\charsheet.xml" />
to (replace with the name of your ruleset):


<includefile source="rulesets\Goblin-King's Rules\charsheet.xml" />
Open your charsheet.xml. What we're going to do is change the description (the text used when you use this number as a modifier e.g. with a die roll) of the fortitude save field from "Fort. save" to "Fortitude save". Do a search for 'text="Fort. save"'. Type in "Fortitude" in place of the abbreviated form. Save, launch FG and create a character. Drag the fortitude save total field onto the modifier stack and roll.

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...

Goblin-King
December 10th, 2004, 10:24
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:

<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>


Here's a brief explanation, broken into parts:

<root>
</root>


Every XML file imported by FG has the root tags defined, just include them in every separate file you use.


<node name="houserule">
</node>


This part tells FG that we are dealing with a node in the database with no real content in it, but that content nodes follow below. The main purpose of the first level data node such as this one, is to group data into a certain bunch for use in a particular sheet. Other examples of top level nodes are "npc" and "charsheet". As an advanced exercise, you can find the window class definition in the "rulesets\d20\d20_reference.xml" file, but for now, it's enough to know that "houserule" is the right one for this particular purpose.


<node name="00001">
</node>


This is a second level node. The purpose of these is to sort out the individual elements to be displayed on separate sheets of the same type. It doesn't really matter what the name of the node is, as long as it is different from all the others in this branch (i.e., unique under "houserule").


<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>


Here we have two data fields, that are displayed on the house rule sheet. The first, "name", is the title of the sheet, displayed in its own little box. This is also what appears on the houserule list in the reference book.

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):


<staticdata source="rulesets\Goblin-King's Rules\houserules.xml" />

The contents of the entry will now be displayed in the d20 reference book inside Fantasy Grounds, under the Houserules title. Clicking the entry will open a sheet with the data you entered.

Stuart
November 27th, 2005, 16:33
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

Lord Robert of Worcester
November 27th, 2005, 20:00
THe coding is beyond the understanding of a lpeabian like me.
two, I only have the player version of the game

Toadwart
November 28th, 2005, 00:47
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 . . .)

Stuart
November 28th, 2005, 07:20
Actually I have partially solved this .. the answer was so obvious that I'm too ashamed to admit what the solution was !

Stuart :oops:

Toadwart
November 28th, 2005, 08:16
:oops: :oops:
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!

Morfedel
January 28th, 2006, 16:04
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!

Stuart
January 28th, 2006, 18:24
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

Morfedel
January 29th, 2006, 03:54
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.

Stuart
January 29th, 2006, 10:59
Send me a pm or give me some more detail - my xml skills are probably the same as yours but I've dug deep into the srd structure so can help here if you need.

Quithion
February 1st, 2006, 00:46
Is it possible to export a Excel Character sheet that I have created to Overide the current character sheet as long as I export it to XML?

Bumamgar
February 2nd, 2006, 16:29
It's not quite that simple.

XML is just a data formatting language. Each application interprets the data contained in the XML document differently.

Also, Fantasy Grounds uses a combination of XML and images to build UI elements.

danielpryor
February 7th, 2006, 04:59
if you guys download the zd20 ruleset and use the excell macros to export data, then you can create monsters, spells, etc. that the program can see. However, that said, it's just as easy to use wordpad and edit the .xml file directly, it's really not that difficult.

Callum
March 2nd, 2006, 11:41
I'm going to start this thread as an introduction into creating and modifying rulesets for use with Fantasy Grounds.
Thanks for that, GK! I was wondering how you can change the images that FG uses, though. For example, I've edited the png file of the Skills tab on the character sheet to show which skills can't be used untrained. I've saved my new version as "charsheet_skills.png" in the "frames" folder of both the d20 ruleset (renaming the original "_old") and my custom ruleset, but when I run FG I still see the old sheet, no matter which ruleset I use. How can I make FG see my new image?

Callum
March 2nd, 2006, 11:43
Also, can I "convert" a campaign that I've been running under the d20 ruleset to run under my new, custom ruleset?

Snikle
March 6th, 2006, 18:28
Thanks for that, GK! I was wondering how you can change the images that FG uses, though. For example, I've edited the png file of the Skills tab on the character sheet to show which skills can't be used untrained. I've saved my new version as "charsheet_skills.png" in the "frames" folder of both the d20 ruleset (renaming the original "_old") and my custom ruleset, but when I run FG I still see the old sheet, no matter which ruleset I use. How can I make FG see my new image?

Did you load this updated file into the d20 ruleset folder? If you change the name of the file, I think there is a 'base.xml' file that lists specific files to be used. Check there, most the variables are named intutively, so it is not too hard to figure out what variables go with what images. I have gone through and changed nearly every image in a ruleset I am making.

Callum
March 8th, 2006, 12:07
If you change the name of the file, I think there is a 'base.xml' file that lists specific files to be used.
Thanks - I found the file I needed, called "d20_graphics.xml".

Callum
March 8th, 2006, 12:11
Also, can I "convert" a campaign that I've been running under the d20 ruleset to run under my new, custom ruleset?
I think I've found the answer to this question. In the campaign folder, there's a file called "campaign.xml" with a line that reads:

<ruleset name="d20" />

If I change this to the name of my custom ruleset, then run FG and load the campaign, it seems to use my ruleset. Simple! However, I'm worried that this might cause problems when my players connect to continue the game - does anyone know if this is so?

joeru
March 8th, 2006, 17:51
I think I've found the answer to this question. In the campaign folder, there's a file called "campaign.xml" with a line that reads:

<ruleset name="d20" />

If I change this to the name of my custom ruleset, then run FG and load the campaign, it seems to use my ruleset. Simple! However, I'm worried that this might cause problems when my players connect to continue the game - does anyone know if this is so?

You might want to tell each player to modify the ruleset name in file "clientsession.xml" in their campaign directory so that it corresponds to yours. I think, but am not certain, that that's the only place where it could glitch.

qschill
April 6th, 2006, 10:06
I never realized how much you could do with this... I got it the first time around and understand it. I'm excited at the prospects and think I'm going to create a custom ruleset for White Wolf Storyteller games...Just gotta figure out what I can "Legally" put in it so that it can be publically distributed... same for GURPS too...

The Wanderer
April 6th, 2006, 15:36
Check out "OGL question" in The Workshop. It's got a lot of good detail on TM and Copyright information.

I'm also working on WW Storyteller stuff so let me know if you'd like to collaborate!

Rhaegys
June 1st, 2006, 11:25
Hi... Is there a description of the structure of each xml file?

I mean which tags can be use and what does it means each of them?

Thanks,
Rhae

quixote23
June 2nd, 2006, 07:53
Check out "OGL question" in The Workshop. It's got a lot of good detail on TM and Copyright information.

I'm also working on WW Storyteller stuff so let me know if you'd like to collaborate!

Hey, I'd love to take a look at your Storyteller rulesets... Or even help out, if you need it. I'm not much on getting into the guts of modification at this stage, but I don't mind doing grunt work if you need a hand with it. I'd do my own ruleset from scratch, but for some reason I can't seem to get my mods to run properly...

Undeadninjas
August 3rd, 2006, 08:39
This is a quite awesome program, I enjoy it quite a bit. However, I have but one minor... issue shall we say. Though not entirely opposed to 3rd edition, I much prefer 2nd edition D&D. And as such, when I found the "ruleset" folder, I figured I could recreate 2nd edition using Fantasy Grounds. After fiddling with it for a couple hours, I've discovered I havn't the slightest idea how to get it to work as such. So, my main quandary is this.
How would I set it so that it uses a custom graphic for a character sheet, rather than the one used with the D20 ruleset?

I found the line of code claiming <includefile source="rulesets\d20\d20_graphics.xml" />, however, upon further inspection I discovered the file this line referrs to doesn't exist. This confuses me, if someone could give me an answer it would be... shall we say, most awesome!

tdwyer11b
August 3rd, 2006, 09:39
Though not entirely opposed to 3rd edition, I much prefer 2nd edition D&D.

Fortunately for you, it's already been done!!

http://img238.imageshack.us/img238/8393/screenshot0005hq3.png

joshuha
August 3rd, 2006, 15:13
This is a quite awesome program, I enjoy it quite a bit. However, I have but one minor... issue shall we say. Though not entirely opposed to 3rd edition, I much prefer 2nd edition D&D. And as such, when I found the "ruleset" folder, I figured I could recreate 2nd edition using Fantasy Grounds. After fiddling with it for a couple hours, I've discovered I havn't the slightest idea how to get it to work as such. So, my main quandary is this.
How would I set it so that it uses a custom graphic for a character sheet, rather than the one used with the D20 ruleset?

I found the line of code claiming <includefile source="rulesets\d20\d20_graphics.xml" />, however, upon further inspection I discovered the file this line referrs to doesn't exist. This confuses me, if someone could give me an answer it would be... shall we say, most awesome!

If you ever cannot find a referenced file it is most likely in the resource.pak file. These are the actual master files Fantasy Grounds uses when it boots up for its default d20 ruleset. The d20 ruleset provided in the ruleset is ONLY an example and you will notice unless you rename it and create a campaign on that ruleset none of your changes will really impact the game.

You can use an ZIP program to open the resource.pak or there is a utility in your Fantasy Grounds folder called unpak.exe. Have fun.

Hal
September 4th, 2006, 10:02
Hi Guys,
I'm considering possibly purchasing the software here for my own use. Sadly, I'm not a D20 player, but a GURPS player. I'm not afraid to train myself in the use of XML (I don't know it as yet, but I suspect that I may as well learn it now dang it all). My question is this - how easy or difficult is it to convert FG for use with GURPS?

Judge Larry
August 25th, 2008, 21:26
Environment: FG2.0.12 on Vista SP1.

Hello,

I want to write my own ruleset for a non-D20 game. I'm learning about the process by working with the tutorials that are published. From go, I'm having problems. I get the error message, "Could not load included file bmpfonts.xml"

1. I created a folder under C:\Users\%UserName%\AppData\Roaming\Fantasy Grounds II\rulesets\

2. I copied the base.xml file from the extracted D20 ruleset.

3. I started a new campaign using the new ruleset.

4. The error pops-up.

Foen
August 25th, 2008, 23:32
The best way to start is to copy the entire d20 ruleset into your own directory (say my20). Taking just one or two files is liekly to cause a problem.

I think the issue in this case is that base.xml looks for (and 'includes') bmpfonts.xml, among others. If your custome ruleset doesn't have bmpfonts.xml and you haven't commented it out of base.xml, the new ruleset will fail to find the file.

Hope that helps

Stuart

Blue Haven
August 27th, 2008, 12:32
Fortunately for you, it's already been done!!

http://img238.imageshack.us/img238/8393/screenshot0005hq3.png

Is that for FG2 or for FG1?
Thanks