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

1643804408
David M.
Pro
API Scripter
@Mizzri, what do you get when you select that token and type  @{selected|spell_save_dc}   in chat? I ask because that is correct syntax and seems to work properly for me when I copy your macro into a test game. It seems like it might be a character sheet issue. Note that the --rightsub is just a display. The thing that actually sets the dc is the line  --dc|@{selected|spell_save_dc} . @Iron Legion, that spell affects a 5ft square, so the radius should be 2.5ft. Also, you will want to either delete the --forceIntersection line or set it to false., as you will want the spell area to snap to the center of the grid square and not the intersection. Note that using --minTokArea|1 will exclude any large tokens that are in the AoE, as that line require 100% of the token's area to be within the AoE. Not sure if that was your intent.. Another thing, that spell is concentration up to 1min duration, so I would either set --instant|0 or delete that line (the default is non-instant) so that the AoE remains on the map after triggering.  Finally, just an FYI you have a couple of lines there that are set to the defaults which could be removed if you want, like --origin|center and --hideNames|FALSE. Hope that helps!
@David Thanks a ton!! 
@David M. Fixed it! It was the lack of a Spellcasting Ability attribute selected in the NPC character sheet. You, sir, are a Wizard!
1643843380

Edited 1643843435
Thanks for this awesome script. Running in to a slight issue though. Trying to use the following macro for gust of wind in two different games. !smartaoe {{   --title|Gust of Wind   --titlecardbackground|linear-gradient(#91cad1, #deeff1)   --leftsub|Slot level 2   --rightsub|DC @{selected|spell_save_dc} STR   --aoeType|wall,face   --minGridArea|0.25   --radius|60ft   --width|2u   --fx|missile-smoke   --dc|@{selected|spell_save_dc}   --saveFormula|5eStr   --aoeColor|#deeff150   --aoeOutlineColor|#deeff1   --gridColor|#deeff150 }} It works exactly how I want it in one game but in the other game the exact same macro gives me the error " (From SmartAoE): Unexpected argument identifier (width)." Completely stumped as to why this would be. Any help would be appreciated.
1643847650
David M.
Pro
API Scripter
Hmm, it's working for me, Ashley. Do you get the error when you spawn it, move it, or trigger it? In the game that isn't working, do any SmartAoE macros work?
David M. said: Hmm, it's working for me, Ashley. Do you get the error when you spawn it, move it, or trigger it? In the game that isn't working, do any SmartAoE macros work? The error happens when I try to spawn it. All other SmartAoE macros I've tried have worked.
Hello David ! One question. Could it be possible to mix Smart AoE and another script like for example KABOOM. The idea would be to check if the dc is passed or failed (mostly on thuderwave spell for the moment, but could be used for other spells with other scripts i guess), and if failed, trigger the kaboom script which would throw tokens away form caster (with the parameters inserted in a kabomm command). I don't think kaboom alone gives the opportunity to select which tokens are affected by the push effect. Thanks for thinking about it or direct me in a way to achieve this.
1643904462
David M.
Pro
API Scripter
Technically something like that is possible and something I've thought about, though I probably wouldn't call the kaboom script itself for reasons you just mentioned. It gets a little complicated though: 1) using angle between origin and affected token would typically result in tokens landing in-between grid squares, requiring a force-to-square option (which folks would immediately want haha) and the associated calculations (which would also need to take token sizes into account)  2) the forced movement shouldn't push tokens through walls, etc. so would require performing collision detection, etc. and associated logic (what if the token is only partially blocked by the wall, for example). I've done a little of this before but it's still a thing to take into account. So, it's on my radar but due to the above (and my opinion that most players probably prefer to choose the locations of push/pull effects themselves anyway) it's not currently something I'm ready to commit to quite yet.
Hey! I just got into using API scripts and been trying to learn as much as I can via youtube videos like Nick Olivo. I am trying to figure out how or if I can add the sound effects to these AOE spells with this script? I know I could add it in with the Macro after the }} but I want the sound effect to go off after the fx effects happen, is there a way to do that? and is there anymore Macros that are made by the community that I could just put in my game other than the ones on the Wiki page? I'd appreciate any help or guidance! and also love this API!
1644117940

