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 .
×

[Script] Combat Assistant: Automated Damage, Healing, Saving Throws, Group Checks & Initiative | D&D 2014/2024

1785127980

Edited 1785337961
AmadeusVF
Pro
API Scripter
In the battlefield... The chamber trembles as Blair the Witch raises her staff to cast a powerful Fireball . Fireball deals 18 fire damage. The DM now needs to make eight Dexterity saving throws. Okay. Enemy one succeeds. Enemy two fails. Enemy three… succeeds. Let me move that token so I remember which one it was. Four succeeded and four failed. Two of them have resistance to fire damage. I need to check which two. This resistant enemy succeeded, so that is half damage from the saving throw and then half again from resistance. Eighteen divided by two is nine. Nine divided by two is four, rounded down. I subtract four Hit Points. The other resistant enemy failed, so it takes half damage from resistance. Eighteen divided by two is nine. I subtract nine Hit Points. Three non-resistant enemies failed, so they each take eighteen damage. The other three succeeded, so they each take nine damage. Now I need to open or update six more tokens. Three minutes later... Blair is sitting on a nearby rock, quietly removing splinters from her staff while the DM finishes calculating the consequences of the most dramatic moment of her turn. Introducing Combat Assistant Combat Assistant is a lightweight standalone spin-off of [ T&T - Trinkets and Trackers ] designed to keep moments like this moving. When an attack, spell, or damaging effect is rolled, Combat Assistant reads the result directly from the chat and generates an interactive card containing the detected damage, damage type, saving throw, and DC. Select the affected tokens and press Roll . Combat Assistant will: Roll the required saving throw for every selected target. Read each target’s result individually. Detect resistances, vulnerabilities, and immunities. Calculate the correct damage for each creature. Apply that damage directly to their Hit Points. Produce a detailed narrative log explaining every saving throw, modifier, defense, and final result. Blair raises her staff. The Fireball explodes. The DM selects eight enemies and presses Roll from Combat Assistant 's Menu. Within seconds, every saving throw is resolved, every resistance is considered, and the correct damage is applied to every target. The flames fade—and combat continues. How it Works Combat Assistant reads native Roll20 attack rolls, damage rolls, healing, saving throws, and initiative directly from the chat. When a supported roll is detected, it generates an interactive menu. Select one or multiple tokens, choose how to resolve the action, and Combat Assistant handles the rest - comparing attack rolls against AC , rolling saves, checking resistances , vulnerabilities , and immunities , and applying the correct damage or healing to each target. Attack Rolls and Automatic Damage When a creature makes an attack roll and rolls its damage, a menu will appear. [2024]                               [2014] The DM only needs to select the target token—or multiple tokens—and choose how the attack should be resolved. The attack hits  [Roll 22] against [15 AC] taking  13 Slashing damage                  The attack misses  [Roll 13] Against [18 AC]        First, Combat Assistant compares the attack roll against each target’s Armor Class. If the attack misses, no damage is applied. If the attack hits, Combat Assistant automatically applies the rolled damage while checking the target’s defenses:   Resistance reduces the damage. Vulnerability increases the damage . Immunity prevents the damage entirely . The final damage is calculated separately for every selected target and applied directly to their Hit Points. [Immunity]                                                                                                     [Resistance] What would normally require checking AC, opening character sheets, reviewing defenses, calculating damage, and updating tokens can now be resolved with a single button. About the adventure of Blair the witch and her powerful Fireball... The Combat Assistant Menu Type  " !ca menu "   in the chat to open the main Combat Assistant menu. From here, you can quickly perform common combat actions without opening character sheets or updating tokens individually. The menu includes four main options:        DMG: Apply damage to the selected target(s) directly or against the target(s)'s AC or after a Saving Throw Roll.   Heal: Restore Hit Points to the selected target(s). Save: Roll a native Roll20 saving throw for every selected target. Init: Roll R20 native initiative for every selected token and add the results to the Turn Order. Every option works with both single and multiple tokens. Select one creature to resolve an individual action, or select an entire group to handle them all at once. Combat Assistant processes each token separately, using that creature’s own statistics and defenses whenever applicable.  The Combat Assistant Settings Type " !ca config "   or press the Gear in the menu Chat Tracking:       disable the combat menu. 2024 Combat Assistant Rolls Initiative:       Use a custom render card to roll initiative for 2024 sheet by reading the sheet modifiers. 2014 Combat Assistant Rolls:       Use a custom render card to roll saving throws and initiative for 2014 sheet by reading the sheet modifiers. HP, AC, Temp HP Bar :    Select which token bar contains each attribute. This is necessary for NPC tokens because, if no HP or Temporary HP link is found, the script uses these bar settings to update those values. Damage Round Up :    Choose whether damage is rounded up or down when halved by resistance or a successful saving throw. Read Sheet Resistances :    Allow the script to detect resistances, vulnerabilities, and immunities on the character sheet and apply them automatically when calculating damage. Reveal Damage Source :    This shows the source of the damage in the narrative (Ex. From Blair the witch 's Fireball ). Reveal Token names in log:     This hides token names in the narrative and uses “ Target ” and “ Attacker ” instead. [Hide Tokens names ( ON )]                                            [Reveal Damage Source ( OFF )] Player Manual Roll:     Lets players roll their own saving throws when prompted. Player Attack Button:      When a player rolls an attack, a single use button will appear for the player to select a target and do the attack against the target AC to deal damage. [this is optional by the way you can just turn off the option] Player Healing Button:     When a player uses a healing spell, a single use button will appear for the player to select a target and automatically heal it.     Target Range Check :     Player Attack and Healing buttons automatically verify the distance between the source and target before executing the action. No more out-of-range attacks or accidental healing. (PLAYER VIEW) Player Token Area Mark:    Casting an area spell creates a movable template of the correct size. Place it on the map and press Roll to automatically resolve saving throws and damage for every creature inside. Player Marker Square URL, Player Marker Radius URL, Player Marker Opacity: Token Marker customization. Chat Background Image URL:     Change the background image used across all script menus. 2014 Sheet Compatibility For 2014 player character sheets, if they have resistance or anything else, you may need to manually add the npc_resistances , npc_vulnerabilities , and npc_immunities attributes. This allows the script to detect them and include them in damage calculations. When rolling group Saving Throws or Initiative for tokens using the 2014-character sheet, Combat Assistant will display an additional button. Select the 2014-sheet tokens and press that button to request all their rolls at once. Due to limitations with triggering the 2014 sheet’s native rolls directly through the API, the most reliable solution was to place the required chat command inside a button. It adds one extra click but still avoids rolling for every token individually. For group Saving Throws and Initiative involving both 2014 and 2024 sheets : 2024-sheet tokens roll automatically. For 2014-sheet tokens , it will list all selected 2014 tokens. Press Roll to roll for each one. The code has been submitted to the Roll20 repository, In the meantime, you can install it manually from  Here
1785163992

Edited 1785165339
Pak
Pro
Hi AmadeusVF! Great api! Thanks for such helpful tools!! A few questions/comments: 1- is there an option to choose bar 4 within settings since roll20 now enables bar 4? 2- What does choosing bar 0 do? 3- Is it possible to turn chat tracking off BUT still allow the use of combat assistant? I was trying to use the "Dmg" feature but it does not work when chat tracking is off. It would be nice if the "Dmg", "heal", "Save", etc... worked off of a different on/off toggle setting... 4- Is it possible for the API to track distance between the target and attacker and resolve issues., ie. if the attacker melee range is 5ft and the target is 10ft away, the API catches this. 5- Does it also check for magic resistance when a spell such as Fireball is cast? I tested fireball out on a creature with magic resistance and I couldn't tell if it rolled the DEX save with advantage or not... Let me play around with it some more and see if I have more feedback. -Pak
1785169679
AmadeusVF
Pro
API Scripter
Pak said: 1- is there an option to choose bar 4 within settings since roll20 now enables bar 4? Since Bar 4 isn’t currently visible in the settings, I didn’t include it in the code. I’ll add support for it in the next update. 2- What does choosing bar 0 do? Bar 0 cannot normally be selected. However, if it is somehow used, the script will fail to update it because it attempts to write an undefined value. 3- Is it possible to turn chat tracking off BUT still allow the use of combat assistant? I was trying to use the "Dmg" feature but it does not work when chat tracking is off. It would be nice if the "Dmg", "heal", "Save", etc... worked off of a different on/off toggle setting... It does. Damage, healing, saving throws, and initiative work without chat tracking. The only exception is damage associated with a saving throw. Since chat tracking is disabled, the script cannot read the saving throw result to determine whether full, half, or no damage should be applied. 4- Is it possible for the API to track distance between the target and attacker and resolve issues., ie. if the attacker melee range is 5ft and the target is 10ft away, the API catches this. Well, the main script Trinkets & Trackers already does that for spells, since it’s a complete system. I didn’t include it in this script because the goal was to keep it "simple", but I can add it as an optional setting. I’ll work on that. 5- Does it also check for magic resistance when a spell such as Fireball is cast? I tested fireball out on a creature with magic resistance and I couldn't tell if it rolled the DEX save with advantage or not... Interesting. The 2014 sheet asks whether the roll has advantage, but for 2024 sheet, let me see what I can do. Let me play around with it some more and see if I have more feedback. Sure, let me know if there’s anything else I can do to help.
1785515143

Edited 1785515233
AmadeusVF
Pro
API Scripter
A few updates on this. I was working on the range system for resolving attacks within an area when I realized I could take it much further. Since I can read all the details from 2024 spells, and support 2014 spells with a few adjustments to their descriptions, I decided to implement the complete system: direct attacks, area attacks, visual effects, and more. now you will be able to cast a spell select the area and make the roll for everything within the area. (Radius) (Cone) ( (Square) (Line) Everything will be fully customizable I’ll publish it once I’ve finished adjusting a few details and added a way to keep area markers active for concentration spells such as Call Lightning, Wall of Fire, etc.
1785547513

Edited 1785635468
timmaugh
Pro
API Scripter
That is an impressive looking script, Amadeus! I'm going to take some time to read through it more carefully, but I did see that your event registration has the chat handler register outside of your ready handler. If possible, can you put the chat handler registration within the ready-handler? The way you have it makes your script operate at metascript speed, but it is intended to be a standard "destination" script. If you move the chat registration within the ready registration, people will be able to use tools like the Metascript Toolbox to augment their usage of your script. (If you aren't familiar with metascripts, I put together this video that helps to explain them.) Thanks! And, well done, again!
1785552772
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I can hardly wait to get home from Gen Con to try this out! Question: How does it determine AOe on a radius (emanation) spell? I am aware of three ways GMs handle it: 1. All Circles are Squares. Many people rule it as movement range = the same as enumerated radius of effect. 2. Actual Geometry. Figuring the center point of origin and center point of the token and measuring the actual distance. 3. Squares that are at least half covered in the geometric radius. This fireball example I use shows all three methods with white lines. (you may need to look at it on a non-white background).
Amadeus, Just checking if this is different to what is contained within T&T Trinkets and Tracker ?  I was going to play around with the combat stuff over the next few weeks and quite like the idea of a stand alone script
1785598768
AmadeusVF
Pro
API Scripter
timmaugh said: That is an impressive looking script, Amadeus! I'm going to take some time to read through it more carefully, but I did see that your event registration has the chat handler register outside of your ready handler. If possible, can you put the chat handler registration within the ready-handler? They way you have it makes your script operate at metascript speed, but it is intended to be a standard "destination" script. If you move the chat registration within the ready registration, people will be able to use tools like the Metascript Toolbox to augment their usage of your script. (If you aren't familiar with metascripts, I put together this video that helps to explain them.) Thanks! And, well done, again! Oh, good catch, thanks for pointing it out. That pattern was inherited from my Trinkets & Trackers script (where I was experimenting a few stuffs to parse data), and since it hadn’t caused me any issues, I hadn’t gone back to check it. I’ll move it into the ready handler.
1785601524

Edited 1785606559
AmadeusVF
Pro
API Scripter
keithcurtis said: 2. Actual Geometry. Figuring the center point of origin and center point of the token and measuring the actual distance. It works like this: I originally measured from center to center, but in T&T that caused inconsistencies with Tiny, Small, Large, and Huge tokens. I changed the calculation so it now measures from the center of the area marker to the nearest point on the target token’s occupied space. I also apply a 0.1 ft margin so that a token merely touching the exact boundary of the area is not counted as affected. Also, range checks for attacks automatically use the map’s configured scale, including its distance per grid square. The circles represent the target boundaries used to determine whether each token is within range. The token outlined in green is affected. As you can see, the goblin is a Small token and is touching the perimeter, but it is not affected because the 0.1 ft margin means it is not considered to be inside the area. I’m glad you’re finding the script useful! I hope I can finish implementing the “keep the area active while concentrating” feature for spells like Call Lightning before you get a chance to test it!
1785602318
AmadeusVF
Pro
API Scripter
FFR said: Amadeus, Just checking if this is different to what is contained within T&T Trinkets and Tracker ?  I was going to play around with the combat stuff over the next few weeks and quite like the idea of a stand alone script Hello  FFR ,  yes, this is different from what is currently included in T&T v1.3.5. In v1.3.5, the combat features are mainly the buttons used to apply damage or healing. T&T v1.3.8 is much more complete and includes automated combat, turn tracking, concentration tracking, and condition tracking. Combat Assistant is essentially the standalone version extracted from that upcoming release. I haven’t published T&T v1.3.8 yet because those features are still under development and testing. In the meantime, you can use Combat Assistant alongside T&T v1.3.5. To avoid overlapping features, disable Player Manual Roll, Player Healing/Attack Buttons, and T&T Card Roll in T&T, then use Combat Assistant’s settings for all combat-related features. Sorry for the temporary inconvenience. Once T&T v1.3.8 is released, managing everything together will be much easier.
Amadeus, No inconvenience at all. As I'm testing the feature out I don't mind that I'm getting a response for both scripts. One bit of feedback is I find the red text for damage in the Combat Log difficult to read against the black background. Might just be my screen though. The dark pink text that comes through from the attack roll is very easy to read so don't know if duplicating this colour is an option.
1785713438

