View Full Version : Modifying damage rolls for secial critical / custom damage types
TheoGeek
March 24th, 2026, 02:28
So, I'm looking at the new rulesets and have been thinking of refactoring my extensions (Theogeek's Improved Critical and Nat20) to be a bit less complicated and it might be time. So sort of basic questions regarding the new ruleset (5e specifically).
Currently, I hijack the base handlers, do all sorts of string manipulation, regex searches, etc. of fields in rRoll at various times to handle effects, add or remove crit dice, maximize damage of the various die, etc. then call the base handler to finish things up.
It's worked well so far, but ruleset changes like this one are proving to be more work than I have time. :)
So my basic question is this: "Is there a better way to modify the roll than searching for and replacing things that are already there?"
Also, in the Nat20 extension, I can't get the ruleset to recognize an effect like this: "DMG: 1d8 slashing,nat20". I have added "nat20" to DataCommon.dmgtypes and DataCommon.specialdmgtypes programmatically in an onInit function in the Nat20 extension, but doing that results in that clause not being added to the roll. However, if I change DataCommon's lua file to add "nat20" to those tables, it adds the clauses like I'd expect. Adding them programmatically works for the LIVE channel but no longer works in the TEST channel.
thoughts there?
Thanks all!
Theo.
Moon Wizard
March 26th, 2026, 17:56
Apologies for the delay in responding. Was out on vacation; and then trying to get some more changes out for rulesets this week before looking at extension pieces.
If you'd like me to take a look; I've added a concept called descriptor tag groups to the effect subsystem to handle ranges and damage types. It may be we can use that or find another way to implement the system. I'll need your help to understand what the extension is doing specifically; and for testing after I make a pass through it.
Just let me know if you'd like me to take a look; and where the latest is located (if not on Forge).
Regards,
JPG
TheoGeek
March 26th, 2026, 23:21
Welcome back! Hope you had fun!
And YES, if you could take a look, that would be great. Both extensions are in the Forge, and are not protected.
I'm headed out for a while, but will be back later to sort of give a rundown of what the LUA does.
Thanks again!
TheoGeek
March 27th, 2026, 03:52
OK, Here is what the extensions are doing in a nutshell...
Nat20:
I added damage types of "nat20", "normalcrit", and "supercrit" to be used in the effect clauses like so:
"DMG: 1d8 slashing,nat20"
And then I parse the rRoll to look for one of the special types so that it can react to it. "nat20" is used when a natural 20 is rolled for the attack. "normalcrit" is used if the attack is a crit in the crit range. "supercrit" is used of teh effect is supposed to cause damage even against crit immune targets.
I add those three damage types to the damagetype tables in DataCommon in the Nat20's "onInit function, but the ruleset is behaving the same way as if I has the effect "DMG: 1d8 slashing,ishdflskdhfq". However, if I add my damage types to teh damage type tables in DataCommon by modifying them in the data_common.lua file, it works fine.
ImprovedCritical:
This one is pretty complex but it involves heavily modifying fields in the rRoll table, adding and removing clauses, recreating sDesc, etc, both to inform the user what happened and to keep track of what the roll was so that it's output can be dragged to a target and it would apply correctly given all the modifications.
I think answering questions after you take a look at them would probably be more helpful because it could go a lot of places. :)
Thanks again!
Moon Wizard
March 27th, 2026, 20:16
Okay, I'll take a look as soon as I get a few more of these rulesets updated.
Would the supercrit possibly be handled by IGNOREIMMUNE: critical as a general case for that actor (or item for item effects extension)? Or is it only for the one effect specifically?
Regards,
JPG
TheoGeek
March 28th, 2026, 04:12
I think supercrit and IGNOREIMMUNE would be similar, but the difference would be like you stated - "supercrit" applies to one effect only. All of those special damage types were supposed to be for things like "I have a vorpal weapon that does extra damage on a nat20, so I have an effect like 'DMG: 2d6 slashing,nat20' that I can enable when using it." It went from there to "I'd also like to have other special critical damage types to make more custom critical effects" :)
TheoGeek
April 7th, 2026, 18:40
I'm not sure what's going on, but adding items to the DataCommon.dmgtypes table programmatically in extensions simply doesn't work anymore. If an effect has a damage type that has been added via "table.insert" to the dmgtypes table, it is ignored by the ruleset.
If however, that same damage type is added to the table by modifying data_common.lua, it works fine.
FG is behaving like it's doing something with that table after data_common.lua defines it and before extensions can add items to it.
Moon Wizard
April 8th, 2026, 16:58
Added some more code that "should" help with that (as many systems derive an effect tag group from damage types which probably needs to be updated too).
I've sent you a separate e-mail to discuss further.
Regards,
JPG
TheoGeek
April 8th, 2026, 19:44
Thanks! I haven't gotten any e-mail yet tho.
Powered by vBulletin® Version 4.2.1 Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.