Edited 1644117957
David M.
Pro
API Scripter
Jonathan, I have a few 5e SmartAoE macros posted on github here . Re: sound effects, SmartAoE doesn't natively support them. Your options would be either adding after the }} as you said, or perhaps writing a Scriptcard that calls SmartAoE and triggers an audio effect using the --a syntax as described in the Scriptcard wiki . However, timing with the visual fx is probably never going to be perfect. Visual fx often lag, particularly if you play during peak times (I've had some not fire off until 10+ seconds after they were triggered). So, YMMV.
Thanks for the Macros! and I thought as much, but still loving the API. You do awesome work!
Hey everyone, fairly new here so forgive me if this is a silly question. When I was testing my first macro for Fireball, I found that the fx and damage seem to calculate correctly, but there is no output to chat with the table, rolls ect. Is there something I may have missed in setup?
1644321732
David M.
Pro
API Scripter
Kraken, can you post the macro you are using? Off the top of my head some things that could cause no saving throws: if there are no --dc or --saveFormula parameters defined, if there are no targets that represent characters within the AoE, or if the --saveFormula content is not compatible with the character sheet you are using. What system/character sheet are you using?
Thanks for the quick reply David! I'm currently using the Pathfinder Community Sheet for PF1E which I now see may be the issue. In the sheet there is not one save DC, but rather one per spell level. For example,  spellclass-0-level-1-savedc is 18, where spellclass-0-level-2-savedc is 19.  !smartaoe {{   --title|Fireball   --leftsub|Slot Level ?{Cast at what level?|3|4|5|6|7|8|9|10}   --rightsub|REF Half Dmg   --tablebgcolor|#E53E1A      --controlTokName|AoeControlToken   --controlTokSize|1      --aoeColor|#E53E1A   --aoeOutlineColor|#EA340D   --aoeType|PFcircle, float   --radius|20ft   --minGridArea|0.5   --minTokArea|0.5      --fx|explosion-fire   --saveFormula|PF1Ref   --dc|@{selected|spell_save_dc}      --damageFormula1|[[?{Cast at what level?}d6]]   --damageType1|Fire   --damageSaveRule|*0.5   --instant|1      --autoApply|yes   --bar|1   --zeroHPmarker|broken-heart      --desc|A fireball spell generates a searing explosion of flame that detonates with a low roar and deals 1d6 points of fire Damage per Caster Level (maximum 10d6) to every Creature within the area. Unattended objects also take this Damage. The explosion creates almost no pressure. You point your finger and determine the range (distance and height) at which the fireball is to burst. A glowing, pea-sized bead streaks from the pointing digit and, unless it impacts upon a material body or solid barrier prior to attaining the prescribed range, blossoms into the fireball at that point. An early impact results in an early detonation. If you attempt to send the bead through a narrow passage, such as through an arrow slit, you must “hit” the opening with a ranged touch attack, or else the bead strikes the barrier and detonates prematurely. The fireball sets fire to combustibles and damages objects in the area. It can melt metals with low melting points, such as lead, gold, copper, silver, and bronze. If the Damage caused to an interposing barrier shatters or breaks through it, the fireball may continue beyond the barrier if the area permits; otherwise it stops at the barrier just as any other spell effect does.   }}
1644365858