Edited 1785761157
Pak
Pro
Me waiting for the new version release...
1785780924

Edited 1785781871
AmadeusVF
Pro
API Scripter
FFR said: Amadeus, No inconvenience at all. As I'm testing the feature out I don't mind that I'm getting a response for both scripts. One bit of feedback is I find the red text for damage in the Combat Log difficult to read against the black background. Might just be my screen though. The dark pink text that comes through from the attack roll is very easy to read so don't know if duplicating this colour is an option. I changed it for a lighter color, thank for the feedback. Pak said: Me waiting for the new version release... I’ll release it tonight or tomorrow night. I’ve finished the concentration feature, but the code is still a bit messy. If you don’t mind using it in its current state for a while, I can upload it tonight. Here’s what I’ve added: I added concentration support for spells. The script keeps the spell’s area marker active, and you can use !ca conc to recast its action. This rerolls the damage and generates a new button for applying it. Flaming Sphere sheds bright light in a 20-foot radius, which is why it lights up the map. It also handles concentration checks when the caster takes damage, allowing them to maintain or lose concentration based on the result. For 2014 Spells will be a little complicated, as you have to edit the description manually with some specific words to make this happens, as I read the description of the spell to spawn and manage all, 2024 spells comes with the description, but 2014 spells no, but if you add the description to the spells when casting, it will appear and the script will handle it.
I'm good with waiting!!!
1785912572

Edited 1785913111
AmadeusVF
Pro
API Scripter
Hey! I just published the new release. I created a new post because I wanted to update the title and description. I’ll probably delete this one in a few days. Community Forums: [Script] Combat Assistant: Animated Combat, Automated Attacks & Spells, AoE, Concentration Track, Damage & Healing | D&D 2014/2024 | Roll20: Online virtual tabletop
I saw the new post! Thanks again AmadeusVF! It looks amazing! I can't wait to try it out when I get back from work!!!