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: I think you would also need to use the --ids syntax for the token-mod command and pass the target token_id that is used by the !smarttrigger command. Make sure the "players can use ids" option is checked (true) for token-mod or this will fail.   Ok.  Thanks for the suggestions. <rolls up sleeves> Time to start experimenting with token-mod.
Hey David M.... pretty great stuff here! I've got it installed, and I've been messing around with it, but I've run into a mild annoyance... and I'm wondering if there's something I'm doing wrong. In short, once I drag and drop the target and the AoE is set, if I move the target to a new spot to adjust it, there's about a six to ten second lag before the target and AoE finally move over. For the sake of this experimentation time, I'm using the follow macro to generate the target... any thoughts on what might be going wrong? I'm on a new Macbook Pro, lots of processing power and no lags in any other area of Roll20 functioning... and this lag occurs regardless of what browser I use (Chrome, Firefox, Vivaldi, Opera). //**************************************************************************************************************************** // 5e Fireball // Author: FR // Prereq's: SmartAoE script // Notes: I use a custom rollable table token "character" for the --controlTokName called GenericSpellAoE, set to image side 5, size 8. // Either delete these three lines, or substitute for your own //**************************************************************************************************************************** !smartaoe {{ --title|Fireball --leftsub|Slot level ?{Cast at what level?|3,3|4,4|5,5|6,6|7,7|8,8|9,9} --rightsub|DC @{selected|spell_save_dc} DEX --aoeColor|#99000050 --instant|1 --gridColor|#99000050 --aoeType|circle, float --radius|20ft --forceIntersection|1 --minGridArea|0.25 --minTokArea|0.25 --fx|burn-fire --dc|@{selected|spell_save_dc} --saveFormula|5eDEX --damageFormula1|[[(5+?{Cast at what level?})d6]] --damageType1|Fire --ignore|SmartAoE_Ignore,1 --autoApply|1 --bar|1 --zeroHPmarker|dead --desc|A bright streak flashes from your pointing finger to a point you choose within range and then blossoms with a low roar into an explosion of flame. Each creature in a 20-foot-radius Sphere centered on that point must make a Dexterity saving throw. A target takes 8d6 fire damage on a failed save, or half as much damage on a successful one.%br%%br%The fire spreads around corners. It ignites flammable Objects in the area that aren’t being worn or carried. }}
1651631668
David M.
Pro
API Scripter
Ugh, that stinks, Craig. I can't currently replicate what you are describing. On rare occasions I'll get a bit of lag, but nothing like 10 seconds. When I have had lag it has always been a transient issue that went away on its own. Do you have any other scripts installed that might be listening for token move events? 
1651632951
David M.
Pro
API Scripter
Sam, regarding thunderwave and an automatic push feature. This would be neat and something that I've for sure thought about before but there are several complications, the biggest one being collision detection with SVG paths (so you can't push through walls, etc.) and circumstantial logic (occupying same space as other tokens, only being partially blocked by a wall, etc.). I've done some line-of-sight calculations before which is similar but implementing this would be a pretty substantial effort. So, not ruling it out but it's not on my near-term radar.   
1651652026