Edited 1644366056
David M.
Pro
API Scripter
Ok, so the line --dc|@{selected|spell_save_dc} is certainly your problem, then. That is a 5e character sheet attribute. Since the script did not find any tokens representing characters with that attribute, no output. I don't know PF 1e, but if it is truly hardcoded, then it is a simple matter of setting to the correct value for each spell, either: --dc|18 or --dc|19 If there is anything like upcasting in 5e (using a higher level slot for a lower level spell), then adding a query to the dc command would work. Note if no upcasting is possible in that system, then you could simplify your --leftsub line as well. EDIT - I just noticed you have line breaks in the description field. Those will cause the paragraphs to display in the chat outside of the SmartAoE output. You can add as many line breaks as you want in that field using the SmartAoE-specific code %br%
I installed the script and the other required script, and when I select a character (I am selecting it as the GM) and then click on the macro "AoeShortcut_Blast," I enter a radius, and then I type in a word for the effect (which I have no idea what I am supposed to type in there, so I type "Blast). Afterwards, I immediately get this in the chat, " (From Areas of Effect): ERROR: Cannot read property 'rotateOffset' of undefined"--Do you know what is occurring? Also, what am I supposed to type in to the query for the "effect," because it is not clear to me.
1645186819
David M.
Pro
API Scripter
Nathaniel, that error message seems to be coming from another script (I'm guessing the AreasOfEffect script by Stephen L.). That macro is also not one that is automatically installed by SmartAoE. Can you check the contents of that macro to see which script it is referencing? Either it isn't calling SmartAoE, or it is and there might be some kind of conflict between the two. "Effect" also is not a SmartAoE keyword, though "fx" is. The valid syntax for fx is a keyword pair "type-color". From the wiki on special fx : Type  can be one of: beam, bomb, breath, bubbling, burn, burst, explode, glow, missile, nova, splatter Color  can be one of: acid, blood, charm, death, fire, frost, holy, magic, slime, smoke, water Though for SmartAoE I'd for sure stick with the non-directional types. I prefer the "burn" type with this script but you can play around with these manually in the fx toolbar in the VTT to see what effect you'd prefer.
David M. said: Nathaniel, that error message seems to be coming from another script (I'm guessing the AreasOfEffect script by Stephen L.). That macro is also not one that is automatically installed by SmartAoE. Can you check the contents of that macro to see which script it is referencing? Either it isn't calling SmartAoE, or it is and there might be some kind of conflict between the two. "Effect" also is not a SmartAoE keyword, though "fx" is. The valid syntax for fx is a keyword pair "type-color". From the wiki on special fx : Type  can be one of: beam, bomb, breath, bubbling, burn, burst, explode, glow, missile, nova, splatter Color  can be one of: acid, blood, charm, death, fire, frost, holy, magic, slime, smoke, water Though for SmartAoE I'd for sure stick with the non-directional types. I prefer the "burn" type with this script but you can play around with these manually in the fx toolbar in the VTT to see what effect you'd prefer. I looked into the actual macro, and I see you are absolutely right. This is the macro's code: "!areasOfEffectApplyEffectAtBlast @{selected|token_id} ?{Specify radius:} ?{Which effect?|}" Thanks for your help. Also, thanks for explaining the additional information on the fx.
I know I can do this by calling SmartAoE from Scriptcards, but might there be a SmartAoE command for setting the ToolTip on the AOE Token that was just spawned.  Use case: Place a note indicating whose spell/effect and what it is.  For example, "Sparky's Darkness spell"
1645402070
David M.
Pro
API Scripter
Will, not currently but I think that is doable. I've got another update half finished (though haven't been able to work on it all week) so I'll see if I can fit something like this in for the next release.
That would be awesome.  I added ability for the players to chose the base color of the effect, but in a large battle that goes several sessions, I've had 3 or 4 of these effects in place, sitting on top of each other.  I manually add tool tips now, but for it to query the user when it is created would be handy.  
1645403619
David M.
Pro
API Scripter
Will, I was just thinking: you could also leverage the  --controlTokName  command to use a custom token instead of the default " AoEControlToken" bullseye/reticle token. Similar to the SpawnDefaultToken script, you can create a default token (single- or multi-sided) for an AoExxx character sheet, and use that for the SmartAoE control token. It could be as simple as different colors for various characters, or something that actually looks like the AoE effect (e.g. Spike Growth, Evard's Tentacles...) From the wiki (sorry for crammed appearance): --controlTokName <charName> or "self" The name of the character sheet whose token will be used as the AoE control token. If a character name is provided, the default token will be spawned for later positioning. If "self" is used, the AoE will immediately expand around and move with the selected token AoEControlToken --controlTokName|Fireball --controlTokName|self It is generally best if the default token image is a png file with partial transparency to allow the affected grid squares and tokens to be visible. Rollable table tokens are supported. NOTE : "self" can only be used for square/circle aoeTypes with the float keyword and with pre-defined radius NOTE : if "self" is used, then  --controlTokSize  and  --controlTokSide  will be ignored. NOTE : if "self" is used, it is recommended to set  --forceIntersection|0  to prevent the default behavior of centering float AoE's at grid intersections NOTE : default is "AoEControlToken" if this subcommand is omitted. --controlTokSize <#> The size (in squares) of the control token 1 --controlTokSize|8 NOTE : default is 1 if this subcommand is omitted --controlTokSide <#> For rollable table tokens: the side of the control token's image to be set when created 1 --controlTokSide|6 NOTE : default is 1 if this subcommand is omitted   
Is there a link for pre-made spells for 5th edition?  Thanks
Urzoth said: Is there a link for pre-made spells for 5th edition?  Thanks There is a link in the 1st post.
1645553353

Edited 1645553417
David M.
Pro
API Scripter
I have quite a few here , but it's not a complete list. Generally though you can pretty easily modify what's there for other similar spells. Be sure to read the 000_README file first. I have put some notes at the top of each spell listing that should not be copied into your macros. Also, a couple of them might use a custom AoEControlToken "character" that you wouldn't have in your game (e.g. a multi-sided token with different art). Those examples are noted in the top notes section of the individual spells, though. Same goes for a couple that use custom StatusMarkers. Those would need to be modified for your specific game (replaced with another custom marker or with one of the default ones)
This script looks amazing-- thanks for the hard work! I typically tell players what the monster rolled on the die, rather than the modified result in order to keep modifiers mysterious for a little while. I imagine changing the script to do this would be a challenge, but would it be possible to just force all results to whisper to the GM (as if all tokens were on the GM layers)?
1645573657

Edited 1645573673
David M.
Pro
API Scripter
Thanks, Thomas! That should be possible. I'll add it to the list, though see my comments above on timing of the next release - will depend on how things go over the next week or so.
The ControlToken settings actually worked out quite well.  I have a lot of graphical spell templates (fireball, sleep, hypnotic pattern, ...) that I loaded into a roll token.  I was very pleased with how well it worked. 
1645585186
David M.
Pro
API Scripter
Awesome!
For some reason, SmartAoE output cards are suddenly misaligned for me. They're always shifted to the left so that part of the card is obscured. It doesn't matter how much I enlarge the chatbox, either, as it only increases the margin to the right. Any idea why this is?
1645635777
David M.
Pro
API Scripter
egm_melu, this is related to the "enable chat avatars" checkbox value in the "Text chat options" expandable menu in your chat settings, which shifts the left margin of all chat output. There is a command (--chatAvatarsEnabled) with a default value of false that can change the left margin of the chat output to match your settings. So, you can either toggle that checkbox or use the command in your macros as described here .
1645756292

Edited 1645756443
Nate
Pro
This seems to be the catch all Forum for SmartAoE so I'll post here. First off, I'm sure you get it all the time David M. this script is incredible and thank you for an amazing tool! To the question: I was curious if there is or there are plans for implementing support for sound effects? It'd be pretty cool to hear that pounding of thunder in a thunderwave spell or that pesky ringing noise in shatter. Or including support for outside api's such as Roll20AM? Great work again and thank you for your contribution
1645758011
David M.
Pro
API Scripter
Thanks, Nate! Honestly I've never done anything with sound fx before (I use Discord for audio). So, I'm not ruling it out but it's not currently on the near-term radar.
1645810907

Edited 1645810930
David M. said: Thanks, Nate! Honestly I've never done anything with sound fx before (I use Discord for audio). So, I'm not ruling it out but it's not currently on the near-term radar. I'd be curious as to what application you use for sounds on Discord.  I've yet to figure out a great solution for ambient background music/sounds and special effects.  
1645812882
David M.
Pro
API Scripter
Sorry, I mis-spoke while typing quickly. We use Discord for voice , but I use Syrinscape Pro for music/ambient sound. There is a ton of preset content and I can also upload whatever I want. The ability to switch "Moods" (a collection of simultaneous tracks/playlists - music & ambient) with a single click is pretty great. My Players just download the player app and link to my account once.
1645828565

Edited 1645828595
Is there a trick to getting the !smartquery to work?&nbsp;&nbsp; I get the following message whenever I try to activate it: msg.content:Error: Cannot read property 'get' of undefined I created a Trigger-Target macro inside of my Spell-Object sheet (Control Token).&nbsp;&nbsp; !smartquery @{target|Choose a Target|token_id} Example SmartAoE CloudKill macro code: !smartaoe {{ --title|Cloudkill --leftsub|Slot level ?{Cast at what level?|5,5|6,6|7,7|8,8|9,9} --rightsub|DC @{selected|spell_save_dc} DEX --subtitlefontcolor|#ffffff --titlecardbackground|url('<a href="https://s3.amazonaws.com/files.d20.io/images/260967166/J47UNgFC34MYULgv85lBZw/max.png?1639948151');background-size" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/260967166/J47UNgFC34MYULgv85lBZw/max.png?1639948151');background-size</a>: contain; --controlTokName|Spell-Object --controlTokSize|9.5 --controlTokSide|30 --aoeColor|#20872850 --aoeOutlineColor|#208728 --aoeType|circle, float --radius|20ft --forceIntersection|1 --minGridArea|0.25 --minTokArea|0.25 --fx|burn-acid --dc|@{selected|spell_save_dc} --saveFormula|5eCON --damageFormula1|[[(?{Cast at what level?})d8]] --damageType1|Poison --damageSaveRule|*0.5 --ignore|SmartAoE_Ignore,1 --autoApply|1 --bar|1 --zeroHPmarker|dead --desc|You create a 20-foot-radius sphere of poisonous, yellow-green fog centered on a point you choose within range. The fog spreads around corners. It lasts for the duration or until strong wind disperses the fog, ending the spell. Its area is heavily obscured.%br%When a creature enters the spell's area for the first time on a turn or starts its turn there, that creature must make a Constitution saving throw. The creature takes 5d8 poison damage on a failed save, or half as much damage on a successful one. Creatures are affected even if they hold their breath or don't need to breathe.%br%The fog moves 10 feet away from you at the start of each of your turns, rolling along the surface of the ground. The vapors, being heavier than air, sink to the lowest level of the land, even pouring down openings. }}
1645892966
David M.
Pro
API Scripter
Hmm Will, not sure. I tested your Cloudkill macro and used your target syntax and it worked for me. Does this still error out if you try on a different target token?&nbsp; You could try resetting the SmartAoE state object in case something got corrupted. !smartclearcache Note if you have any active AoEs in your game when you run this, they will get orphaned and you'll have to delete all the paths manually. So I'd recommend deleting them before running this command.
!smartclearcache fixed it for me!!!
1645897110
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
David M. said: egm_melu, this is related to the "enable chat avatars" checkbox value in the "Text chat options" expandable menu in your chat settings, which shifts the left margin of all chat output. There is a command (--chatAvatarsEnabled)&nbsp;with a default value of false that can change the left margin of the chat output to match your settings. So, you can either toggle that checkbox or use the command in your macros as described here . I had not considered storing an offset in state! That's always been an annoyance to me that the API can't read and account for that setting. Since you've used this approach, is there any way to account for it on a per-user status?
1645897701

Edited 1645897724
David M.
Pro
API Scripter
Glad to hear it Will! Keith, neither had I lol! It's currently a "per macro instance" option/command (and requires each player to have the same setting in their game - but either setting can be used as long as they are the same). That's a good idea though. I'm glad you thought that I thought of that ;)
I see that a lot of your spell cards includes links to themed banners.&nbsp; Do you build those yourself or is there an online resource you've discovered for those?
David&nbsp; Something I've installed apparently does not get along well with the&nbsp;SmartAoE script. All effects come up with the folioing error.&nbsp; (From SmartAoE): &nbsp;Error: The provided offsets would spawn the controlToken off the map!
1645905374

Edited 1645964566
David M.
Pro
API Scripter
Will: I make those myself using GIMP (rectangle at a 6:1 aspect ratio). EDIT: &nbsp;then I upload to my art library and use this handy little script to get the URL. Daryl: Hm, it's possible that there might still be a bug in there if you are using a non-unity map scale and firing the macro in certain sections of the map. Is that the case for you? If you change to map scale 1 does it go away, or if the caster token is in the upper left quadrant does it go away?&nbsp; I'll poke around and see if I can find a potential problem area. EDIT: If you are using v25, lines 5465 and 5466 look problematic: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let spawnX_max = parseInt(thePage.get("width")) * 70; //page size in pixels &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let spawnY_max = parseInt(thePage.get("height")) * 70; They should probably read as follows: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let spawnX_max = parseInt(thePage.get("width")) * 70 * pageGridIncrement; //page size in pixels &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let spawnY_max = parseInt(thePage.get("height")) * 70 * pageGridIncrement; If you replace those lines, does it fix your problem?
David M.&nbsp;On this day (Master Day) I want to thank you for your work, thanks for helping us with !smartaoe to all the Masters, A hug
1646525989
David M.
Pro
API Scripter
SmartAoE is now on one-click! (I delayed the announcement until I could make sure that it wouldn't blow anything up since it was my first time using script dependencies)
This might be a silly beginner question, but is there a way to modify the base AoE Generator script/token so it queries you on what damage type it does for the FX? I was trying to hijack the things I saw on the wiki and edit them into the token macros for this purpose, but it doesn't seem to be working&nbsp;😅 I figured it doesn't hurt to ask, and if it does my comment will be deleted lol! !smartaoe {{ --aoeType|square, float --radius|5ft --leftsub|DamageType ?{Damage Type?|Fire, Fire|Frost, Frost} --fx|burn-@{Damage Type?} --instant|1 }}
1647310088
David M.
Pro
API Scripter
You were close! When you re-use a query result, you need to make sure the prompt matches the text exactly. Also, Roll20 fx syntax is always lowercase. So, I think this should work: !smartaoe {{ &nbsp; --aoeType|square, float &nbsp; --radius|5ft &nbsp; --leftsub|DamageType ?{Damage Type?|Fire,fire|Frost,frost} &nbsp; --fx|burn-?{Damage Type?} &nbsp; --instant|1 }}
I'm loving SmartAoE.&nbsp; It has become one of my must have APIs.&nbsp; Those being: SmartAoE TokenMod Chatsetattr Scriptcards SpawnDefaultToken I use a few other utility scripts like SelectManager, PingToken and SuperNotes/GmNotes, but adding SmartAoE turns Roll20 into Roll20 2.0 .&nbsp;&nbsp; Will
David M. said: You were close! When you re-use a query result, you need to make sure the prompt matches the text exactly. Also, Roll20 fx syntax is always lowercase. So, I think this should work: !smartaoe {{ &nbsp; --aoeType|square, float &nbsp; --radius|5ft &nbsp; --leftsub|DamageType ?{Damage Type?|Fire,fire|Frost,frost} &nbsp; --fx|burn-?{Damage Type?} &nbsp; --instant|1 }} SO close, thank you! Maybe now I can figure out how to make it do other things LOL !
Is it possible to affect token of another layer with SmartAOE, maybe somehow like the Radar Api does. I am thinking if a Faerie fire could automatically bring invisible Token from the GM to the Token layer