Modifying the CoreRPG ruleset
This thread is a place to put info regarding modifications to the Fantasy Grounds (FG) 3.0 CoreRPG 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.
Note: This thread freqently refers to the <FG App Data Folder> - this is a directory on your hard drive where Fantasy Grounds stores all of its data. It can be reached by clicking the "Open data folder" icon in the top right of the main FG startup screen (above the version number).
A few steps to do before getting started:- Get the CoreRPG.pak file from the Fantasy Grounds <FG App Data Directory>\rulesets directory. Rename to .zip and extract to the same directory (<FG App Data Directory>\rulesets directory) so that you have a CoreRPG directory. Rename this to something like CoreRPG_DEV. This will allow you to create a new campaign, with the ruleset name CoreRPG_DEV and so you can modify the files in this ruleset and test, without impacting the normal CoreRPG rules. Do not leave the directory called CoreRPG as this will result in you still using this folder even after future updates to Fantasy Grounds.
- 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 in the Developer Guides section of the Wiki: https://www.fantasygrounds.com/wiki/...veloper_Guides.
- 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 CoreRPG_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 or layered ruleset - 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 timestamp in your operating system File Explorer.
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.
Additional details on actions (dice rolls) here: https://www.fantasygrounds.com/forum...(dice-rolling)