-
January 3rd, 2022, 18:20 #11
I added the debug to put the value of numLevel in chat before the set value is called, and it displayed properly, but still threw the error at the first .setValue. numLevel existed as did it's default value, so I don't know why the error is thrown, unless they're being calculated on dfferent threads and there's no reconciliation? I know, I'm reaching.... I'll try DB. Is this a lua thing, or is it in the Developers Guide. A cursory search didn't turn up anything related...
Not familiar with DB (database?)
The way this game works, those values are always needed, and aren't automatically added to anything because circumstance determines when your character gets it and when they don't. I just produce the values and allow it to be added to the modifier stack.
-
January 3rd, 2022, 18:52 #12
As Moon Wizard mentioned - "You can't assume that getChild("<name>") will always return a node" - if you did some debug along the lines of Debug.console("Child numProficiencyBonus = ", nodeChar.getChild("numProficiencyBonus")); you'll probably see this being reported in the console as Child numProficiencyBonus = nil
Like I've mentioned before - when you get nil errors you need to work out what is actually nil - and to do that you have to deconstruct the statement if you have multiple objects/functions in the statement. For example, one of your lines of code is: nodeChar.getChild("numProficiencyBonus").setValue( nLevel); - this is carrying out API calls on the nodeChar database node object, and on the database node object returned from nodeChar.getChild("numProficiencyBonus") - if either of these are nil you'll get the error you're seeing. So, deconstruct the line where the error is being reported to see what is actually nil - which is more than likely the getChild("<name>") API function mention by Moon Wizard - because the database node you're trying to access hasn't been created yet. Moon Wizard mentions using DB.setValue because it creates the child node if it doesn't exist - this API function is from the DB package (detailed in the Wiki development guide): https://fantasygroundsunity.atlassia...82/DB#setValuePrivate 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!
-
January 3rd, 2022, 19:09 #13
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks