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

[Script] SmartAoE - graphical interface for implementing AoE's on gridded maps

1636309882

Edited 1666641403
David M.
Pro
API Scripter
Concept Have you ever overlayed a cone, line, or circle template on a map and wondered if that square that is just barely covered should count as "in"? Sure, there are pre-made grid templates out there, but you are usually limited to 90/45deg orientations. The idea behind this script is to provide flexibility in casting angles (to align just the right spot before triggering) and a means for consistent ruling of these cases. The script can be used with either just basic functionality to simply draw AoE regions, or can utilize a host of subcommands to define damage, saving throws, chat output, etc., detecting creatures within affected squares and either rolling saving throws and/or applying damage and condition markers automatically (ala&nbsp; GroupCheck &nbsp;or similar script), or as a deferred action by clicking buttons on the chat interface. Available for one click install! &nbsp;one-click version: v0.25 Source code can be found here:&nbsp; GitHub repo - v0.28 Read this! No, really. &nbsp; A full run-through of the script setup, capabilities, and limitations along with many example macros and animated gifs can be found on the wiki site here:&nbsp; <a href="https://wiki.roll20.net/SmartAoE" rel="nofollow">https://wiki.roll20.net/SmartAoE</a> YouTube Video: &nbsp;Nick Olivo created a video on his channel that gives a great intro to the script and a walkthrough of simulating a specific 5e spell effect (Shatter). Check it out here ! Repo of several 5e spell macros can be found here Teaser Animation (click to play) Figure description. Example of 4 active AoE's: 1) a green 90deg cone (fixed radius, snapped to intersection), 2) a red 5e-style cone (variable radius), 3) a blue line effect, and 4) an aqua circle (using the "float" keyword described in the documentation, and a custom multi-sided controlToken). The circle AoE is triggered (a 5e SRD Ice Storm spell, defined when it was created), making saving throws for tokens in area, automatically deducting damage, and outputting the results to chat. Notes This script might seem intimidating to use at first read due to the large amount of optional commands and subcommands. I tired to make the wiki as user-friendly as possible, but there is still a lot. Please don't hesitate to ask questions, but try look through the wiki first. There are a bunch of examples at the end that can help you get started. Under the hood, this script is very complicated. Between myself, the players in my gaming groups, and my Patreon supporters, it has gone through a fair amount of testing, but issues are sure to come up. If so, just post to this forum thread and I'll try to get it resolved as soon as possible.&nbsp; To this end, there is a list of&nbsp; Quirks, Recommendations, and Known Issues &nbsp;in the wiki. If you are impatient, you can jump to the wiki examples here ! Ok, that's all for now. Hope you have fun playing around with it!
1636309932

Edited 1666641434
David M.
Pro
API Scripter
Version history v0.18 - initial public release v0.19 - &nbsp;bug fix for fixed radius AoE's using --controlTokName|self when the caster token is larger than 1x1. v0.20 - &nbsp;bug fix for non-unity grid settings, added --offset subcommand, added !smartclearcache primary api command, now triggering AoE updates only on token move events. See forum post for details v0.21 - &nbsp;Added --saveFormula shorthand for PF1/2 by Roll20 and PF Community sheets, added new aoeTypes "PFcone" and "PFcircle", install now automatically creates the "AoEControlToken" character with several abilities and token actions, install also creates a collections macro "AoEGenerator" that spits out a chat menu for simple common AoE types. See&nbsp; forum post &nbsp;for details v0.22 - &nbsp;Bug fix for grid snapping on pages with gridWidth other than 1; Allow script writers to register their token change event functions to SmartAoE. See forum post for details. v0.22a - &nbsp;Bug fix allowing apostrophes and backticks to be used in character names when damage application is deferred using --autoApply|0 v0.23 - &nbsp;Allows multiple bar values to be declared for the --bar subcommand. Minor bug fix relating to small AoE's vs. very large tokens. See forum post for details v0.24 - Added "Wall" aoeType. Added --width subcommand. Bug fixes for certain line effects and offset issues. See this forum post for details v0.25 - Added resource Management via --resource subcommand.&nbsp;Added the --chatAvatarsEnabled subcommand. Bug fix for very small grid scales. See this forum post for details v0.26 -&nbsp; &nbsp;SoundFX, Whisper options, Turnorder, and controlTok Tooltips. See this forum post for details v0.27 -&nbsp; &nbsp; Now explicitly sets the controlTok to object layer prior to spawning, due to change in Roll20 default token JSON information. v0.28 - &nbsp;Bug fix&nbsp;regarding map/grid alignment for certain AoE types
1636312621
Does your script account for spheres/circles where the casters size adjusts it?&nbsp; AKA spheres where the origin is the caster?&nbsp; This is primarily why I had to go make my own as nobody really realizes there are 2 different spheres in 5e.&nbsp;&nbsp;
1636315179

Edited 1636315325
vÍnce
Pro
Sheet Author
Awesome!&nbsp; Can't wait to try this out David.&nbsp; At first I thought this might only work with 5e, but after looking over the very helpful wiki page it looks like there shouldn't be any problems using this for Pathfinder 1e (I think 2e as well...).&nbsp; Hopefully the PF community can contribute more PF-specific macro examples for the wiki as well.
1636317033

