5E Product Walkthrough Playlist
  1. #1

    [5e] Get Character Traits

    Does anyone know how you would go about getting a list of traits that a character has if you have the character node? Writing an extension and I need to check to see if a character has the "Powerful Build" trait or not. I have a basic understanding of how to get basic values from character sheets based on the code already in the ruleset but not to familiar with how to get this kind of information.

    Also, what would probably be the best way to to view the structure of a node?

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,406
    Quote Originally Posted by 7H3LaughingMan View Post
    Also, what would probably be the best way to to view the structure of a node?
    Create a character in Fantasy Grounds, then export the character (from the Character Management screen or with /exportchar) and take a look at the resulting XML. This is the FG database structure - info here: https://www.fantasygrounds.com/modguide/database.xcp

    DB and databasenode API references here: https://www.fantasygrounds.com/refdoc/DB.xcp and https://www.fantasygrounds.com/refdoc/databasenode.xcp
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  3. #3
    Quote Originally Posted by Trenloe View Post
    Create a character in Fantasy Grounds, then export the character (from the Character Management screen or with /exportchar) and take a look at the resulting XML. This is the FG database structure - info here: https://www.fantasygrounds.com/modguide/database.xcp

    DB and databasenode API references here: https://www.fantasygrounds.com/refdoc/DB.xcp and https://www.fantasygrounds.com/refdoc/databasenode.xcp
    Thanks for the information, was able to figure it out and came up with the following code.

    Code:
    function checkPowerfulBuild(nodeChar)
    	local traits = DB.getChildren(nodeChar, "traitlist");
    	for k, v in pairs(traits) do
    		if DB.getValue(v, "name", "") == "Powerful Build" then
    			return true;
    		end
    	end
    	return false;
    end

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
  •  
DICE PACKS BUNDLE

Log in

Log in