STAR TREK 2d20
Page 1 of 4 123 ... Last
  1. #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
    1. You have installed the ruleset source files (an optional component in the full license installer)
    2. 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" />
    to (replace with the name of your ruleset):

    Code:
    <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...
    Tero Parvinen
    Fantasy Grounds Guru

  2. #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>
    Here's a brief explanation, broken into parts:
    Code:
    <root>
    </root>
    Every XML file imported by FG has the root tags defined, just include them in every separate file you use.

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

    Code:
    		<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").

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

    Code:
    <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.
    Tero Parvinen
    Fantasy Grounds Guru

  3. #3
    Stuart's Avatar
    Join Date
    Aug 2005
    Location
    United Kingdom
    Posts
    741
    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

  4. #4

    Not really helpful

    THe coding is beyond the understanding of a lpeabian like me.
    two, I only have the player version of the game
    Nobody has fun til sombody gets hurt

  5. #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 . . .)

  6. #6
    Stuart's Avatar
    Join Date
    Aug 2005
    Location
    United Kingdom
    Posts
    741
    Actually I have partially solved this .. the answer was so obvious that I'm too ashamed to admit what the solution was !

    Stuart ops:

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

  8. #8
    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!

  9. #9
    Stuart's Avatar
    Join Date
    Aug 2005
    Location
    United Kingdom
    Posts
    741
    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

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
FG Spreadshirt Swag

Log in

Log in