Edited 1636317350
David M.
Pro
API Scripter
DM Eddie: yes, there are a couple of ways to do it.&nbsp; In the default way (using a control token in addition to the caster token), when you specify a fixed radius, the radius will be calculated based on the dimensions of the caster token. Note that using a control token means that you will have to grab the spawned token and move it away from the origin point to trigger the AOE generation. When you delete the control token, the AoE is deleted as well. E.g. !smartaoe {{ &nbsp; --aoeType|circle &nbsp; --minGridArea|0.25 &nbsp; --radius|30ft }} &nbsp; The second way to handle areas emanating from and moving with a caster token is a recent addition to the script which doesn't require a control token. In testing this recent update, I noticed that this method needed to be updated to account for caster token size. This fix is in v0.19 at the GitHub link in the original post Here is a simple example for a 30ft circle emanating from a caster token. (note no control token in the picture) &nbsp;!smartaoe {{ &nbsp; --aoeType|circle, float &nbsp; --radius|30ft &nbsp; --controlTokName|self &nbsp; --forceIntersection|0 }} Since you'd never want to delete the caster token: in order to remove the AoE using this method, you would run the following command (likely as an ability macro on the caster as described in the wiki setup&nbsp; here ). !smartremove A more complex macro (and animated gif) illustrating this second method plus a couple other features is provided in the wiki&nbsp; here &nbsp;(5e Spirit Guardians spell) &nbsp;
1636317236
David M.
Pro
API Scripter
@Vince: I was trying to make it as system-agnostic as possible. Just note that PF cones are a bit weird. From what I could tell, it seems that the "standard" PF templates don't use a uniform calculation method (based on % of square covered). I got as close as I could in this example .&nbsp;
1636357234
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
David M. said: @Vince: I was trying to make it as system-agnostic as possible. Just note that PF cones are a bit weird. From what I could tell, it seems that the "standard" PF templates don't use a uniform calculation method (based on % of square covered). I got as close as I could in this example .&nbsp; The PF cone (and circle for that matter) use the distance calculation of Pathfinder, which is alternating double movement for diagonals. Beautiful job on this David. I had something sort of like it a bit ago, but it was ugly as sin. Your's is gorgeous.
1636380071
David M.
Pro
API Scripter
Thanks, Scott! Ok, that makes sense regarding PF areas. With the current script (taking into account % coverage area only), I think PF-style circular AoE's can be accurately represented using a --minGridArea|0.90 as shown below. PF cones will currently have extra squares counted (bottom image), as we are limited to a --minGridArea|0.50. Requiring anything more than that will cut off the two squares immediately adjacent to the caster token. I'd have to play around with it, but I think I could add a "PFcone" aoeType that would take the purely area-based squares of the standard cone method and add another filter that counts diagonals to remove the extra corner cases. Pretty sure I already have some code in the Radar script that does these calculations. &nbsp;
1636383727
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I am so looking forward to trying this out. This looks amazing!
1636431866

Edited 1636432351
Just started playing with this, it has a lot of promise.&nbsp; Question: Is it possible to offset where the initial AoE Target Token spawns?&nbsp; Even 1/2 or 1 grid over so that it's easier to see than when it spawns under the selected token?
1636459938
David M.
Pro
API Scripter
Sure, I'll add an --offset|x,y command in the next rev (ala the Spawn script). But just to clarify: the control token already is being told to spawn&nbsp; above the caster token***. I think what is happening is that Roll20's behavior as of a yr or two ago is to always give tokens-with-sight priority z-ordering over sightless tokens. If you give the default token sight, it should be immediately accessible directly above the caster without an offset. Regardless, I'll still add that option. That "adding sight" step was an oversight in the setup instructions (I had set mine up months ago and honestly forgot about it). I will update the wiki accordingly. (***exception to spawning above is when a custom AoE image token is used via --controlTokName/controlTokSize/controlTokSide if the size is greater than 1x1. Those control tokens are sent to back to ensure you can still access target tokens within the large AoE for non-instantaneous effects)
1636499174

Edited 1636499251
Do you have an example of ScriptCards calling !smartaoe?&nbsp; I'm thinking about making a "Super Generic AoE" Script that asks the user for things like "Shape", "Radius/Size", "Center On (self/target)", .... and then builds the appropriate smortaoe command dynamically.&nbsp;&nbsp; To set up a call correctly, without creating a ton of mini-smartaoe macros, I need access to conditional commands and string functions so I can build a dynamic superaoe command.&nbsp; I'm just concerned with all the "{{, }}, --, |" special characters that historically have tripped up the scriptcards parcer. BTW - "Add sight" step fixed my issue - no need for an offset.&nbsp;&nbsp;
1636511114
David M.
Pro
API Scripter
Will, I don't have one handy right now, and I am currently affected by the dead api sandbox bug that started today. But, when I have access to the api again I'll try to come up with something! My concern is that it would be a ton of queries since the primary design goal of flexibility unfortunately requires a lot of input. I wonder if using scriptcard libraries might be a potential solution, where you build up a "spellbook" library and use a simple query or chat menu to call them up?&nbsp; Glad to hear adding sight fixed your issue, though I will still likely add the --offset option to the script because a) it should be pretty easy and b) there might be others that would want that functionality.&nbsp; &nbsp;
1636511270
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
David, are you by any chance on a Mac? I discovered that the API Output Console was black, but the API was actually running (sometimes). It would report in incognito mode. Same behavior on Firefox. I was able to restore by resetting Chrome. Pain in the neck, but seems to have worked.
1636511520

Edited 1636511765
David M.
Pro
API Scripter
No, I'm on Win10/Chrome in incognito mode. I'll try completely closing all windows and starting from scratch just in case. EDIT - derp. That worked. Closed all Chrome windows and logged back into Roll20 - all good now. Thanks!
1636586248
Hi David, First I have to said Awesome API, is a master piece. Now I set it up in two campaigns in one it works perfectly and on the other is giving me this message: (From SmartAoE): &nbsp;Error: tempAttrs[0].get(...).toLowerCase is not a function Do you know what can cause this?
1636587232
Also When I set the default token with Vision it does not even appear
1636588280

Edited 1636588599
David M.
Pro
API Scripter
Warlord, 1) That error message is related to the section that finds resistances, vulnerabilities, and immunities. What character sheet are you using? Is your macro using any of the commands: -- resistAttr, -- vulnerableAttr, or&nbsp; -- immunityAttr?&nbsp; 2) When you say it does not appear, do you mean the control token does not spawn? If so, is it possible that it is just hiding behind the caster token? That could happen if the token was updated but the default token was not removed and re-set.
1636590884
1) I'm using the 5e by roll20. I try on PC and work fine, when I tried on NPC is when I get the error. my macro is like this: Breath Weapon !smartaoe {{ &nbsp; --title|Breath Weapon &nbsp; --leftsub|15 ft. Cone &nbsp; --rightsub|DC [[8+@{selected|constitution_mod}+@{selected|pb}]] DEX &nbsp; --aoeType|5econe &nbsp; --forceIntersection|0 &nbsp; --radius|15ft &nbsp; --origin|nearest, face &nbsp; --minGridArea|0.25 &nbsp; --minTokArea|0.25 &nbsp; --fx|burn-fire &nbsp; --dc|[[8+@{selected|constitution_mod}+@{selected|pb}]] &nbsp; --saveFormula|5eDEX &nbsp; --damageFormula1|[[[[1+ceil(@{Heskan|Level}/5)]]d6]] &nbsp; --damageType1|Fire &nbsp; --ignore|SmartAOE_ignore,1&nbsp; &nbsp; --instant|1 &nbsp; --autoApply|1 &nbsp; --bar|1 &nbsp; --desc|You can use your action to exhale destructive energy. Your gold draconic ancestry means this exhalation is a 15 ft. cone dealing fire damage. When you use your breath weapon, each creature in the area of the exhalation must make a Dexterity saving throw. The DC for this saving throw equals 8 + your Constitution modifier + your proficiency bonus. A creature takes 2d6 damage on a failed save, and half as much on a successful one. The damage increases to 3d6 at 6th level, 4d6 at 11th level, and 5d6 at 16th level. After you use your breath weapon, you can't use it again until you complete a short or long rest. }} 2) I think this was because I was also running !AMMO to automatically reduce the breath weapon resource and it was interfering with !smartAoE. I eliminate AMMO and is working. I try to give vision to the token but still does not appear on top of the character but on the bottom. One of the NPC had vulnerability and immunities. took him out of the AoE but still the error appear.&nbsp;
1636593085
I have done test on both my campaign in one is working perfect, no matter if it is NPC or PC, on the other campaign it only works on PC. One of the differences between the two campaign is the quantity of API install. Do you think another API could be affecting SmartAoE?
1636599620
David M.
Pro
API Scripter
When you said it was working when you removed !AMMO, which part started working? The attribute error, or the control token z-order (above/below) problem? For the vision-related z-order problem, I just want to clarify the steps to update the default token: 1) open token menu and give token vision 2) With the token selected , open the character sheet, click "Edit" 3) Mouse-over the default token image. Click "remove" 4) Click "Use Selected Token" - this final step will save the current token settings (with vision) to the default token. As far as the npc-related error, I can't say for sure what is going on with the given information. It's possible that there is an api conflict. SmartAoE watches for token changes and token deletion in addition to handling chat messages. Looks like I can/should narrow down the scope of my token change event to only trigger when position is changed rather than any change. I'll add that to the next revision. If you want, I can take a look at this if you PM me a link to your game and temporarily promote me to GM. Just be sure to PM and not post the invite link to the forum. We can handle the rest of the troubleshooting over PM and/or Roll20 chat so we can free up the forum thread. I'll post back here when there is something to report.
1636604083
David M.
Pro
API Scripter
Ok, so mystery solved. The module that Warlord was running had some renamed attributes that were different that standard compendium creatures. But more importantly, those resistance/vuln/immunity attributes had a numeric value "0" in them instead of blank, which I was not expecting and which threw the error when I tried to perform a .toLowerCase() on them. I will add some extra handling for these cases in the next revision.
1636637854

Edited 1636639650
Great script David! Now that I've been able to test it I need to add it to all of my current games, I was planning to use your spawning script to manage spell areas but now I've got this superpowerfull tool that does magical things :) Thanks!!! I'm having some trouble generating circle areas in maps with 0,5 cell with (DotMM). The generated grid area is misaligned from the map grid, if I drag the control token to an intersection the token is inside a cell, if I drag it to a cell appears in an intersection. It seems to work as intended in 1 cell with maps.
1636641287

