Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Advertisement Create a free account

[Help] Generating 5e OGL NPC Character... But Stats Are Empty!

1598589924

Edited 1598589965
I am writing a script to generate NPC characters from JSON. The attributes needed for the 5e OGL sheet are a little confusing. I have the attributes "strength", "dexterity", etc. set on the character, but they do not appear to be working correctly. See the pictures below for an explanation Here is how it appears on the Attributes tab: Here is how it appears in the NPC OPTIONS edit screen (why are they all 10s?): And here is how it appears on the Character sheet (notice how the modifiers don't match and are not calculated from the values correctly): I'm sure there is some weird attribute I forgot or something. The 5e OGL sheet attributes feel... a little arcane. Does anybody know what's going on?
Also, if anyone knows of a helper script that eases the creation of NPC characters so I don't have to remember all the bizarre attributes, please let me know 🙏
1598605117

Edited 1598605304
On my NPCs, the strength is stored in "strength_base", and similarly for other stats. If you are setting attributes directly, then you need to set the strength_mod and strength as well as strength_base. I guess that the character sheet has some stuff happening in the background that updates things properly when typing into the sheet.
1598607286
GiGs
Pro
Sheet Author
API Scripter
You'll have to study the 5e sheet's html to identify which attributes are relevant. The problem there is they dont make that sheet's code public any more... But if you could see it, you'd discover that a lot of the visible attributes are created from hidden attributes and sheet workers, and you need to identify the way the sheet builds the attributes to be able to add your stats to it properly.
1598627604
timmaugh
Pro
API Scripter
I wonder if my Xray script can at least help you understand what is going on in a character... I'm not sure how "hidden" attributes are hidden, and so I'm curious whether it would read them and present them to you. It can't tell you what the sheet does with them in the background, but maybe if you XRay a known-good character, you can reverse engineer the levers you have to pull and the attributes you have to populate to get the outcome you're after. You can see it (and find the link to get it) in this thread . It is dependent on the InsertArg script (and Core Library -- so there are 3 files you need), but once you have those, you can disregard the explanation of how to use that side of it. Scroll down in the first post in that thread to the "XRAY (Helper Script)" heading and see if it can help you identify what you need to figure out. And let me know. I'm genuinely curious.
1598630831

Edited 1598631282
GiGs said: You'll have to study the 5e sheet's html to identify which attributes are relevant.   The problem there is they dont make that sheet's code public any more... You can at least easily examine the DOM of the generate sheet using dev tools of your chosen browser. EDIT: As an example, here's what the the DOM subtree of the STR attribute in one NPC character sheet looks like, maybe it'll help? (Flying Sword if you want to know).
Thanks for the tips everyone. I got it to (mostly) work by just looking at the data for an existing character and setting every attribute that looks remotely related (`strength`, `strength_base`, `strength_mod`). @timmaugh I'll check out xray. wow it looks very powerful.
1598653780
GiGs
Pro
Sheet Author
API Scripter
timmaugh said: I wonder if my Xray script can at least help you understand what is going on in a character... I'm not sure how "hidden" attributes are hidden, and so I'm curious whether it would read them and present them to you. It can't tell you what the sheet does with them in the background, but maybe if you XRay a known-good character, you can reverse engineer the levers you have to pull and the attributes you have to populate to get the outcome you're after. You can collect and print out a complete list of attribute names on the character sheet (and those created after by other scripts, etc.) using the API. But you need to understand the relationships between them created by sheet workers, and I dont think there's any native way to get at that. The sheet likely has a lot of attributes that you just cant set the values off accurately, without knowing what they do.