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

Best API for applying damage? (DnD5e)

I've tried using a few different API's for applying damage from attacks and spells. They all do the job a bit differently and they are nice, but they don't quite take into account things like resistance or damage reduction from things like heavy armor master. So my question is what is the best API for calculating damage for dnd5e? Here is a list of the ones I've tried so far. Auto Buttons-  I like this one. Does the job for simple calculations, but doesn't account for things like resistance, damage reduction, or multiple damage types. Smart AoE's-  Probably the best one for auto calculations I just don't know enough about JS to create tons of macro's for all the spells and attack rolls. GroupCheck/ApplyDamage-  I can get groupcheck working, but the apply damage script doesn't seem to want to work.
1663618416
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Given the nature of exceptions to damage, and damage types, no automated system is likely to be perfect. They will nearly always require some adjudication ("My rogue has evasion, made his saving through, has vulnerability to fire damage, but immunity to the bludgeoning from non-magical weapons") The latter two are best used for group damage, where the applications are fairly straightforward. Auto Buttons is configurable to account for all of the exceptions—you can make new buttons that treat damage differently. I have come to rely on it. Personally, I use GroupCheck/ApplyDamage for AOE attacks. Is there a specific thing that isn't working right about it? Smart AOE's is pretty awesome, but I have been using GC/AD and token-mod controlled spell templates for so long, it would take considerable time for me to switch over, and then train my players.
Group check works ok, but I get an error message when I try applying the damage it comes up saying "Error invalid bar." I'm sure I'm just not doing something right. I just have very limited knowledge when it comes to JS.
1663636485
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
There are some config statements near the beginning of Apply Damage, specifically these:     defaultOpts = {       type: "half",       ids: "",       saves: "",       DC: "-1",       dmg: "0",       bar: "1"     }, That last one,  bar: , should have a 1, 2, or 3 in it, depending on which one you are using to control HP. This may or may not be the issue, but it's worth checking. Note that due to historical reasons, the middle bar links to bar 1.
Yeah that's what it shows. I'm probably messing up the macro or something. Here is what I have in the macro currently. !apply-damage --type [TYPE] --ids [IDLIST] --saves [SAVELIST] --DC [DC] --dmg [DMG] --bar [1|2|3]
If you are using ApplyDamage with GroupCheck, then you'll want a full macro that looks like this: !group-check {{ ?{Whisper|GM only,--whisper|Public,--public} --?{Ability Save|Strength,Strength Save|Dexterity,Dexterity Save|Constitution,Constitution Save|Intelligence,Intelligence Save|Wisdom,Wisdom Save|Charisma,Charisma Save} --ro ?{Roll Type|Normal,roll1|Advantage,adv|Disadvantage,dis} --process --subheader vs DC ?{DC} --button ApplyDamage !apply-damage ~dmg [[?{Damage|0}]] ~type ?{Damage on Save|Half,half|None,none} ~DC ?{DC} ~saves RESULTS(,) ~ids IDS(,)}}
1663691856
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Here's what I use: !group-check {{ --hideformula --public --?{Which Save Stat|Strength,Strength Save|Dexterity,Dexterity Save|Constitution,Constitution Save|Intelligence,Intelligence Save|Wisdom,Wisdom Save|Charisma,Charisma Save} --process --subheader vs DC ?{DC} --button ApplyDamage !apply-damage ~dmg [[?{Damage}]] ~type ?{Damage on Save|Half,half|None,none} ~DC ?{DC} ~saves RESULTS(,) ~ids IDS(,) }} Done
1663691893
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hah! Beat me by 37 seconds.
keithcurtis said: Hah! Beat me by 37 seconds. I probably copied from you originally!
1663728052

Edited 1663728534
Oosh
Sheet Author
API Scripter
Azrik said: Auto Buttons-  I like this one. Does the job for simple calculations, but doesn't account for things like resistance, damage reduction, or multiple damage types. There's an experimental version here which you may (or may not) be interested in. It adds queries to the final damage amount, so you can supply a damage resistance number or multiplier at click-time. The flat damage resist example in the linked post could be modified to set the default to '3' so you can just hit enter after clicking the damage button: !autobut --createbutton {{name=drFlat}} {{math=-(damage.total)}} {{query=-|Damage Resistance amount? (%%MODIFIER%% damage)|3}} {{content=DR+}} {{tooltip=Damage Resist flat (%)}} {{style=font-family:sans-serif; font-weight: bold; color: darkblue; font-size: 0.9em;}} This can also be split into two buttons, one for primary damage (with custom damage resist) and one for secondary damage (with custom damage resist) if you're dealing with lots of secondary damage types. I can help with that if you want to go down that path. I'll add some more default buttons like these before finalising the experimental version.
Awesome. Apply damage is working now. I'll look into making new buttons as well for Auto buttons. Thank you both for your help.
So I have a bit of a follow up question. Does Auto buttons and groupcheck/applydamage not work together? I'm getting a message when I try to install them that there might be a conflict somewhere. Auto Buttons doesn't seem to be working. In one game the buttons appear, but don't apply any damage and the other it doesn't seem to work at all. Here are the API's I'm currently using: Tokenmod Auto buttons libinline (Required for smart AOE) SmartAOE Turnmarker GroupInitiative Groupcheck/applydamage Deathtracker
1664158943

Edited 1664159975
Oosh
Sheet Author
API Scripter
There shouldn't be any reason they don't work together. The button generation doesn't modify anything in the campaign so shouldn't conflict with any other script, and applying the damage sends a command to TokenMod - if TokenMod is working normally there shouldn't be any issues here either. I've installed all the scripts you listed and am not getting any crashes or issues. Does restarting the sandbox have any effect? It sounds like it might be crashing silently. And does everything except autoButtons work normally? There's also a new version of autoButtons with a heap more included buttons which might be worth upgrading to - it might include some of the buttons you're hoping to use.
Ok, I think I must have grabbed the wrong script or maybe just an outdated version of it. It is working now. Thanks for the help.