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

David M. said: Whoa, never run into that one before! Can you try it on another page/map? You could also delete any active AoE's and run the following command, just to make sure there isn't anything strange going on with the persistent state object: !smartclearcache I've had a few reports of certain pages getting messed up (seemingly like the page grid coordinate system gets corrupted somehow), though the grid seems to jive with the drawn AoE scale so I'm not convinced that is exactly what is going on in your case. I had this happen to me once on a map that had non integer Height or Width.  When I changed them from 18.5262 to 18 (just sample numbers) it all lined up again.
Firstly this script is a game changer!  I'm wondering if anyone has a document or collection of common spells (other than what's posted in the wiki) for 5E that I can copy pasta because I'm lazy? I also keep messing up little things because I'm a code derp.  If not no worries, I'll power through it. 
1683669100

Edited 1683669157
David M.
Pro
API Scripter
I have a list of some on github, found here . Be sure to read the READ_ME which explains that you should NOT copy over the comments found in each file. Also note that many of these macros are there as examples of different ways to use the script. They are not necessarily all configured in the same uniform way. Some also require additional scripts to be installed. But, most should be good as a starting point, and many can be easily converted to different spells with similar AoE types, etc..
1683851517

Edited 1683851699
Here is a generic one I made.  It prompts you for everything to make it unique (except the spell effect, but that can be added). !smartaoe {{ --title|AoE --rightsub|DC ?{Spell Save DC?|15} --titlecardbackground|linear-gradient(blue, cyan) --oddrowbackground|#00ccff --evenrowbackground|#edfcfc --oddrowfontcolor|#000000 --tablebgcolor|#edfcfc --controlTokName|AoEControlToken --controlTokSize|1 --aoeColor|#00ccff50 --aoeOutlineColor|#0099ff --aoeType|?{AOE Type|Line,line|Square,square|Circle,circle|Cone,5econe|Wall,wall}, ?{From Caster|True,|False,float} --radius|?{Size?|30}ft --width|2ft --minGridArea|0.25 --minTokArea|0.25 --fx|burst-holy --dc|?{Spell Save DC?} --saveFormula|?{SaveType|Strenth,5eSTR|Dexterity,5eDEX|Constitution,5eCON|Intelligence,5eINT|Wisdom,5eWIS|Charisma,5eCHA} --damageFormula1|[[?{Damage Roll?|8}]] --damagetype1|?{Damage Type|acid|bludgeoning|cold|fire|force|lightning|necrotic|piercing|poison|psychic|radiant|slashing|thunder} --resistAttr|npc_resistances --immunityAttr|npc_immunities --vulnerableAttr|npc_vulnerabilities --autoApply|yes --bar|1 --zeroHPmarker|dead }} I let the players roll damage in my games (so I just enter a number), but can enter a formula as well.
Oh and this is for AOE damaging spells only.  It's not for spells that have an aoe save or condition affect spells (i.e. Hypnotic Pattern)
1684100017

Edited 1684100116
Hi, thanks for creating this API.  I am new to Pro and the API in general.  I installed the SmartAOE and tried copying straight from your wiki to create macros as both a DM and player and it did not work.  The AOEControlToken is installed in my system.  When I click on a macro it could ask me for a spell level but nothing else happens.  The AOEControlToken targeting icon never appears and it just seems to stop working.  The AOEtoken is not under the selected casting token.  At some point I was getting "error: Cannot read properties of underfined (reading"x")" I also tried to uninstall the API and reinstall and it still does not work.   Thanks in advanced!!    I also tried to create the macro from the wiki video and that also did not work.... 
1684101488
David M.
Pro
API Scripter
Haldor,  have you confirmed that your sandbox is running? First thing I would try is to restart the sandbox, even if you don't see a pink error message on the api page. You might try reinitializing the state associated with this script in case it has been corrupted in some way. Note if you do this, any existing AoE's generated from this script will be unlinked from their control token and you'll have to delete manually.  If you want to try clearing the SmartAoE state, type the following into chat !smartclearcache If the sandbox is running, you should get a confirmation message in the chat window. Finally, if it still doesn't work, try it on a different map. I've seen some unusual cases of certain maps/pages causing issues, though usually that is grid alignment or related issues rather than no control token spawning.
1684111374

Edited 1684111470
HI, Thank you so much for responding so quickly!!! Sad to say it worked about half way then stopped.  I tried it multiple times and on different maps.  I also tried clearing the cache and restarting the sandbox a few times. When it did partially work it did not erase the boxes it created or remove the AOE token at the end. I did get the following messages once I returned to Mod page.  BTW I am using Florea campaign which I bought on Roll20 Again I thank you in advance!!!  :) ----------------------- Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your script's code and click the "Save Script" button. We will then attempt to start running the scripts again.  More info...  If this script was installed from the Mod Library, you might find help in the Community API Forum. For reference, the error message generated was:  TypeError: Cannot read properties of undefined (reading 'get') TypeError: Cannot read properties of undefined (reading 'get') at updateMapWithAoE (apiscript.js:5859:36) at smartAoE_handleTokenChange (apiscript.js:6103:13) at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:168:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:168:1), <anonymous>:70:8) at TrackedObj.set (/home/node/d20-api-server/api.js:1107:14) at updateLocalCache (/home/node/d20-api-server/api.js:1442:18) at /home/node/d20-api-server/api.js:1628:11 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147)  at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546)  
1684118261
David M.
Pro
API Scripter
PM sent
David, Thank you again!!! Your help was very appreciated.  My players are going to be surprised when I show them this!
Awesome Script Maybe you could add a range feature, to indicate/enforce that a spell can not be cast outside
Hi im not good at using api or stuff so i need some help XD I have notice some wall of fire script but they all make the tokens roll for save every instance of damage while the save is only when the wall appear and later it makes full damage not half. how do i script this possibility? can also be usefull for other spells like hunger of hadar that make 2 instance of damage, one always full damage and the other with save or no damage taken.
1684489065
David M.
Pro
API Scripter
Master, there's no good way to do that with the script currently, and would be difficult to fit that into the current script framework. One option I could think of would be to use a custom control token for the spell instead of the default, and (in addition to the smartaoe trigger) add a token action ability that rolls the automatic damage. It could even be a tokenmod or scriptcard macro that could roll and apply the damage to a particular target.  
I have try making 2 different script and tokens, one lasting and with the no save (so the lasting firewall) and one instant with half save for when the firewall appear. how do you handle the save for avoid all damage (like hunger of hadar  that allow a save for avoid all damage?). sorry i need to study more xD
1684493590
David M.
Pro
API Scripter
With SmartAoE, if you want no damage on a save, add the following to your macro: --damagesaverule|*0 If this line is omitted, the script automatically defaults to half damage on a successful save, which is the same as using this line: --damagesaverule|*0.5
Thanks a lot! i love all this
I started getting this same message. I finally just disabled the smartaoe script. ----------------------- Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your script's code and click the "Save Script" button. We will then attempt to start running the scripts again.  More info...  If this script was installed from the Mod Library, you might find help in the Community API Forum. For reference, the error message generated was:  TypeError: Cannot read properties of undefined (reading 'get') TypeError: Cannot read properties of undefined (reading 'get') at updateMapWithAoE (apiscript.js:5859:36) at smartAoE_handleTokenChange (apiscript.js:6103:13) at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:168:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:168:1), <anonymous>:70:8) at TrackedObj.set (/home/node/d20-api-server/api.js:1107:14) at updateLocalCache (/home/node/d20-api-server/api.js:1442:18) at /home/node/d20-api-server/api.js:1628:11 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147)  at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546)  
I may have spoken too soon. I tried the !smartclearcache and that seems to have fixed it. Joe M. said: I started getting this same message. I finally just disabled the smartaoe script.
Hey David :)  This mod looks like a complete game changer for me, but I can't seem to get it to work.  I have a brand new campaign, no other scripts besides SMART aoe and the lib one.  When I use the macro for any spell, even those copied directly from github, absolutely nothing happens.  I've tried on different maps, made sure the spacing is in integers, and cleared my cache multiple times (which doesn't give me an indication that the sandbox is running).  The AoeControlToken exists and seems to have all the scripts in their 'skillsandabilities' tab.  I've spent the last two hours watching videos and trying to get it to work, and I don't know what to try next.   I apologize, this is my first venture into api scripts, so I feel completely lost.  I have two  dungeons and dragons therapy groups starting in the next couple weeks, and this would really help with the kids that are new to DnD who struggle with math and have some learning difficulties.   I am getting this error in the api sandbox, which might as well be in ancient aramaic. TypeError: Cannot read properties of undefined (reading '0') TypeError: Cannot read properties of undefined (reading '0')     at apiscript.js:6141:157     at process.processTicksAndRejections (node:internal/process/task_queues:95:5) If you have time, I could use some assistance lol. -Matthew
1685704855
David M.
Pro
API Scripter
That processTicksAndRejections error is not related to SmartAoE. I think it has something to do with character sheets, IIRC.  Is there a big pink box error on your api page, or just the plain yellow text errors within the console (the black background area)? Restarting your sandbox has no effect?  If running the !smartclearcache command didn't whisper you anything in the chat, it definitely sounds like your sandbox is not running. If you want, you can invite me to your game and temporarily promote me to GM so I can take a look at what is going on. I'll PM you so we can keep the invite link private.
Hey David!  I deleted the game and remade it a third time, and its working now.  The script probably got scared because it knew you were coming into my game to figure it out lol.   Thanks again!  I'll let you know if I run into any other problems. -Matthew
1685882501
David M.
Pro
API Scripter
Hmm, very weird. Glad to hear it's working for you now! 
Random question - is there a way to make the smart aoe use the selected characters Ki save DC?  I'm having trouble altering the code for burning hands to have the opposing character save vs the ki save DC of this Order of the Dragon Monk.  Also, is there an example of how to make a query that asks what element they would like to use, and then have it use that element?
Matthew P. said: Random question - is there a way to make the smart aoe use the selected characters Ki save DC?&nbsp; I'm having trouble altering the code for burning hands to have the opposing character save vs the ki save DC of this Order of the Dragon Monk.&nbsp; Also, is there an example of how to make a query that asks what element they would like to use, and then have it use that element? I have a script posted here that prompts for damage type (among other things) <a href="https://app.roll20.net/forum/permalink/11458173/" rel="nofollow">https://app.roll20.net/forum/permalink/11458173/</a>
1686225508
David M.
Pro
API Scripter
Matthew, try something like this for the DC: --dc|[[8+@{selected|pb}+@{selected|wisdom_bonus}]] If that doesn't work, you could try adding a 0d0 like this: --dc|[[0d0+8+@{selected|pb}+@{selected|wisdom_bonus}]]
The wiki is broken
1686860292
Gauss
Forum Champion
DakotaSlim said: The wiki is broken Hi DakotaSlim,&nbsp; If you clear your cache the wiki should work again. I had the same issue and clearing my cache resolved it.
Another random question.&nbsp; I have SmartAoE crashing the API on only 1 map.&nbsp; Works beautifully everywhere else!&nbsp; I built it a long time ago and to make the map fit I made the cell width 2 instead of 1.&nbsp; Would this mess up SmartAOE? I got this the following on the most recent crash.&nbsp; Thanks TypeError: Cannot read properties of undefined (reading 'get') at updateMapWithAoE (apiscript.js:21397:36) at smartAoE_handleTokenChange (apiscript.js:21641:13) at smartAoE_handleInput (apiscript.js:23589:25) at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:168:1), &lt;anonymous&gt;:65:16) at Object.publish (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:168:1), &lt;anonymous&gt;:70:8)
1686972983
David M.
Pro
API Scripter
Is the grid active on that map? The map scale shouldn't matter, but there have been occasions where certain pages seem to get "corrupted". I would first try to clear the SmartAoE state object using the following: !smartclearcache Note this will also unlink all active AoE objects in your game, so keep that in mind because you don't want to be manually deleting all the grid drawing.&nbsp;&nbsp; If that doesn't solve it, try making a copy of the map and seeing if it works on the copy. If that still doesn't work, there aren't many other options at this point except for recreating the map. Hopefully it won't come to that. If it is a very complicated map and recreating would be a pain, you could invite me to your game and promote me to GM for me to take a look at it if the first steps don't work.
David, thanks for the reply.&nbsp; Will try to the smartclearcache.&nbsp; It is a complicated map but it was intended to be a mass waves of zombies where SmartAoE was going to be very useful and fun.&nbsp; Will let you know if I need the GM support...thanks much for the offer
!SmartClearCache looks like it has done it...thanks!
Sorry if this question has been asked in the past, but could not seem to find it. I am having an issue with the Tigger Target button occasionally. Sometimes it will work but I usually get this error message:&nbsp;&nbsp; (From SmartAoE): &nbsp;Error: Cannot read properties of undefined (reading 'get').&nbsp; I am using the OLG 5e character sheet.
Is it possible to include the caster in the output? I can not figure out how to do this. For example Fireball damages the caster if they are in the radius.
1687132745
David M.
Pro
API Scripter
Version 0.29 available - found here &nbsp;(Note Manual install required for this development version) Summary (1) AoE's can finally affect caster tokens! syntax: &nbsp; --affectsCaster|&lt;true/yes/1/false/no/0&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//defaults to false (0) Example: &nbsp; --affectsCaster|1&nbsp; &nbsp; //"caster" token is included in the list of affected tokens (2) Can now add a statusmarker to the source (usually caster) token upon AoE generation. This is useful for concentration spells in the 5e system for example. There is an optional flag to only apply the statusmarker if at least one target fails the saving throw. syntax: &nbsp; --casterCondition|&lt;statusmarker&gt;, &lt;optional "onFail"&gt; Examples: &nbsp; --casterCondition|stopwatch&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//adds a stopwatch marker to the caster regardless of the saving throw results &nbsp; --casterCondition|stopwatch, onFail&nbsp; &nbsp; //adds a stopwatch marker to the caster only if at least one target fails (3) Bug fix: certain errors during the saving throw process were crashing the sandbox (4) Bug fix: no longer duplicates statusmarkers if they already are present on the token
1687132878
David M.
Pro
API Scripter
@Ed W. Not sure what is specifically happening there, but I probably need to add some additional validation code to try to give more useful information. If you have a target token that always fails, does it still fail if you make a copy of the token? I'm wondering if there are some special characters in the token_id that are screwing up the parser?&nbsp;
@David M. thank you this works perfectly :)
@David M. - Yes it still gave the same error message when I made a copy of the target token. Tried it on several other tokens also. Funny thing is that I went to another page and it worked fine on the same character token on the new page that I was targeting on the first page.&nbsp;
1687477296
David M.
Pro
API Scripter
@Ed: Hmm, if you want you could invite me to your game via PM and promote me to GM so I could take a look at what might be going on.
Hey, I've been using this API for a while now and I think it's one of the most useful API's out there. But there is one thing that's beginning to really bug me that I hope somebody can help with. So my question is. is there any way to manually specify if a token within the AoE has advantage on the saving throw or not? I've noticed that if a character has the "Magic Resistance" trait from some races (such as Yuan-Ti), then they automatically roll with advantage. But sometimes I either don't want players with that trait to roll with advantage or I want certain players to roll with advantage even without that trait. I mainly just want to be able to force players to roll without advantage if they have the Magic Resistance trait, because I use the API for things other than spells, such as monster abilities that damage an area, but are entirely natural abilites (such as a dragons breath attack). Since the Magic Resistance trait specifically says advantage against spells , it shouldn't apply to things like that. No worries if there's nothing that I can do about it yet, I'll just have to manually do things for that specific character, but I'm hoping theres some sort of work around! Thanks :)
1687635300

