Trenloe
June 26th, 2013, 16:09
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:
Ruleset modification guide: https://www.fantasygrounds.com/modguide/
Anatomy of a ruleset : https://www.fantasygrounds.com/filelibrary/community/Anatomy_of_a_Ruleset.pdf A bit dated now, but a lot of things are still relevant.
Ruleset Reference: https://www.fantasygrounds.com/refdoc/
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/modguide/introduction.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/index.php/Developer_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.
As always, the guides in the library section of the FG site are good places to start:
Ruleset modification guide: https://www.fantasygrounds.com/modguide/
Anatomy of a ruleset : https://www.fantasygrounds.com/filelibrary/community/Anatomy_of_a_Ruleset.pdf A bit dated now, but a lot of things are still relevant.
Ruleset Reference: https://www.fantasygrounds.com/refdoc/
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/modguide/introduction.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/index.php/Developer_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.