Edited 1651652060
Lionel V. said: David M. said: Ah, the only way I can see that working is to have two separate queries, one in each damageformula. Or you could write a scriptcard that handles that logic with a single query and dynamically builds the smartaoe syntax during runtime. I am traveling and on mobile so I can only offer general advice right now.  Could you help me on the syntax for a damage query ? I can't find the right way... Basically it's something like : Damage = (4d6 + (additional ? if yes > (at what level -5)d6, if no > 0)) but i can't sort myself out of the brackets, curly ones, etc.... :( Hey David, Can you help me with that query ?
Well, David, your question presumes that I would know which of my scripts might be listening for token move events. :) Here's what I have loaded: 5th Edition OGL, Roll20 Audio Master, TokenLock, 5E Resting in Style, Concentration, Vector Math, Matrix Math, Path Math, Door Knocker (disabled), HitDice (shouldn't be relevant), Bump, MarkTurnStartLocation (a TheAaron script, culprit?), Tongues, PingMe (Nick Olivo script found here:&nbsp; <a href="https://www.youtube.com/watch?v=qqCk0sKYhr4" rel="nofollow">https://www.youtube.com/watch?v=qqCk0sKYhr4</a> &nbsp;), TokenMod, WildHelpers, UDLWindows, linbinline, WildShape, and of course... SmartAoE I can try some experimentation to see if disabling one of these makes a difference... but if you have some instincts as to which ones are more likely than others, I will focus on those to begin with. Thanks!
1651664397

Edited 1651664417
David M.
Pro
API Scripter
I don't see anything that jumps out as problematic. TokenLock and Bump both listen for movement but shouldn't be that much overhead. If the problem doesn't magically fix itself, things I would try in order of ease of testing as opposed to probability of success: Run the following command to start over with a clean State[SmartAoE] object. Note that this will unlink any existing AoEs you have on any of your maps, so it's best to not have any of these active or you will be manually deleting a bunch of colored squares! !smartclearcache If you have dynamic lighting active on the map, temporarily turn off. Unlikely issue if regular token movement is unaffected, but it's a simple test.&nbsp; Trying it out on (1) another existing map and/or (2) a&nbsp;new map. I have seen weird behavior on a particular map in my friend's game before. Not lag, but for some inexplicable reason the script wasn't drawing the AoEs at certain relative positioning of source and control tokens. Worked fine on all other maps. Could be something going on with yours. Temporarily disabling those two scripts above (low probability) Trying SmartAoE in a new game. Same lag? If not, then... Creating a copy of your current game to hop servers/shards. Unfortunately, installed scripts don't copy over so this might be a bit tedious. If you go this route, try installing SmartAoE first, check performance, then install the others. Btw, what version of SmartAoE are you running? One-click install?
1651664525
David M.
Pro
API Scripter
Lionel, I'll try to play around with it this evening (I'm US EST) and see if I can come up with something. I will probably try the Scriptcard route.
David... running one-click. I just copied my game and loaded in SmartAoE (and no other API except the dependency), and sure enough... no lag at all. So now it's time to add API's back in one at a time and see which one is causing trouble. Thanks for taking the time to think this through with me!
1651705580
David M.
Pro
API Scripter
Ok, so some progress! Did you try any of the other troubleshooting ideas before copying the game? That's the most tedious one ;) Please report back if you find a smoking gun and I can look into dealing with potential conflicts.&nbsp;
1651707719

Edited 1651708559
I went with the tedious method, mostly because it had been a long time since I had sort of started fresh, and I have noticed that after a few months, things can get a big gummy. And after going API by API, I did manage to find what appears to be at least ONE culprit. The Tongues API, upon installation, caused (or correlated)&nbsp;the behavior to occur. Code is here:&nbsp; <a href="https://github.com/sarkamist/Tongues-Script/blob/master/4.5.3/tongues.js" rel="nofollow">https://github.com/sarkamist/Tongues-Script/blob/master/4.5.3/tongues.js</a> Take a peek... perhaps you see something in there that might be playing poorly? It's a nice bit of functionality, but in all fairness, the novelty of that one has worn off... so I'm happy to leave it off. The weird part was that after discovering the issue, I disabled it, reloaded/respun, and AoE was still super slow. So I deleted the API....... and yup... still, super slow. I have REcopied the game fresh... have added back in APIs... leaving Tongues out of it... let's see what happens, although I'm a bit puzzled as to how it could have somehow permanently impacted AoE behavior. ETA: added all API's back in (other than Tongues), and AoE is working smoothly. That seems to have been the problem child.
1651709273
David M.
Pro
API Scripter
That is so bizarre. I don't see anything in Tongues that would care about moving tokens around.&nbsp; ¯\_(ツ)_/¯
This looks like a wonderful script and I plan to give it a try in my game. I was looking over some of the pre-written spell effects in the spell repository, and doing some testing, and I have questions: 1. How do you turn "off" a spell effect like Spirit Guardian? There doesn't seem to be any "undo", "cancel" or other similar functionality. With some of the spells, like Cloudkill, I can simply delete the token that gets created but there doesn't seem to be anything to delete with Spirit Guardians, nor any way to turn it off. 2. How do you trigger the damage? When I use the Spirit Guardian script, it just puts the radius around the character casting the spell. It doesn't do any damage rolling like the fireball script does, even though I can see in the Spirit Guardian script there is code for doing damage. The action buttons ("Trigger all" and "Trigger target", for example) don't appear. Thanks.
1652209451

