Modifying the 3.5e/PFRPG ruleset
This thread is a place to put info regarding modifications to the 3.5e/PFRPG ruleset. It's not meant to be a step-by-step guide, but a resource for people to get info that *might* help them get started on modifying a ruleset or answer some questions they may have, or give info they may never have known.
As always, the guides in the library section of the FG site are good places to start:
Always keep in mind that your best resource for examples is the ruleset itself! If you see something in your game that you think "wouldn't something similar be cool in window XYZ" then look in the ruleset how the functionality is coded and see about using that code for your modification.
A few steps to do before getting started:- Get the 3.5E.pak file from the Fantasy Grounds installation directory (usually Program Files\Fantasy Grounds II). Rename to .zip and extract to the <FG App Data Directory>\rulesets directory - but give it a new directory such as 3.5E_DEV. This will allow you to create a new campaign, with the ruleset name 3.5E_DEV and so you can modify the files in this ruleset and test, without impacting the normal 3.5E rules.
- If you don't already have a preferred good text editor (that includes syntax highlighting for XML and LUA, and has a find in files function) download Notepad++ (free) and add the XML plugin: https://notepad-plus-plus.org/ You can use this for modifying both XML and LUA files - and check the XML syntax with the XML plugin. Also, "Find in Files" is your friend for working out where things are in the ruleset.
- Have a look at the Ruleset Modification Guide - available under the "Library" link at the top of this page.
- Check some of the XML resources mentioned in the FG library: https://www.fantasygrounds.com/modgu...troduction.xcp
- Check the LUA resources too: https://www.fantasygrounds.com/modguide/scripting.xcp
Many links provided in the developer guide Wiki page: https://www.fantasygrounds.com/wiki/...eveloper_Guide
Whichever text editor you use, make sure you utilise "find in files" all of the time, for the whole of the ruleset directory - this is your best way to find all references to specific functionality and to find XML template definitions that are being used. FG XML definitions frequently use nested templates, so make sure you search for all definitions within the ruleset to discover what they are actually defining!
Directly modifying a 3.5E_DEV ruleset as mentioned in point 1 above is a "quick-and-dirty" way to change code. In the long run, you'll want to package your changes as an extension - so keep track of all of the files you modify so you can put these in an extension once complete. You can usually work out which files you modify by the date changed OS timestamp.
Also - it is a good idea to comment any modifications you make in the XML or LUA files - so you know what changes you have made from the base code and why. Just a simple "Modified for XYZ" is a good start.
3.5e ruleset file locations
A few pointers where "stuff" is in the 3.5E ruleset. This is the high level directories - most contain XML files (usually GUI objects and their layout) and associated LUA scripts in the underlying \scripts directory :
- calendar - XML and LUA to do with the calendar. Now in CoreRPG.
- campaign - XML and LUA to do with the campaign side of things, i.e. PCs, Story, Maps & Images, NPCs, Encounters, Items, etc.. Basically, the main icons along the right side of the FG desktop.
- common - commonly used template and scripts. Buttons, lists, toolbars, etc..
- ct - the Combat Tracker.
- desktop - stuff that is on the desktop: chat window, dice tower, modifier stack, etc.
- graphics - all of the graphics used within the ruleset.
- ps - the Party Sheet.
- ref - XML and LUA to do with the library reference (displaying library modules) and the different windows that can be displayed for library reference entries.
- scripts - data_common.lua (contains a lot of 3.5E and Pathfinder relevant data - like skills, effects, abilities, conditions, energy types, immune types, damage types, bonus types, etc., etc.). Also has "manager" scripts - the main code that handles specific functionality within FG - like damage, attacks, initiative, exporting, spells, targeting, etc., etc..
- strings - String resource definitions. Allows for easier changing and translations.
- utility - basically the "stuff" hanging off the small grey icons in the top right of the FG desktop - character list, effects list, tokens, modifiers, options, tables.