Edited 1636641528
David M.
Pro
API Scripter
Sr. K, Thanks for the heads-up. This was working a month or two ago but it appears that I broke it some time before releasing! I think I found the culprit. I'll have a fix out soon. EDIT - as an aside, your example macro was probably just for demonstration purposes, but just in case: you would likely want to add a --minGridArea to your macro. It defaults to 0.01 of the grid cell covered to count as "in" the AoE :)
1636645198
David M.
Pro
API Scripter
Version Update v0.20 - found here Fixed bug for pages with non-unity grid size that was causing a shift in the AoE alignment (thanks Sr. K!) Added the&nbsp; --offset &nbsp;subcommand&nbsp;to spawn the control token a number of grid units away from the origin token. Examples: --offset|1, 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//spawns one square to the right --offset|-1, -1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//spawns one square left and one square down&nbsp;&nbsp; Allow for multiple attributes to be checked for resistance/vulnerability/immunity (comma-delimited). For example, user Warlord reported that the 5e White Plume Mountain module has npcs with attributes named npc d _resistances instead of npc_resistances. You can now explicitly add optional attribute names so that your standard compendium npcs and the goofy module ones can both be checked for resistance/vulnerability/immunity. Examples: --resistAttr|npc_resistances, npcd_resistances --vulnerableAttr|npc_vulnerabilities, npcd_vulnerabilities -- immunityAttr| npc_immunities, npcd_immunities AoE updates are now limited to changes in token position. Previously, any changes to the token (e.g. bar values, etc.) would trigger an update.&nbsp; Added a primary api command to clear the cache (SmartAoE State object) of all AoE links in the campaign. Once or twice I have experienced some glitches when restarting my sandbox and trying to run SmartAoE commands too soon. If you suspect your SmartAoE State object has been corrupted in some way, just run the following command: !smartclearcache
1636653601
This is magnificent! Thank you for the contribution - very much looking forward to blowing some stuff up with it.
1636657646
.Hell
Sheet Author
In Shadowrun grenades lowers their dmg the further away the target is from the center. This is often put as a formular like -2/m. Could you add something like this? I would really like to use it :) Is it possible for each token affected to put out the dmg it would take?
1636659121
David M.
Pro
API Scripter
Hmm I could look into the damage-as-a-function of distance functionality (maybe something like --damageFallOff|&lt;rate&gt;), but might not get to it right away. Would have to clarify a few things first as well, like (a) if you'd want a smooth linear interpolation or have it broken up into discrete distance categories, and (b) if the distance calculation starts at the absolute center point or at the edge of a 1x1 square origin. As to your 2nd point, damage applied per token is already displayed in chat. If anything, I'd probably want an option to suppress those messages.
1636669343

