FG Spreadshirt Swag
  1. #1

    New Ruleset Creation

    Hello,

    I am relatively new to FGU, and I've been working with the code to try to create a custom ruleset for my home game. I started with modifying the WarhammerFRP ruleset, as that is close to what I want.

    I have what I hope is a quick question: how and where are the character ability scores defined in the ruleset code?

    WHFRP has 8 primary abilities: Weapon Skill, Ballistic Skill, etc... And it has a number of derived ability scores like Attack, Strength Bonus, etc...

    For example: I see Ballistic Skill is defined in record_char_main.xml with a source="abilities.ballistic" - does this indicate that there is a data table called abilities with a field called ballistic? Can this be referenced elsewhere, such as when you want to calculate a derived ability based on this number?

    I also see this referenced in manager_char.lua, which apparently has code to tell the application how to handle certain actions. For example:

    Code:
    function addSkill(nodeChar, sClass, sRecord, nodeTargetList)
    	local nodeSource = resolveRefNode(sRecord);
    	
    	local nodeEntry = nodeTargetList.createChild();
    	DB.copyNode(nodeSource, nodeEntry);
        
        local sStat = DB.getValue(nodeSource, "attribute", "");
        local sFocus = "";
    
        if sStat == "Weapon" then
            sFocus ="weapon";
        elseif sStat == "Ballistic" then
            sFocus ="ballistic";
            etc...
        end
        
        DB.setValue(nodeEntry, "statname", "string", sFocus);
    end
    (Some code omitted for brevity...)

    And I see in data_common.lua sections of code that appear to define an abilities table (lots of names of fields).

    This all sort of makes sense to me, and yet I can't seem to grasp how to do this:

    1. Define character ability = Strength
    2. Derive Strength_Bonus (SB) from value of Strength
    3. So, if you enter Strength = 45, then SB = 4


    Does this make sense? Anyone have a brief explanation for how this kind of information is created, stored and manipulated by the ruleset?

    Thanks in advance!

    -Ozmar the Self-Taught Coder

  2. #2

    Join Date
    Apr 2009
    Location
    Fullerton, CA.
    Posts
    625
    Check in the record_char_xp.xml. The stats start there and establish the base and the bonus. Also, the template_char.xml and template_campaign.xml. These two files contain the definitions for several of the xml templates used.

    the .xml files will point to specific lua files. Chase it down that way and you will start to see how the various files and information flows thru the ruleset.

  3. #3
    Thanks! I've been doing that and will continue to do so.

    At present, I am thinking that data_common.lua defines the structure of my basic abilities/character stats, and that the templates contain lua code that defines how those numbers are updated when a player interacts with them, and I create xml pages that display the data and reference those templates. At least, that is how the WHFRP ruleset seems to implement this.

    Appreciate the feedback.

    -Ozmar the Slow Learner

  4. #4
    ozmar, it would be incorrect to see data_common.lua as where things are defined. The data_common.lua is used for reference lists to common data and hardcoding certain behavior. You may see the stats/traits/skills listed here, but just as a reference for the code to pull from to make sure it's uniform. The actual place your stats are defined are in the character sheet. They get sourced to database through that sheet. Clear examples of this are in 5E and 3.5E ruleset (campaign/record_char_main.xml). Templates are a way to define common elements you see within FG. An example would be keeping the same size and look of a number box. This is to help cut down on the xml size and also re-use the same behavior for many elements that you wish to share with each other.
    Dominic Morta
    Ruleset Developer
    Smiteworks

    How to zip up your campaign if the Developers ask for it-How to zip up your campaign if the Developers ask for it

    How to provide an Unity Connection issue?-Connection Issues and What to Provide

    Unity Updater issue?-Updater Issues

    Classic and Unity Port Forwarding?-Fantasy Grounds Connections Explained

    Comcast or Cox ISP User?-Comcast XFinity and Cox Users

    Have a suggestion?-Idea Informer

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
  •  
5E Product Walkthrough Playlist

Log in

Log in