Edited 1687635329
David M.
Pro
API Scripter
SwagVozhd, the problem is there is no good way to automate treating each token differently depending on individual circumstance. At that point you might as well just roll everything manually, using the script just for targeting visualization. Here are your options for the edge cases: If "most" targets don't have extenuating circumstances, use trigger-all and manually correct the outliers If a real hodgepodge, just use the script just for AoE visualization and manually roll Include a query for adv/disadv/normal in a custom saveFormula, and use trigger-target for each instead of trigger all The part about not wanting to apply magic resistance in certain cases makes sense and is something I can address by adding something like an --ignoreMagicResistance flag (likely only applicable to 5e). I'll add this to the next update when I can get to it.&nbsp;
1687956660

Edited 1687989223
Hello, Can this script handles magic resistance ? I have a player who plays an abjurer and I cant find a way to give him advantage on his save while using this script. Edit: I've read a lot of posts but not the one just above :-)&nbsp; What is the attribute use by the script to deal with magic resistance so I can add it to the player character Sheet ?&nbsp;
1687989462
David M.
Pro
API Scripter
You can add the text "magic resistance" to literally any attribute (existing or new) and it should work.&nbsp;
David M. said: You can add the text "magic resistance" to literally any attribute (existing or new) and it should work.&nbsp; Thx
1687996403
David M.
Pro
API Scripter
Cool, hope that works for you. I really need to add undocumented feature to the wiki.
David M. said: Cool, hope that works for you. I really need to add undocumented feature to the wiki It works like a charm. I love this script !
David M. said: Cool, hope that works for you. I really need to add undocumented feature to the wiki. Another question in the same vein : Is there a hidden feature that permits to give disadvantage to certain types of creatures (I'm thinking about the Sunburst spell where undead and oozes are at disadvantage at) ?
1688129992

Edited 1688133823
Hi there! I'm very new to pro (&lt; 3 days lol) and I'm having an issue with this script (I'm probably missing something ez and small) where when I try to use the Faerie Fire macro button I made (copied straight from the wiki) all it does is reveal a random portion of the map which I cannot un-reveal by any means (except rolling back the game). It does not create the overlay, it doesn't draw anything on the map or prompt for any spell saves. Has anyone encountered this error or would know how to troubleshoot this? I'm about 100% certain this is user error, not a script error lol&nbsp; Thank you for any assistance! Going crazy trying to figure this out lol EDIT: Wanted to list other mods I have installed just in case there's a conflict I'm not aware of. Concentration GroupInitiative TokenMod ChatSetAttr GroupCheck ApplyDamage Token Action Maker restoreInit Aura/Tint HealthColors D&amp;D 5E - PaladinAura Corpsecart BeyondImporter
1688245617

Edited 1688245635
David M.
Pro
API Scripter
@Sebastian, not currently @Xen, I'm guessing the "reveal" part is due to explorer mode (with vision on the AoE token which is controlled by all players causing the reveal). Vision is enabled on the control token by default due to a Roll20 "feature" that gives z-order preference to tokens with vision (so if it didn't have vision, it would technically spawn on top of the token but it would be forced to display behind a sighted character token. So, I can see that this would be problematic when using Explorer mode for cases where npc tokens are doing the casting. The only thing I can think of is to make a second AoEControlToken and turn its vision off, then using the --controlTokName command to spawn that &nbsp;version for npc spells/effects.&nbsp; As for the not actually working part: is a grid enabled on the current map? Another note for that particular wiki example: it uses a custom statusmarker from my game --conditionFail|GrantsAdvantage::1510122 This will not work for you since that statusmarker doesn't exist in your game. You'll have to replace it with either a standard marker or a custom marker in your game. The former doesn't need the "::######" part (you can just use the name), but a custom marker needs the double colon and numeric part (which can easily be found in your tokenmod help handout). This should be unrelated to your issue of no AoE showing up but thought I'd mention it in case you missed the description of that example in the wiki.&nbsp; &nbsp;
David M. said: @Xen, I'm guessing the "reveal" part is due to explorer mode (with vision on the AoE token which is controlled by all players causing the reveal). Vision is enabled on the control token by default due to a Roll20 "feature" that gives z-order preference to tokens with vision (so if it didn't have vision, it would technically spawn on top of the token but it would be forced to display behind a sighted character token. So, I can see that this would be problematic when using Explorer mode for cases where npc tokens are doing the casting. The only thing I can think of is to make a second AoEControlToken and turn its vision off, then using the --controlTokName command to spawn that &nbsp;version for npc spells/effects.&nbsp; As for the not actually working part: is a grid enabled on the current map? Another note for that particular wiki example: it uses a custom statusmarker from my game --conditionFail|GrantsAdvantage::1510122 This will not work for you since that statusmarker doesn't exist in your game. You'll have to replace it with either a standard marker or a custom marker in your game. The former doesn't need the "::######" part (you can just use the name), but a custom marker needs the double colon and numeric part (which can easily be found in your tokenmod help handout). This should be unrelated to your issue of no AoE showing up but thought I'd mention it in case you missed the description of that example in the wiki.&nbsp; &nbsp; Thank you so much! I almost don't even want to say how big an idiot I was, but grid was not enabled because of a sizing issue (which is again probably user error lol). Anyway, I followed your advice about creating an additional token for npc casts without vision (just in case). Apologies for missing something so easy, but I really appreciate the help! Everything is 100% working now.&nbsp; Thank you for the amazing script!