Edited 1652209561
David M.
Pro
API Scripter
Saul, refer to the wiki entry section on initial setup . In the 2nd "information" sidebar (blue circle "i") it recommends adding some token actions to character sheets representing casters that use spells centered on themselves. Since the caster is the "control token" for these cases, these macros need to exist on the caster's sheet. &nbsp; With the caster selected, the !smartremove command will "turn off" the spell effect.&nbsp; The other two commands handle triggering for a single target or all targets in the AoE, whichever the spell should use. Trigger-target would be appropriate for Spirit Guardians since it affects creatures at the start of their turn (i.e. not all targets are affected simultaneously)
Hm, okay.&nbsp; I kind of missed that for two reasons: first, the paragraph before it, and the paragraph after it talk about that things are created automatically. I kind of assumed that whatever was needed was installed automatically. Secondly, the paragraph you refer to says "it is recommended". It doesn't say it's required for functionality.&nbsp; And a lot of the wiki talks about how to set things up if you are writing your own macros, but I took the "Spirit Guardians" macro from the spell repository and it didn't say anything there about having to set up anything additional. So, I think what I'm saying is that the documentation could be better. I would recommend, at least, putting something in the "Spirit Guardian" macro in the spell repository as to what else is needed just like in the macro for "Fireball", you have comments there to remove the three lines that set up a different token from the default. FWIW, I did set the "Spirit Guardian" macro on the specific character's sheet. I just missed the other things that had to be set up because those things weren't marked as "required". Oh, and the "Cloudkill" macro does set up the "trigger all" and "trigger target" action buttons and I see nothing in the code to set those up, so that's confusing too.&nbsp;
Another thing: when I use the macro you have in your wiki for Trigger-target, I get the following error after selecting the target token:&nbsp; Error: Cannot read property 'get' of undefined. The target was a monster dropped onto the page from the compendium.
1652222810
David M.
Pro
API Scripter
Sorry for the confusion. I understand and can appreciate that there is a&nbsp; lot &nbsp;of information on that page that can make it easy to pass over important information. There are a very large number of commands and concepts to cover. Setting up those three commands as token action character abilities is not a requirement. They could be in a collections macro or on a macro mule character sheet, for example, or typed directly into chat. However, my recommendation is to set it up on the caster sheet as described. There is also an entry in the wiki that describes the&nbsp; Spirit Guardians macro example &nbsp;(I probably should have pointed you there first!). There is a paragraph that explains triggering and how to remove it. I'll add some more info under this spell on the GitHub spell repository entry, thanks for the feedback. Regarding your error: &nbsp;When you tested, was the target token within the AoE and satisfying the designated (or default) minTokArea condition? Was this for Spirit Guardians? Any modifications from given example? What was the monster?
Yes, the target token was within the AoE and was well within the field, so satisfied the minTokArea. Yes, this was with Spirit Guardians. And no, there were no modifications to the script. Essentially: I went to the repo area and grabbed the script (ctrl-c of the script from the "raw" page), I put the copied script on the individual character's page and added the trigger and remove actions. I then activated the spell on the map. I moved the token that was casting the spell around the map until the field was over a monster. I then clicked the trigger-target button and selected the monster. Got the error. I tried this with two different monsters, both out of the compendium. I think one of them was a minotaur skeleton but don't remember. I also tried Cloudkill with the same procedure - copying the spell from the repository and pasting it into a character sheet. With that spell, trigger-all worked fine, trigger-target did nothing. Suggestion: One of the things I would find useful is: if once you know the cast level of the spell, that the appropriate spell slot is decremented. It's a great script, btw. I showed a demo to my players last night and they wee excited and want to use it. So, I'm in the process of creating buttons for all their AoE spells... thankfully, most of them have examples in the repository and others look like they will be minor changes to the ones already there.&nbsp;
1652287008
David M.
Pro
API Scripter
Resource management was added in v0.25 (described here ) which should allow for spell slot deduction, but ahh it looks like those new commands were never updated on the wiki page :(&nbsp; &nbsp;I'll have to update the wiki this evening! Not sure what is going on with your trigger-target issues. Tried to reproduce on my end but seems to be working. If you want to PM me an invite to your game and promote me to GM I could take a look at your setup sometime this evening and see if we can get to the bottom of it (I'm on EST).
Hi. Thank you for this script. I guess lots of people, like me, will experiment with it after it was recommended by Roll20 blog. So lets start with the dumb questions: Is SmartAoE supposed to work with Aura/Tint Healthcolor script? For me it applies the damage, but the auras are left unaffected
1652448647
David M.
Pro
API Scripter
It doesn't work with the 1-click version of Aura/Tint, as that script needs to be modified to recognize token changes made by specific scripts. I do have a one-off version found here for manual install that registers the SmartAoE script. Note that this version also only uses Aura 2 for health colors, leaving Aura 1 available for setting manually :)&nbsp; If you have other scripts that react to token changes, they would need to be modified as well. This behavior is by design to minimize the chance of unintended runaway scenarios where scripts keep reacting to each other.
Does anyone know the variable that is used in SmartAOE to apply damage to the target(s) in the AoE?&nbsp; I have a home brew spell that after damage is applied the caster gains the HP.&nbsp; I am going to use the SmartAOE scrip within a scriptcard macro and would like to be able to read the applied damage and: takes each targets individual damage applied to --bar|3 and reduce the bar3_Max by that number tally the total damage and add it to the caster's hp in bar3
1652495454
David M.
Pro
API Scripter
John, this seems like it would be problematic. It's going to be a timing thing. Your scriptcard can run first and build the SmartAoE syntax (including damage roll), but then SmartAoE requires additional interaction and another api command to actually trigger the effect (this triggering can't happen in the middle of a scriptcard macro). If the damage is variable due to saving throws then you won't be able to send that total damage info into another macro (scriptcard or otherwise). SmartAoE doesn't store the individual damages or number of targets in a public-facing variable, and while scriptcards has a way to determine distances from a given token, the affected target tokens may not match up between the scriptcards method and your particular SmartAoE area of effect. I'm having trouble thinking of a good way to automate this homebrew spell with SmartAoE. If the area is square then there is a reasonable chance that you could use SmartAoE for graphical representation and then handle all the saves, damage, healing, and chat output with scriptcards. If it is circular or cone, then you'd have to play around with the radius and minGridArea/minTokArea rules to get something that aligns with scriptcard distance calcs. Even then, I couldn't guarantee that the effective AoE's would match up (scriptcards always measures between token centers).&nbsp;
So i cant get the Aura/Tint Healthcolors to work with SmartAOE, is anybody willing to help me.
1652529845
David M.
Pro
API Scripter
Romulus,&nbsp; this post from above should cover it, but let me know if you still have issues.
Hey! I'm sorry, I'm a little stupid, how do I access the "Aoe Generator" menu? I can't find a macro for it anywhere ;^;
1652550583
David M.
Pro
API Scripter
Should be here? On install, did you see a message that the macro was created?
I got it, thanks! It appeared after I reloaded the game a few times David M. said: Should be here? On install, did you see a message that the macro was created?
David M. said: Ok that makes sense.&nbsp; Thanks!
1652654315