Edited 1636723041
David M.
Pro
API Scripter
Does anyone have a generic set of saving throw formulas for PF1 / PF2 (needs to work for both PCs &amp; NPCs if there are any attribute naming differences like in 5e)? If so, I can add the same shorthand that I use for 5e saving throws (e.g. --saveFormula|5eDEX) for these other systems / sheets. Just trying to save people some macro prep time and help eliminate typos. For example, "5eDex" is auto-replaced in the script with the following formula: [[d20 + ([[d0 + @{dexterity_save_bonus}@{pbd_safe}]]*(1-@{npc})) [PC] + (@{npc_dex_save}*@{npc}) [NPC]]] While we're at it, if you want to share some generic formulas (and suggested shorthand name) for any other system that'd you'd like implemented, feel free! EDIT - Played around with the PF1/PF2 character sheets a bit. Question for any PF players out there: Do the following formulas look valid?&nbsp; &nbsp; "PF1fort": { "name": "FORT Save", "formula": "[[1d20+@{fortitude}[MOD]+(@{saves_condition})[CONDITION]+@{rollmod_save}[QUERY]]]" }, "PF1ref": { "name": "REF Save", "formula": "[[1d20+@{reflex}[MOD]+(@{saves_condition})[CONDITION]+@{rollmod_save}[QUERY]]]" }, "PF1will": { "name": "WILL Save", "formula": "[[1d20+@{will}[MOD]+(@{saves_condition})[CONDITION]+@{rollmod_save}[QUERY]]]" }, "PF2fort": { "name": "FORT Save", "formula": "[[1d20 + [@{saving_throws_fortitude_proficiency_display}] (@{saving_throws_fortitude})[@{text_modifier}] + (@{query_roll_bonus})[@{text_bonus}]]]" }, "PF2ref": { "name": "REF Save", "formula": "[[1d20 + [@{saving_throws_reflex_proficiency_display}] (@{saving_throws_reflex})[@{text_modifier}] + (@{query_roll_bonus})[@{text_bonus}]]]" }, "PF2will": { "name": "WILL Save", "formula": "[[1d20 + [@{saving_throws_will_proficiency_display}] (@{saving_throws_will})[@{text_modifier}] + (@{query_roll_bonus})[@{text_bonus}]]]" },
1636716185
.Hell
Sheet Author
David M. said: Hmm I could look into the damage-as-a-function of distance functionality (maybe something like --damageFallOff|&lt;rate&gt;), but might not get to it right away. Would have to clarify a few things first as well, like (a) if you'd want a smooth linear interpolation or have it broken up into discrete distance categories, and (b) if the distance calculation starts at the absolute center point or at the edge of a 1x1 square origin. Discrete distance categories would be superb. I can imagine a lot of other games have something which is less linear and could use this too. I usually calculate from 0x0 Square but 1x1 is no problems. The rules are not clear on where to start the dropoff (first meter free or not)
1636744960
vÍnce
Pro
Sheet Author
David M. said: Does anyone have a generic set of saving throw formulas for PF1 / PF2 (needs to work for both PCs &amp; NPCs if there are any attribute naming differences like in 5e)? If so, I can add the same shorthand that I use for 5e saving throws (e.g. --saveFormula|5eDEX) for these other systems / sheets. Just trying to save people some macro prep time and help eliminate typos. For example, "5eDex" is auto-replaced in the script with the following formula: [[d20 + ([[d0 + @{dexterity_save_bonus}@{pbd_safe}]]*(1-@{npc})) [PC] + (@{npc_dex_save}*@{npc}) [NPC]]] While we're at it, if you want to share some generic formulas (and suggested shorthand name) for any other system that'd you'd like implemented, feel free! EDIT - Played around with the PF1/PF2 character sheets a bit. Question for any PF players out there: Do the following formulas look valid? If you want something that will work with the PF Community sheet... "PFc1fort": { "name": "FORT Save", "formula": "[[1d20+@{total-Fort}[tot]+@{Fort-ability-mod}[mod]+@{Fort-trait}[trait]+@{Fort-resist}[res]+@{Fort-misc-mod}[misc]+@{saves-cond}[cond]+@{buff_Fort-total}[buff1]+@{buff_saves-total}[buff2]]]" }, "PFc1ref": { "name": "REF Save", "formula": "[[1d20+@{total-Ref}[tot]+@{Ref-ability-mod}[mod]+@{Ref-trait}[trait]+@{Ref-resist}[res]+@{Ref-misc-mod}[misc]+@{saves-cond}[cond]+@{buff_Ref-total}[buff1]+@{buff_saves-total}[buff2]]]" }, "PFc1will": { "name": "WILL Save", "formula": "[[1d20+@{total-Will}[tot]+@{Will-ability-mod}[mod]+@{Will-trait}[trait]+@{Will-resist}[res]+@{Will-misc-mod}[misc]+@{saves-cond}[cond]+@{buff_Will-total}[buff1]+@{buff_saves-total}[buff2]]]" },
1636934283

