Thread: [5e] Get Character Traits
-
October 31st, 2016, 16:52 #1
- Join Date
- Nov 2013
- Posts
- 55
[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?
-
October 31st, 2016, 17:04 #2
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.xcpPrivate 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!
-
October 31st, 2016, 17:59 #3
- Join Date
- Nov 2013
- Posts
- 55
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