Edited 1652654444
Hi, I am trying to make a spell effect with a different control token. But when I click on it nothing happens. I know the code is ok, because once I replace my token name with the AoEControlToken the spell works. I created my token character the same as the AoEControlToken. I'm not sure what I'm doing wrong. I looked around the thread but didn't find anything that explained how to change the token. Did I miss it? Can someone point me to where that information is? Or explain to me how do it? Thanks in advance! I'm adding a picture of what I want to make, it's something like this: <a href="https://wiki.roll20.net/images/7/77/SmartAoE_Ice_Storm_922x499.gif" rel="nofollow">https://wiki.roll20.net/images/7/77/SmartAoE_Ice_Storm_922x499.gif</a>
1652658035

Edited 1652658154
David M.
Pro
API Scripter
To use a custom control token, you will need to make a new character sheet, give it a name, and set the default token to the art that you want to use. Then, in your macro, you will need to add the following lines: --controlTokName|SomeCharName //the name of the character sheet whose default token will be the control token --controlTokSize|&lt;#&gt; //some numeric value --controlTokSide|&lt;#&gt; //Note this line is only needed for multi-sided defaulttokens See the Ice Storm example in the wiki. EDIT - Note that it's recommended to use art with some level of transparency so that terrain features are still visible through the token. You will also need to save in png format to preserve transparency
Default token! That's what I was missing!! Thank you!! :D
1652666266

