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 .
×
Create a free account

[Starfinder Official Sheet] How do KAC and EAC update automatically?

1548284598

Edited 1548285468
Hey there.  Topic says it all.  I'm wondering how KAC and EAC are able to automatically update themselves when ability scores change?  I know it has something to do with the sheetworker code, but I have no idea what I'm looking for.  All I need is the chunk of code that handles the update triggers to the AC attributes.  I just don't know what I'm looking for.
1548356314
Scott C.
Roll20 Production Team
Compendium Curator
Hi Black.k.9, I'm guessing this is to adapt it for a custom sheet? Unfortunately I can't point to one section of code and say "here's the lines you need". The Starfinder Official sheet's calculations are extremely integrated with one another. The powerhouse of the integration though is the applyBuffs function which uses information stored in the attributeObjs or npcAttributeObjs objects to determine what gets added, subtracted, divided, multiplied, etc. Additionally the sheetworker uses several functions to figure out what buffs, penalties, and conditions to apply to the character. I don't know that I'd recommend pulling out code from the Starfinder (or by extension the Pathfinder playtest) sheet because everything is so integrated. What are you trying to accomplish in your sheet, and maybe we can figure out either how to adapt the Starfinder sheetworkers in toto, or how to write something more purpose built for you.
Ah, that's fine.  I figured out why it wasn't working as well as getting it to function without interrupting anything else on the sheet.  Turns out I needed to add "affects": ["cmd"] to bab, character_level, strength_mod and dexterity_mod for the sheet to work properly.  Apparently even if I call those attributes to add to a calculation, I still need to define those attributes as "affecting" the final result. I'm new to Javascript so I'm not completely sure why that would happen, but at least it's working now. I'm not too sure it'll work when the Charactermancer is fully integrated, but at least for now the Houserule works. Thank you for the reply!
1548471232
Scott C.
Roll20 Production Team
Compendium Curator
Ah, in that case, you could actually do it without having to customize the sheet. Simply make a buff called "house rule" and put the following in the mods field: + @{bab} to cmd + @{character_level} to cmd + @{strength_mod} to cmd I'll note that cmd is already affected the dexterity mod since the dex mod affects kac which affects cmd. Doing it via the buff will ensure that your sheets will stay up to date, and if character mancer comes to Starfinder, you'll be compatible with it right off the bat.
Scott C. said: Ah, in that case, you could actually do it without having to customize the sheet. Simply make a buff called "house rule" and put the following in the mods field: + @{bab} to cmd + @{character_level} to cmd + @{strength_mod} to cmd I'll note that cmd is already affected the dexterity mod since the dex mod affects kac which affects cmd. Doing it via the buff will ensure that your sheets will stay up to date, and if character mancer comes to Starfinder, you'll be compatible with it right off the bat. That does work as I had initially thought to implement it, but through tinkering and trial and error, I managed to make CMD work exactly as I had wanted it to without interfering too much with the existing Attributes. As for keeping the sheet up to date, now that I know what I was doing wrong with the code, re-implementing it each time the sheet updates will be easy as pie.