Edited 1637066583
David M.
Pro
API Scripter
Version Update v0.21 - found&nbsp; here EDIT - wiki is updated! (Note: the wiki has not been updated yet. I hope to have it updated sometime tomorrow) Added - -saveFormula shorthand for PF1/PF2 by Roll20 sheets and the PF Community sheet. You can now use the new shorthand instead of writing custom inline rolls with deferral characters e.g. &lt;&lt;1d20 + a{attrName}&gt;&gt;. --saveFormula|PF1Fort --saveFormula|PF1Ref --saveFormula|PF1Will --saveFormula|PF2Fort --saveFormula|PF2Ref --saveFormula|PF2Will --saveFormula|PFCFort --saveFormula|PFCRef --saveFormula|PFCWill Added PF-style AoE rules for circles &amp; cones (where every other diagonal counts as 2 squares). Functions as normal, but applies an additional filter after grids are calculated to account for the diagonal calculations. From what I can tell, I would recommend using --forceIntersection|1 &nbsp;to replicate published templates more easily. However, I have read that there is some debate on how PF-style cones should be interpreted, with some published templates seemingly using inconsistent rulings (particularly for 15ft cones), so please play around with the various settings for "PFcone" and "cone, 90" aoeTypes until you find something that works best for your table.&nbsp; --aoeType|PFcone --aoeType|PFcircle --aoeType|PFcircle, float Diagonal comparison: "PFcone" vs "cone, 90" (with minGridArea|0.50) Orthogonal comparison: "PFcone" vs "cone, 90" (with minGridArea|0.50) 30ft sphere comparison: &nbsp;"PFcircle, float" vs "circle, float" (with minGridArea|0.50) Upon install, if the character " AoEControlToken " doesn't exist, it creates it for you! Also, a few token action abilities are created as well (according to the recommended setup). Finally, a ton of non token action abilities are added, which are referred to in a collections macro (" AoEGenerator ") that is also automatically installed. This collections macro creates a chat menu allowing easy generation of common AoE's. This macro includes all of the AOE types the script can generate, so feel free to edit it as you want depending on your system of preference. You don't need the PF-style AoE's if you're playing 5e for example. This is an "easy button", but it obviously doesn't exploit the full functionality of the script. If you have already set up your control token but want the auto-install version, just delete or rename it and re-boot your sandbox. &nbsp;
1636943161
vÍnce
Pro
Sheet Author
1637240615
David M.
Pro
API Scripter
Version Update v0.22 - found&nbsp; here Two changes: Fixed a sneaky bug where grid-snapping was failing silently in certain regions of the map for maps with grid width other than 1. This affected float aoeTypes and other types where --forceIntersection|1 was explicitly set. Script writers can now register their token change events to SmartAoE! Regarding event registration: For example, the Aura/Tint HealthColor script looks for changes in token bar values to set the aura color. However, changes made by the api don't normally trigger this event, so it would remain idle when SmartAoE removed/added hp. By registering your token change event handler function, SmartAoE will notify your script to trigger your function after it changes any token properties. Add something like this line to your script where you would normally register your events: if('undefined' !== typeof SmartAoE &amp;&amp; SmartAoE.ObserveTokenChange){ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SmartAoE.ObserveTokenChange(function(obj,prev){ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; myEventHandlerFunction(obj, prev); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }; So, extending the example of Aura/Tint Health Colors, the new&nbsp;registerEventHandlers function in that script would read as follows: //REGISTER TRIGGERS------------ registerEventHandlers = function () { on('chat:message', handleInput); on("change:token", handleToken); on('add:token', function (t) { _.delay(() =&gt; { let token = getObj('graphic', t.id), prev = JSON.parse(JSON.stringify(token)); handleToken(token, prev, "YES"); }, 400); }); //register this script to SmartAoE to handle linked bar hp changes if('undefined' !== typeof SmartAoE &amp;&amp; SmartAoE.ObserveTokenChange){ SmartAoE.ObserveTokenChange(function(obj,prev){ handleToken(obj, prev, "NO"); }); }; }; This should look familiar to those that have done the same thing with Token-mod, as I blatantly ripped off Aaron's code. I apologize for nothing ;)
1637242955
Thanks for your work, speciially the event registration explanation. I think I found a bug whit special characters in names and&nbsp;--autoApply|0, I get this on the chat after apllying from the AoE chat menu with a character named&nbsp;Truh B'saij: &nbsp;&nbsp; (From SmartAoE): &nbsp;Error: Cannot read property 'split' of undefined
1637244813
David M.
Pro
API Scripter
Sr. K, I just tested with a Truh B'saij character getting hit by an AoE with --autoApply|1 and it worked fine in my test game. Can you post your whole macro?
1637245193
It was a testing macro using your Ice Storm example as a base: !smartaoe {{ --title|Ice Storm --leftsub|Slot level ?{Cast at what level?|4,4|5,5|6,6|7,7|8,8|9,9} --rightsub|DC @{selected|spell_save_dc} DEX --titlecardbackground|linear-gradient(blue, cyan) --oddrowbackground|#00ccff --evenrowbackground|#edfcfc --oddrowfontcolor|#000000 --tablebgcolor|#edfcfc --aoeColor|#00ccff50 --aoeOutlineColor|#0099ff --aoeType|circle, float --radius|4u --fx|burn-frost --dc|@{selected|spell_save_dc} --saveFormula|5eDEX --damageFormula1|[[(?{Cast at what level?}-2)d8]] --damageType1|Bludgeon --damageFormula2|[[4d6]] --damageType2|Cold --ignore|SmartAoE_Ignore,1 --instant|1 --autoApply|0 --bar|1 --zeroHPmarker|dead --desc|A hail of rock-hard ice pounds to the ground in a 20-foot-radius, 40-foot-high cylinder centered on a point within range. Each creature in the cylinder must make a Dexterity saving throw. A creature takes 2d8 bludgeoning damage and 4d6 cold damage on a failed save, or half as much damage on a successful one.%br%%br%Hailstones turn the storm's area of effect into difficult terrain until the end of your next turn. }}
1637245508
David M.
Pro
API Scripter
Ah, I misread. AutoApply is off. I was able to replicate this error. Looking into it...&nbsp;
1637247423
David M.
Pro
API Scripter
Version Update v0.22a - found&nbsp; here Accomodation for the special characters ' (apostrophe) and ` (backtick) to be used in character names. Previously, if --autoApply was set to false, these special characters would trigger an error when the user attempted to apply damage.&nbsp; (thanks Sr. K!) Single or multiple instances can be used in the character name, e.g. Truh B'saij Ki'noth D'sar Back`tick` the Apos'trophe
1637263524
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Drizz't thanks you. Free panther ride for David next time you visit TenTowns.
1637264504
David M.
Pro
API Scripter
LOL!
1637897742
Ok so you have caused more work by me going and transforming all my AOE macros to this, but oh man is it great.&nbsp; So I notice that we can have a bar set to apply damage to and now I'm going to make it difficult.&nbsp; In Starfinder, PCs have a stamina point pool that has damage applied to it before hit point damage is taken. Is there a way to do this with this script? To damage 1 bar to 0, then apply any subsequent damage to another bar?
1637939929
is this in the script library, or do i have to add it manually
1637940088
David M.
Pro
API Scripter
@Daemon - Currently manual install. Working the kinks out before submitting to 1-click @Erik - I will look into this. It could potentially be useful for 5e and other systems that use temp hps that might be tracked in one of the bars. Good idea!
1637945630

Edited 1637945728
Erik M. said: Ok so you have caused more work by me going and transforming all my AOE macros to this, but oh man is it great.&nbsp; So I notice that we can have a bar set to apply damage to and now I'm going to make it difficult.&nbsp; In Starfinder, PCs have a stamina point pool that has damage applied to it before hit point damage is taken. Is there a way to do this with this script? To damage 1 bar to 0, then apply any subsequent damage to another bar? This snippet from The Aaron does what you are asking for: <a href="https://app.roll20.net/forum/permalink/6781493/" rel="nofollow">https://app.roll20.net/forum/permalink/6781493/</a> You will only need to acomodate the&nbsp; configuration parameters to the Starfinder sheet needs.
1637953294
David M.
Pro
API Scripter
Good find, Sr. K! My thoughts were to add an option to list multiple #'s (up to 3) for the --bar| subcommand in order of priority. So for example --bar|3,1 would drain bar3, then spill over to bar1 for example. That would remain system agnostic, not require additional "listening" scripts, and also not break any existing macros. Was going to take a look at it on Sunday.
1638133557
Love the script! Thanks for putting so much effort into this.&nbsp; Instead of creating individual spell macros is there a way to make a more generic macro that combines the AoEGenerator chat list and the group check and apply damage APIs when clicking TriggerAll? I tried tacking on the group check macro but it only targets the AoeControltoken. !smarttrigger !group-check {{ --?{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(,) ~status ?{Status| None, | Red,red| Blue,blue| Green,green| Orange,orange| Purple,purple| Pink,pink| Yellow,yellow| ―, | Concentrating,blue| Readying,stopwatch| ―, | Prone,back-pain| Restrained,fishing-net| Grappled,grab| ―, | Incapacitated,interdiction| Stunned,pummeled| Unconscious,sleepy| ―, | Charmed,chained-heart| Frightened,screaming| ―, | Poisoned,half-heart| Blinded,bleeding-eye| Deafened,lightning-helix| Paralyzed,padlock| Petrified,broken-skull| ―, | Dodging,bolt-shield| Cover (half),broken-shield:2| Cover (three-quarters),broken-shield:5| Cover (full),white-tower| Invisible,ninja-mask| ―, } }}
1638142092
David M.
Pro
API Scripter
@Surok, The issue is that the control token is the selected token when you trigger it, so GroupCheck tries to roll the save on that character sheet. If you want to continue to use GroupCheck, I would just use SmartAoE for determining which tokens to select before firing off GroupCheck as usual. You could optionally alter the abilities used by the AoEGenerator chat menu macro to include your GroupCheck queries. For example, the 10ft square at range ability could be changed to something like this (assuming 5e OGL sheet): !smartaoe {{ --aoeType|square, float --radius|10ft --fx|burn-fire --DC|@{selected|spell_save_dc} --saveFormula|5e?{Save Type?|STR|DEX|CON|INT|WIS|CHA} --damageFormula1|[[?{Damage?|8d6}]] --autoApply|1 --conditionFail|?{Status|None, |Red,red|Blue,blue|Green,green|Orange,orange|Purple,purple|Pink,pink|Yellow,yellow|―, |Concentrating,blue|Readying,stopwatch|―, |Prone,back-pain|Restrained,fishing-net|Grappled,grab|―, |Incapacitated,interdiction|Stunned,pummeled|Unconscious,sleepy|―, |Charmed,chained-heart|Frightened,screaming|―, |Poisoned,half-heart|Blinded,bleeding-eye|Deafened,lightning-helix|Paralyzed,padlock|Petrified,broken-skull|―, |Dodging,bolt-shield|Cover (half),broken-shield:2|Cover (three-quarters),broken-shield:5|Cover (full),white-tower|Invisible,ninja-mask|―, } }} Or, you could further generalize for AoE shape and radius and reduce the number of buttons in the chat menu, for example: !smartaoe {{ --aoeType|?{AoE Shape?|square|circle}, float --radius|?{Radius?|10}ft --fx|burn-fire --DC|@{selected|spell_save_dc} --saveFormula|5e?{Save Type?|STR|DEX|CON|INT|WIS|CHA} --damageFormula1|[[?{Damage?|10}]] --autoApply|1 --conditionFail|?{Status|None, |Red,red|Blue,blue|Green,green|Orange,orange|Purple,purple|Pink,pink|Yellow,yellow|―, |Concentrating,blue|Readying,stopwatch|―, |Prone,back-pain|Restrained,fishing-net|Grappled,grab|―, |Incapacitated,interdiction|Stunned,pummeled|Unconscious,sleepy|―, |Charmed,chained-heart|Frightened,screaming|―, |Poisoned,half-heart|Blinded,bleeding-eye|Deafened,lightning-helix|Paralyzed,padlock|Petrified,broken-skull|―, |Dodging,bolt-shield|Cover (half),broken-shield:2|Cover (three-quarters),broken-shield:5|Cover (full),white-tower|Invisible,ninja-mask|―, } }} ...extending as much as you wanted (for fx type, etc..) depending on how much clicking you wanted to do.
1638195521
David M.
Pro
API Scripter
Version Update v0.23 - found&nbsp; here Minor bug fix that affected an edge case of a small AoE (e.g. 1x1) vs. a huge token (e.g. 3x3 or greater) where depending on AoE placement the target token may or may not have been filtered out of the valid targets array. The --bar| subcommand now accepts multiple bar values! This is useful if the target has temporary hp (5e), or other ablative health pool (e.g. stamina in Starfinder). Thanks Erik M.! If multiple bar values are defined: For damage, once the first bar value is reduced to 0, any excess damage will be applied to the subsequent bar number until all damage is accounted for or all denoted bar values are 0. For healing (negative damage), bars will fill up until the max value is reached, then excess will be applied to the next bar value, etc. If the bar value has no max, there will be no limit to the amount of "healing" possible. Examples: --bar|1 --bar|3,1 --bar|3,1,2
1638206121
David M. said: @Surok, The issue is that the control token is the selected token when you trigger it, so GroupCheck tries to roll the save on that character sheet. If you want to continue to use GroupCheck, I would just use SmartAoE for determining which tokens to select before firing off GroupCheck as usual. You could optionally alter the abilities used by the AoEGenerator chat menu macro to include your GroupCheck queries. For example, the 10ft square at range ability could be changed to something like this (assuming 5e OGL sheet): !smartaoe {{ --aoeType|square, float --radius|10ft --fx|burn-fire --DC|@{selected|spell_save_dc} --saveFormula|5e?{Save Type?|STR|DEX|CON|INT|WIS|CHA} --damageFormula1|[[?{Damage?|8d6}]] --autoApply|1 --conditionFail|?{Status|None, |Red,red|Blue,blue|Green,green|Orange,orange|Purple,purple|Pink,pink|Yellow,yellow|―, |Concentrating,blue|Readying,stopwatch|―, |Prone,back-pain|Restrained,fishing-net|Grappled,grab|―, |Incapacitated,interdiction|Stunned,pummeled|Unconscious,sleepy|―, |Charmed,chained-heart|Frightened,screaming|―, |Poisoned,half-heart|Blinded,bleeding-eye|Deafened,lightning-helix|Paralyzed,padlock|Petrified,broken-skull|―, |Dodging,bolt-shield|Cover (half),broken-shield:2|Cover (three-quarters),broken-shield:5|Cover (full),white-tower|Invisible,ninja-mask|―, } }} Or, you could further generalize for AoE shape and radius and reduce the number of buttons in the chat menu, for example: !smartaoe {{ --aoeType|?{AoE Shape?|square|circle}, float --radius|?{Radius?|10}ft --fx|burn-fire --DC|@{selected|spell_save_dc} --saveFormula|5e?{Save Type?|STR|DEX|CON|INT|WIS|CHA} --damageFormula1|[[?{Damage?|10}]] --autoApply|1 --conditionFail|?{Status|None, |Red,red|Blue,blue|Green,green|Orange,orange|Purple,purple|Pink,pink|Yellow,yellow|―, |Concentrating,blue|Readying,stopwatch|―, |Prone,back-pain|Restrained,fishing-net|Grappled,grab|―, |Incapacitated,interdiction|Stunned,pummeled|Unconscious,sleepy|―, |Charmed,chained-heart|Frightened,screaming|―, |Poisoned,half-heart|Blinded,bleeding-eye|Deafened,lightning-helix|Paralyzed,padlock|Petrified,broken-skull|―, |Dodging,bolt-shield|Cover (half),broken-shield:2|Cover (three-quarters),broken-shield:5|Cover (full),white-tower|Invisible,ninja-mask|―, } }} ...extending as much as you wanted (for fx type, etc..) depending on how much clicking you wanted to do. Thanks for the help. I expanded on the macro and added more queries. Here's what I got so far. I Had too delete some effects because not showed up. !smartaoe {{ --rightsub|DC @{selected|spell_save_dc} --leftsub| @{selected|token_name} --aoeType|?{AoE Shape?|square|circle|5econe|Line}, float --radius|?{Radius?|10}ft --fx|?{TypeFX|bomb|bubbling|burn|burst|explode|glow|missile|nova}-?{ColorFX|acid|blood|charm|death|fire|frost|holy|magic|slime|smoke|water} --DC|@{selected|spell_save_dc} --saveFormula|5e?{Save Type?|STR|DEX|CON|INT|WIS|CHA} --damageFormula1|[[?{Damage?|10}]] --damageType1|?{damageType|none|acid|bludgeoning|cold|fire|force|lightning|necrotic|piercing|poison|psychic|radiant|slashing|thunder} --autoApply|1 --conditionFail|?{Status|None, |Red,red|Blue,blue|Green,green|Orange,orange|Purple,purple|Pink,pink|Yellow,yellow|―, |Concentrating,blue|Readying,stopwatch|―, |Prone,back-pain|Restrained,fishing-net|Grappled,grab|―, |Incapacitated,interdiction|Stunned,pummeled|Unconscious,sleepy|―, |Charmed,chained-heart|Frightened,screaming|―, |Poisoned,half-heart|Blinded,bleeding-eye|Deafened,lightning-helix|Paralyzed,padlock|Petrified,broken-skull|―, |Dodging,bolt-shield|Cover (half),broken-shield:2|Cover (three-quarters),broken-shield:5|Cover (full),white-tower|Invisible,ninja-mask|―, } }} One final query I would like to add is to see if it's half damage or none.
1638207352
David M.
Pro
API Scripter
Surok said: One final query I would like to add is to see if it's half damage or none. You would just query for parameters to the&nbsp;--damagesaverule| subcommand, something like this: --damagesaverule|?{Save Damage Rule?|Save for half,*0.5|No damage on Save,*0} Also, for this line (&nbsp; --damageFormula1|[[?{Damage?|10}]] &nbsp;), note that it will accept dice expressions like 8d6, etc. You may want to make your default expression use this format to remind players that they don't need to enter a fully evaluated damage value.