Edited 1652667960
ugh, spoke too soon... Ok, the image is showing now, but the triggers are not. I checked that all of them are checked and everything. So for testing it I selected the add to the macro bar option. When I clicked on that it said:&nbsp; Error: Cannot read property 'x' of undefined I copied again the original character sheet, added my code and changed the name to my spell. It worked with the original image. I then changed the image to mine and the Triggers don't show anymore.
1652700093
David M.
Pro
API Scripter
When you say the triggers don't show, I'm assuming you mean that there is no chat output (aside from error msg) and not that the the trigger-all, etc. token actions aren't there. The latter would need to be manually added to the character sheet. Since you were having some issues setting this up, there is the possibility that the SmartAoE state object might be corrupted. Try deleting any active AoE's on your map and running the following command: !smartclearcache Then try running your macro again. If it still doesn't work, feel free to PM me an invite to your game and I can try to suss out what is going on. It's hard to troubleshoot from the void :)
1652880584

Edited 1678370281
David M.
Pro
API Scripter
5e Flame Strike Example &nbsp; &nbsp; (requires SmartAoE, Scriptcards, and SelectManager) A while ago Lionel V. had asked about a way to handle the 5e Flame Strike spell. This spell has a base 4d6 damage of two types (fire &amp; radiant), but for every level above 5th it adds 1d6 damage of a choice between the two types. I had suggested that a scriptcard might be the best way to handle this, but due to some quirky interaction between the scripts I was having trouble getting it to work.&nbsp; EDIT - something broke on the backend for this approach. The latest example in my SmartAoE example github repo should be used instead (found here ). I pinged our resident meta-script guru timmaugh, who came up with a deferral method for the inline rolls which seems to work. The example scriptcard below builds syntax to replicate this pattern once passed through the scriptcards parser:&nbsp; !forselected (^) &nbsp;smartaoe {{--title|... --damageFormula1| [^[ 4d6 ]^] ...&nbsp; Here's the scriptcard solution. The only disadvantage I see is that it will query for the extra damage type (fire/radiant) regardless of the spell slot level because of macro order of operations, though the extra damage type will be ignored by the scriptcard. The syntax gets ugly, but seems to be working. !script {{ --#hidecard|1 --&amp;lbrack|{ --&amp;rbrack|} --&amp;lsqbrack|[ --&amp;rsqbrack|] --&amp;lvl|?{Cast at what level?|5|6|7|8|9} --&amp;addDamType|?{Choose extra damage type|Fire|Radiant} --=additionalDice|[&amp;lvl] - 5 --=baseDice|4 --?[&amp;addDamType] -eq "Fire"|[ --=fireDice|[$baseDice]+[$additionalDice] --=radDice|[$baseDice] --]|[ --=fireDice|[$baseDice] --=radDice|[$baseDice]+[$additionalDice] --]| --&amp;damForm1|[&amp;lsqbrack]^[&amp;lsqbrack][$fireDice.Raw]d6[&amp;rsqbrack]^[&amp;rsqbrack] --&amp;damForm2|[&amp;lsqbrack]^[&amp;lsqbrack][$radDice.Raw]d6[&amp;rsqbrack]^[&amp;rsqbrack] --@forselected(^)|SmartAoE [&amp;lbrack][&amp;lbrack] _title|Flame Strike _leftsub|Slot level [&amp;lvl] _rightsub|DC @{selected|spell_save_dc} DEX _aoeType|circle, float _radius|10ft _minGridArea|0.25 _minTokArea|0.25 _fx|burn-fire _dc|@{selected|spell_save_dc} _saveFormula|5eDEX _damageFormula1|[&amp;damForm1] _damageType1|Fire _damageFormula2|[&amp;damForm2] _damageType2|Radiant _ignore|SmartAoE_Ignore,1 _instant|1 _autoApply|1 _bar|1 _zeroHPmarker|dead [&amp;rbrack][&amp;rbrack]| }} &nbsp;I'll add this to the github spell repository.
1652882892
timmaugh
Pro
API Scripter
Hey, David... couple of questions... 1) Should this line: --rcbrack|} ...have started with the same --&amp; as the other variable declarations around it? I think it works because you don't actually use the squiggle bracket variables in the rest of the ScriptCard (that I can see), but I figured I'd ask if anyone wanted to crib off of your code. 2) In the forselected section, you have a couple of @{selected...} constructions. Those will be resolved at the time that the ScriptCard runs... so that by the time SC issues the forselected command, those will be hard-coded to the first token's values ( spell_save_dc and dc ). Is that what you want to have happen? If there is only a single token you're running this for, that's ok... but if you want those to be individualized to each token, you'll want to defer their resolution using either deferred Fetch constructions (introducing the need for Fetch into the set of scripts): @^(selected.spell_save_dc) ...or you can use SelectManager's built-in deferral construction of at(...) : at(selected.spell_save_dc) Then the appropriate value is retrieved at the time the command is run for each individual token.
1652883532

Edited 1652883588
David M.
Pro
API Scripter
Ah, good catch! (1) I'll fix above.&nbsp; (2) Yes, the selected token is going to be the single "caster" and not the potentially multiple targets, so this shouldn't be an issue!&nbsp; Thanks again for your help!
David M. said: When you say the triggers don't show, I'm assuming you mean that there is no chat output (aside from error msg) and not that the the trigger-all, etc. token actions aren't there. The latter would need to be manually added to the character sheet. Since you were having some issues setting this up, there is the possibility that the SmartAoE state object might be corrupted. Try deleting any active AoE's on your map and running the following command: !smartclearcache Then try running your macro again. If it still doesn't work, feel free to PM me an invite to your game and I can try to suss out what is going on. It's hard to troubleshoot from the void :) How would you add spell slot assessment and deduction to it or is it even possible with the way the scriptcard is arranged? I tried to add spell slot assessment and deduction to it, but couldn't get it to work.&nbsp;
1652885328
David M.
Pro
API Scripter
Do you mean for the Flame Strike scriptcard? Your quoted text makes it unclear. Assuming you mean in the scriptcard, we would implement a scriptcard-friendly version of the syntax described here . So for the Flame Strike macro above, try adding this line somewhere within the SmartAoE syntax block &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _resource|lvl[&amp;lvl]_slots_expended,1,Level [&amp;lvl] Slots
David M. said: Do you mean for the Flame Strike scriptcard? Your quoted text makes it unclear. Assuming you mean in the scriptcard, we would implement a scriptcard-friendly version of the syntax described here . So for the Flame Strike macro above, try adding this line somewhere within the SmartAoE syntax block &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _resource|lvl[&amp;lvl]_slots_expended,1,Level [&amp;lvl] Slots Yeah, that's what I meant. Sorry, I quoted the wrong post. Ok, I'll try that. Thanks, Dave.&nbsp;
David M. said: 5e Flame Strike Example &nbsp; &nbsp; (requires SmartAoE, Scriptcards, and SelectManager) A while ago Lionel V. had asked about a way to handle the 5e Flame Strike spell. This spell has a base 4d6 damage of two types (fire &amp; radiant), but for every level above 5th it adds 1d6 damage of a choice between the two types. I had suggested that a scriptcard might be the best way to handle this, but due to some quirky interaction between the scripts I was having trouble getting it to work.&nbsp; I pinged our resident meta-script guru timmaugh, who came up with a deferral method for the inline rolls which seems to work. The example scriptcard below builds syntax to replicate this pattern once passed through the scriptcards parser:&nbsp; !forselected (^) &nbsp;smartaoe {{--title|... --damageFormula1| [^[ 4d6 ]^] ...&nbsp; Here's the scriptcard solution. The only disadvantage I see is that it will query for the extra damage type (fire/radiant) regardless of the spell slot level because of macro order of operations, though the extra damage type will be ignored by the scriptcard. The syntax gets ugly, but seems to be working. !script {{ --#hidecard|1 --&amp;lbrack|{ --&amp;rbrack|} --&amp;lsqbrack|[ --&amp;rsqbrack|] --&amp;lvl|?{Cast at what level?|5|6|7|8|9} --&amp;addDamType|?{Choose extra damage type|Fire|Radiant} --=additionalDice|[&amp;lvl] - 5 --=baseDice|4 --?[&amp;addDamType] -eq "Fire"|[ --=fireDice|[$baseDice]+[$additionalDice] --=radDice|[$baseDice] --]|[ --=fireDice|[$baseDice] --=radDice|[$baseDice]+[$additionalDice] --]| --&amp;damForm1|[&amp;lsqbrack]^[&amp;lsqbrack][$fireDice.Raw]d6[&amp;rsqbrack]^[&amp;rsqbrack] --&amp;damForm2|[&amp;lsqbrack]^[&amp;lsqbrack][$radDice.Raw]d6[&amp;rsqbrack]^[&amp;rsqbrack] --@forselected(^)|SmartAoE [&amp;lbrack][&amp;lbrack] _title|Flame Strike _leftsub|Slot level [&amp;lvl] _rightsub|DC @{selected|spell_save_dc} DEX _aoeType|circle, float _radius|10ft _minGridArea|0.25 _minTokArea|0.25 _fx|burn-fire _dc|@{selected|spell_save_dc} _saveFormula|5eDEX _damageFormula1|[&amp;damForm1] _damageType1|Fire _damageFormula2|[&amp;damForm2] _damageType2|Radiant _ignore|SmartAoE_Ignore,1 _instant|1 _autoApply|1 _bar|1 _zeroHPmarker|dead [&amp;rbrack][&amp;rbrack]| }} &nbsp;I'll add this to the github spell repository. Wow Thank you so much ! that works perfectly ! And the little caveat of asking the additionnal damage whatever level you cast it at is no big deal. Adding a conditionnal to it like "if level is equal or lower than 6 then go straight to this, otherwise go to that" is probably not an easy task playing with all script priorities....
I've set up a smartaoe macro for the tundra aura of a path of the storm herald barbarian.&nbsp; &nbsp;This aura will grant 2 temporary hit points to friendly tokens inside the aura when it is activated.&nbsp; He loves it! I struggled a bit with temporary hit points.&nbsp; I've come up with a workaround that works, but there are two aspects that I'm curious if there is a better way than what I have done.&nbsp; Particularly the second one. 1) Temporary hit points are stored in bar 3.&nbsp; &nbsp;To simulate how temporary hit points are done, I first do two points of "reset" damage to bar3, clear the smartaoe, and then apply a second one doing -2 points of damage to heal it.&nbsp; So people who have more than 2 temporary hit points end up with the same amount they had before, and people with 0 or 1 temporary hit points have them reduced to 0, and then brought up to 2.&nbsp; &nbsp;Is there a one step way to say "set to 2 or the current value, whichever is higher"?&nbsp; &nbsp;For the player themselves I do it with tokenmod, since I can apply that to the selected token. 2) to limit it to friendlies, I have "&nbsp; --ignore|SmartAoE_Ignore,0" in both instances.&nbsp; "&nbsp; &nbsp;The players all have "smartAoe_ignore=1" in case I want to have any negative effects for other triggers that I want to ignore the players.&nbsp; &nbsp;I had hoped that no value for SmartAoE_ignore would be the same as zero, but no such luck, I guess "null" != 0.&nbsp; &nbsp;So instead I set "SmartAoE_ignore=0" on every other character sheet with chatsetAttr.&nbsp; This works for every token that this has been done for.&nbsp; But if I add a new token with a new character sheet and forget to do this, the trigger generates errors for any tokens like that in the aura.&nbsp; &nbsp;Is there a way to do the opposite of ignore?&nbsp; "only do it this if such-and-such an attribute is set."&nbsp; &nbsp;Or some way to negate the ignore test, something like "--ignore|SmartAoE_ignore,!1" ?
1652993625
David M.
Pro
API Scripter
Hm, tough one. I don't really have a satisfying solution for you at the moment. TBH, in my game we just handle temps manually since it's so easy to modify the bar value. I'm going to think about this, but my current thought is to perhaps modify the script to key off of the damageType. For example,&nbsp; if "healing/heal", or "temp/temporary" then add to the bar value, and include some syntax like tokenmod to optionally cap at the max value and/or set to the value if higher than current, etc. This would also simplify healing damageFormulas (the current workaround is anything but intuitive). I'll think about it and see what I can do. Regarding the 2nd item, for now can you just remove the --ignore line from the macro? Since you are triggering off of a target, you should only be clicking the token to buff, right? Long term, maybe an --include command might be the way to go. Would have to figure out how --ignore and include would interact, but it's possible. Another option would be adding reserved keywords like, say, "undefined", "exists", or "!exists" for the attribute value of the --ignore command.&nbsp;
1653006188

Edited 1653006212
timmaugh
Pro
API Scripter
mkanoap said: 1) Temporary hit points are stored in bar 3.&nbsp; &nbsp;To simulate how temporary hit points are done, I first do two points of "reset" damage to bar3, clear the smartaoe, and then apply a second one doing -2 points of damage to heal it.&nbsp; So people who have more than 2 temporary hit points end up with the same amount they had before, and people with 0 or 1 temporary hit points have them reduced to 0, and then brought up to 2.&nbsp; &nbsp;Is there a one step way to say "set to 2 or the current value, whichever is higher"?&nbsp; &nbsp;For the player themselves I do it with tokenmod, since I can apply that to the selected token. So... the MathOps metascript offers a max function. Basically, that portion of your command line (the command line you would otherwise devote to SmartAoE, for instance) would have the max options evaluated, leaving only the greatest of them for when SmartAoE processes the line. {&amp; math max(2, @{selected|bar3})} David might be able to tell you better, but I think you should be able to put something like that in your existing macro in place of the hard-coded reference to bar3. Like I said, by the time SAoE runs the message, it won't see the meta construction, just the value that is left behind.
1653007211

Edited 1653007226
David M.
Pro
API Scripter
Thanks, Tim, but I think the problematic issue is that the "damage" formula (well, temp hp formula in this case) is processed when the AoE is brought into existence. All the relevant AoE characteristics are stored in the state object at this time. Since mkanoap's example is a persistent effect that gets triggered once/rd, it requires a separate macro to trigger the temp hps. This 2nd macro reads the token_id of a single target and looks at the state object for the damageFormula associated with the AoE that the token is within. On subsequent rds, it could be a different target, etc. If it were an instantaneous effect, then something like this could possibly work with a @{target...} call. But since you'll have no idea who the target(s) will be at the time the persistent AoE is created, I don't see the MathOps solution being helpful in this case. Unless I'm misunderstanding what you're saying?&nbsp; &nbsp;
1653013970
timmaugh
Pro
API Scripter
Ah... ok. I was missing the interaction of the game rule and the fact that SAoE uses the state across multiple rounds/targets. That does make it more difficult...
David M. said: ... Regarding the 2nd item, for now can you just remove the --ignore line from the macro? Since you are triggering off of a target, you should only be clicking the token to buff, right? Long term, maybe an --include command might be the way to go. Would have to figure out how --ignore and include would interact, but it's possible. Another option would be adding reserved keywords like, say, "undefined", "exists", or "!exists" for the attribute value of the --ignore command.&nbsp; I'm triggering it off the barbarian himself, and the way I have it now with the workarounds does not require the player to pick every friendly target.&nbsp; He just wades into the the fray, and says "I'm using a bonus action to refresh my aura."&nbsp; &nbsp;And then every friendly in range gets two temp hit points, and every enemy doesn't.&nbsp; &nbsp;If I required him to pick all the targets, it would be much simpler, but I'm trying to speed up combat. Like I said, I have these workarounds, I was just curious if I was missing anything.&nbsp; I appreciate your attention, and an "--include" option would be nice to see if you are looking for feature enhancements, but I'm able to get along without it for this use case.&nbsp; Thanks! Oh, and if I could pick just one feature enhancement, it would be to allow for results to be whispered or even silent.&nbsp; Because my workaround spams the chat with "dealing 2 'resetting' damage" followed by "dealing -2 healing damage" every time.&nbsp; I would be nice to suppress the first one, and I imagine there might be other cases where the GM didn't want everyone to see the result of on AOE effect.
Hi all, apologies if this has been answered before. Does anyone know how to apply damage to bar 3 if a value exists (temp HP for example), but if no value exists apply to bar 1 (HP)?
1653221750

Edited 1653221842
David M.
Pro
API Scripter
EDIT - I almost replied that it couldn't be done currently. I had forgotten that this was a feature lol.&nbsp; Andy, try this --bar|3,1 From the wiki (sorry for the terrible copy/paste formatting) Command Parameter(s) Description Default Value Example(s) &nbsp; Additional Notes --bar &lt;#, optional #, optional #&gt; which token bubble(s) to apply damage. Default = 1 1 --bar|1 --bar|3,1 --bar|3,1,2 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" done