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 .
×
D&D 2024 has arrived! Pre-order the new core rulebooks now and get an exclusive pre-order bonus for free!
Create a free account

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

Thanks so much David! This script has literally changed the way we play D&D online
David M. said: Hmm. Would it work if you explicitly added this line?   --resistanceRule|*1 Untested, but that should just multiply any damage matching one of the types in the npc_resistances attribute by 1. You might be able to turn that into a query if you want the same macro to handle the spell for those with/without the feat. Query result would be either *1 or *0.5.  Note that if you had a spell with multiple damage types and only one type matched the adept type, this would break the math for the non-adept type. This should be very rare, though. Hey sorry for the late response, and thank you for your own. I was actually referring to the part of Elemental Adept that makes rolled 1s into 2s.
1653708752
David M.
Pro
API Scripter
Nico, you could create rollable tables for the relevant die types. The table would not include 1's, and you would double the weight of 2's. The following would be an example damage formula for a Fireball, using 1t[tablename] syntax   --damageFormula1|[[(5+?{Cast at what level?})t[d6Adept]]]
Apologies if it's been asked before (my searching hasn't resulted in any hits), but when using the script on a map scaled to 0.5 cell width the AoE shape shape appears in the center of a square instead of on an intersection of squares and outputs odd measurements. See the example below when using 20 ft square. This is result when using the script on a map with cell width of 1.0 and it produces a 20 ft square AoE as expected. Would I need to create a second AoEControlToken with measurements specific to maps with a 0.5 cell width?
1654261439
David M.
Pro
API Scripter
Are you using  --forceIntersection|1   for both examples? I just tried it out on my test game with cell width = 0.5 and it seems to snap to intersection correctly for me. 
That seems to be the trick. I added that subcommand to each of the cast at range circle/square shapes. Thanks!
Both I and my players are loving this script. Except that it sometimes fails for us sort of quietly. I suspect the API sandbox is dying without any kind of warning or error. But, that's beside the point. I'm trying to do the Druid spell Sunbeam. This is a concentration spell that is repeatable each turn. It also creates light in the character's hand that lasts while the spell lasts. So, I've created two actions: SunbeamOn and SunbeamOFF. SunbeamOFF just issues a !smartremove command and a !tokenmod command to undo the !tokenmod done in the SunbeamON macro. SunbeamON looks like this: !smartaoe {{ &nbsp; --title|Sunbeam &nbsp; --leftsub|Slot level 6 &nbsp; --resource|lvl6_slots_expended,1, Level 6 Slots &nbsp; --rightsub|DC @{selected|spell_save_dc} CON &nbsp; --titlecardbackground|url('<a href="https://s3.amazonaws.com/files.d20.io/images/248538196/c9xft1A2jWNqOkBsxQwyLQ/max.jpg?1633278017');background-size" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/248538196/c9xft1A2jWNqOkBsxQwyLQ/max.jpg?1633278017');background-size</a>: contain; &nbsp; --subtitlefontcolor|#ffffff &nbsp; --oddrowbackground|#2c2775 &nbsp; --evenrowbackground|#c0bfd6 &nbsp; --oddrowfontcolor|#ffffff &nbsp; --tablebgcolor|#c0bfd6 &nbsp; --aoeColor|#0044ff50 &nbsp; --aoeType|line &nbsp; --radius|60ft &nbsp; --width|5ft &nbsp; --forceintersection|0 &nbsp; --fx|beam-holy &nbsp; --dc|@{selected|spell_save_dc} &nbsp; --saveFormula|5eCON &nbsp; --damageFormula1|[[6d8]] &nbsp; --conditionfail|Blinded &nbsp; --damageType1|Radiant &nbsp; --zeroHpMarker|dead &nbsp; --autoApply|1 &nbsp; --bar|1 }} !token-mod --on emits_bright_light emits_low_light --off has_directional_bright_light has_directional_dim_light&nbsp; --set bright_light_distance#30 low_light_distance#30 directional_bright_light_total#0 This works... sort of. The token-mod doesn't work. It works by itself if I just do that from the chat, so I know the command is correct but doesn't work in the macro. Do I need to specify the token? Oddly, it sometimes seems to work but only after I've done a !smartremove. And SmartAOE seems to be ignoring walls and doors. The map has DynamicLighting turned on, and walls and doors are defined on the map. SmartAOE just blasts through the walls and doors. SmartAOE also seems to be ignoring the --conditionfail setting.&nbsp; Finally, the SmartAOE color that appears on the screen is black, not the blue that's specified. Am I doing something wrong or are these things bugs?
1654442435
David M.
Pro
API Scripter
Saul, a couple things: --You may be running into the Roll20 bug where multiple api commands in a single macro sometimes drops one or more of those commands. I just ran your macro in my test game and got mixed results. Sometimes the token-mod call worked and other times not. I seemed to have better luck putting the token-mod line at the start of my macro, but YMMV as I only ran it about 10 times. --SmartAoE does not currently interact with dynamic lighting. I'd like this to be a future feature, but it's going to take a pretty sizeable effort as there is a ton of math already involved in the script.&nbsp;&nbsp; --Re: conditionfail - This is a custom statusmarker? You will need to include both the name and the number associated with the custom marker. Check out your token-mod handout to find the "name:number" pair that you are looking for. --The aoe color was blue for me, so not sure what is going on there?
David M. said: Saul, a couple things: --You may be running into the Roll20 bug where multiple api commands in a single macro sometimes drops one or more of those commands. I just ran your macro in my test game and got mixed results. Sometimes the token-mod call worked and other times not. I seemed to have better luck putting the token-mod line at the start of my macro, but YMMV as I only ran it about 10 times. --SmartAoE does not currently interact with dynamic lighting. I'd like this to be a future feature, but it's going to take a pretty sizeable effort as there is a ton of math already involved in the script.&nbsp;&nbsp; --Re: conditionfail - This is a custom statusmarker? You will need to include both the name and the number associated with the custom marker. Check out your token-mod handout to find the "name:number" pair that you are looking for. --The aoe color was blue for me, so not sure what is going on there? I'll try putting the token-mod call at the beginning and see if that works better. The statusmarker is not a custom marker. It's a standard marker. There's another API that sets the link between the name "Blinded" and which marker I want to use. I believe it's "statusinfo". I don't know what the aoe color is not working. This is not the first time that colors have not worked for me. Sometimes they do, sometimes they don't.&nbsp; As for the Dynamic Lighting barriers... aren't there system calls in the graphics libraries that can be called to make use of the barriers, in the same way that lighting works with the barriers? I don't know - I'm guessing here since I don't know how much the Roll20 internals interact with the Javascript.&nbsp; But, knowing that it's not supposed to work at the moment helps. :-)
1654470642
David M.
Pro
API Scripter
For standard status markers, you'll need to use the official name of the marker. For example "bleeding-eye". These names can be found by mousing over the marker radial menu or by looking into the token-mod help handout. Here is mine for example: Re: DL interaction - it's definitely not impossible, but it's not a simple "add some library and call it a day" solution. I've done some simple ray tracing DL interaction with my Radar script which has checks for line of sight. SmartAoE will be much more involved than that, as you can get some pretty funky polygons when you overlay an aoe outline with arbitrary walls. I have to find intersection pts of the outline with all SVG paths on the DL layer, then on a gridSquare-by-gridSquare basis determine which parts of that new funky-shaped polygon are "inside" and "outside" of the aoe and calculate the area of the correct bits to compare to the user-defined mingridArea (see graphic below showing two of those areas). Sometimes the wall SVG points won't even define the correct intersection points as seen by the lower highlighted pink region below if line-of-effect is used. Then, what about spells that spread around corners (e.g. fireball)? Would need to check for contiguous areas relative to origin pt, etc. Oval shapes can also exist on the DL layer, so I'd probably need to check for that and "pointify" those shapes since the SVG path only includes minimum control pts. Add to all that the script supports rectangles, circles, rounded cones, 5e "triangle" cones, and lines (using a completely different algorithm for lines, btw) and you've got a real project! So again, something that I'd really like to do sometime, but taking that plunge is a bit daunting :)&nbsp;
I was thinking how to do this without modifying the script; I thought just to remove the block(s) in the aoe for tokens that are behind cover before triggering, but that throws an error. It also doesn't account for dex saves and cover. Then I thought what if the script could be modified to look for a certain status marker on the token that indicates whether that token has cover and whether it is total, half or 3/4, and not roll the save (total cover), give +2 if dex save and half cover, or +5 if dex save and 3/4 cover? Would that be more doable?
1654497671

Edited 1654498844
So, Im using this API for a pathfinder game im running, I followed the tutorial linked in the wikki post and managed to get it all working but for some reason its not posting the results into my chat on the game, please could I get some assistance with that. !smartaoe {{ --title|Fireball --leftsub|Caster Level?{Caster Level?|3|4|5|6|7|8|9|10} --rightsub|DC @{selected|spellclass-0-level-3-savedc} DEX --titlecardbackground|linear-gradient(red, orange) --oddrowbackground|#fa9a00 --evenrowbackground|#edfcfc --oddrowfontcolor|#000000 --tablebgcolor|#edfcfc --controlTokname|AoeControlToken --controlTokSize|1 --aoeColor|#ff000050 --aoeOutlineColor|#ff0000 --aoeType|PFcircle, float --radius|20ft --minGridArea|0.25 --minTokARea|0.25 --fx|burst-fire --dc|{selected|spellclass-0-level-3-savedc} --saveFormula|&lt;&lt;1d20 + a{Ref}&gt;&gt; --damageformula1|[[(?{Caster Level?})d6]] --damageType1|Fire --instant|1 --autoApply|yes --bar|1 --zeroHPmarker|dead --Desc|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. }}
1654513672
David M.
Pro
API Scripter
Squares fully out of LoS/LoE would be the easiest part (assuming no "spreading around corners" effects). It's the partial squares that cause all the headaches. Again, not impossible, just need to find a big chunk of time to dedicate to this. Definitely not this month.&nbsp;&nbsp; Doug E. said: I was thinking how to do this without modifying the script; I thought just to remove the block(s) in the aoe for tokens that are behind cover before triggering, but that throws an error. It also doesn't account for dex saves and cover. Then I thought what if the script could be modified to look for a certain status marker on the token that indicates whether that token has cover and whether it is total, half or 3/4, and not roll the save (total cover), give +2 if dex save and half cover, or +5 if dex save and 3/4 cover? Would that be more doable?
1654513875
David M.
Pro
API Scripter
Nexus, the first thing that jumps out at me is this line: --dc|{selected|spellclass-0-level-3-savedc} Looks like you are missing an @ before the attribute, so this would result in an undefined DC.
Okay, that is still not helping with the fact that its not displayhing a messgae in the chat with what was rolled
1654520999
David M.
Pro
API Scripter
Ok Nexus, so this is kinda weird. It seems like when the case-sensitive controlTokName is misspelled, the chat doesn't output. I'll have to track down that bug. The good news is that when changing the line to this, it will start outputting correctly. --controlTokname|AoEControlToken The other good news is that if you are using the default control token, you don't even need to include the controlTokName or controlTokSize parameters, as the script will just use the default automatically. This is probably best practice just to avoid any potential typos. Also FYI, the&nbsp;titlecardbackground, aoeColor and&nbsp;aoeOutlineColor you are using are also the same as the defaults, so you could remove those lines if you wanted to tidy up the macro but it doesn't hurt anything to leave them in either.&nbsp;
1654566878

Edited 1654566898
Well I will now say thankyou for that, that honestly helped, though comically I am now stuck again with a differnt problem, I am trying to make a cure wounds spell which works off increase the the extra life they gain not incremental dice roll, so a caster level 8 who cast's cure moderate wounds would do 2d8+8. But im getting instead 22d8 + nothing. !smartaoe {{ --title|Cure Moderate Wounds --leftsub|Caster Level?{Caster Level?|2|3|4|5|6|7|8|9|10} --titlecardbackground|linear-gradient(Blue, Cyan) --oddrowbackground|#00FFFF --evenrowbackground|#edfcfc --oddrowfontcolor|#000000 --tablebgcolor|#edfcfc --controlTokname|AoEControlToken --controlTokSize|1 --aoeColor|#00FFFF50 --aoeOutlineColor|#00FFFF --aoeType|square --radius|5ft --minGridArea|0.25 --minTokARea|0.25 --fx|Nova-Holy --noSave|1 --damageformula1|[[0 + [[0 - 2]]2d8]] --damageformula2|[[(?{Caster Level?})[[0 + [[0 - 2]]1]] --damageType1|Healing --damageType2|Healing --instant|1 --autoApply|yes --bar|1 --Desc|Healing spell (this is none important information) }}
1654568604

Edited 1654568641
David M.
Pro
API Scripter
You should be able to combine everything into a single negative damage roll: --damageFormula1|[[0 + [[0 - 2]]d8 - ?{Caster Level?}]]
I'm trying to figure out how to reference the spellcasting ability while building out a healing spell that heals 1d4+spellcasting ability modifier when cast a level 1, then adds an additional 1d4 for each slot level above 1st. &nbsp; --noSave|1 &nbsp; --damageFormula1|[[0+[[0-(?{Cast at what level?})]]d4]] &nbsp; --damageType1|(Healing) &nbsp; --ignore|SmartAOE_ignore,1&nbsp; &nbsp; --instant|1 But when I add the following code into the damageFormula1 field it ceases to work -@{selected|spellcasting_ability} What might I be doing wrong here? Is anyone able to help me build this coding?
1655037497
David M.
Pro
API Scripter
Wambamnec, assuming this is the 5e by Roll20 sheet? What is returned in chat if you select the token and just type&nbsp;@{selected|spellcasting_ability} directly into chat? When I try it, it returns something like "3+". This is obviously going to be a problem as-is, since the formula would end with a plus. I would either directly reference the specific attribute mod, or I suppose you could add a "0" to the end of the "spellcasting_ability" attribute call like below, which would turn it into something like "3+0". [[0+[[0-(?{Cast at what level?})]]d4-@{selected|spellcasting_ability}0]] Note that if you have a negative spellcasting ability modifier this will break, as you will get a --3 type construction. And if the attribute ever does not end in a plus, you'll end up subtracting 10x the modifier since the 0 will just be directly appended to the number. So, just things to keep in mind.
David, yes this is the 5e by Roll20 sheet. I do get the similar output of 3+ on one of the characters, or 2+ on others depending on what their attribute score is for their spell casting ability modifier. Now that I am thinking about this, I pulled the @{selected|spellcasting_ability} code from the Attributes &amp; Abilities tab on the character sheet, Roll20 probably queries this prior to adding in the d20 roll normally which might lead to the additional + at the end. The code that you provided has made it work for the time being. I will definitely keep in mind to not use this macro if the spell casting ability modifier is negative on a character. Thank you so much!
Hello all, New here. Is there a way to make the --ignore command not=x? Thanks,
1655723204
David M.
Pro
API Scripter
Dranik, not currently, though this was brought up by another user a couple weeks ago. I have a couple of ideas how this could be handled, though my schedule this month is pretty crazy. What is the scenario you are trying to deal with?
So is there any why to get the Square to rotate? as it does change what the AoE can hit, including a picture for example.&nbsp;
1656112030

Edited 1656112104
David M.
Pro
API Scripter
There is unfortunately no rotate function at this time, though it's something I could add to the growing list of things to look into when I get a big block of time. I do have a fiddly and not very satisfying option, using the "wall" aoeType with width=radius. This spawns two control pts (origin and angle control) that you'd have to adjust one at a time. Again, not ideal, and definitely not something you'd want to do for normal orthogonal use, but I'm including it here in case you wanted to play with it. You'll also have to pay attention to the minGridArea to get the coverage your looking for, since it is possible to cover more or fewer squares with this method. !smartaoe {{ --aoeType|wall, float --forceIntersection|1 --width|20ft --radius|20ft --minGridArea|0.25 }} A bit funky due to the origin pt being on the perimeter of the control token square, but might work in a pinch? FWIW, in my games we just accept the orthogonal abstraction of the aoe effect for the sake of expediency, but I can understand that is not going to be true for everyone.&nbsp;
I'm running a chromatic greatwyrm in the upcoming finale of a multi-year Eberron campaign, but I can't get a cone to work beyond 150'. Is that just the limit? I would really love to wow...or terrify...my players with the immense 300' cone of poison, and this script is just so epically great for that. I would hate to have to go back to drag and drop templates.
1656697209
David M.
Pro
API Scripter
Wow, that's huge! What map size are you using? In order to handle aoe's that extend beyond the limits of the map (e.g. you're near the upper left corner of map and aim the cone up), I make certain assumptions based on the map size (as I have to calculate the nearest grid center, etc. for a given arbitrarily angled cone). A good rule of thumb is to have the minimum dimension (width and height) of your map be at least 1.5 times your aoe "radius". If it's too small, apparently the script will fail silently (no error msg and won't crash the sandbox).&nbsp; Empirically, I found that a minimum map size that I could get a 300ft cone to work was 86x86 squares (5ft squares). (Again, the 1.5x dimension is just a rule of thumb.) This was pretty laggy, as you might expect. So as for how useful this script will be for your application, YMMV.
Thanks David. I was wondering if the map size was what was holding me back. I'm already using a 44x66 squares map. As you pointed out, going much bigger will get quite laggy. Oh well. It was worth a shot.&nbsp;
1656700518
David M.
Pro
API Scripter
If on that map you don't use dynamic lighting, or really limit the number of walls/lines, then the map itself prob won't be too bad. The AoE cone effects will likely be laggy though, due to the literally tens of thousands of calculations that will happen every time you move the source or control tokens for a cone of that size.&nbsp;
IsauraS said: 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. Not sure if you have gotten this resolve.&nbsp; I had the same issue with the smartaoe and spawndedefaulttoken WHEN using templates from the marketplace even if you move them to your library.&nbsp; Check the token's URL/URI (either with the Aarons url script or Z), if the work marketplase is jn the path, save the image to your local device and the&nbsp; reupload to your library and the problem goes away.
I found an "odd" thing when testing this (which I am falling in love with BTW), that is when the DM is greater than the HP of the token, the HP goes negative which messes up other scripts designed to deal with "dead" creature.&nbsp; Is there a way to make this NOT set HP to negative?
1657019667
David M.
Pro
API Scripter
Hmm, my only experience with other scripts that deal with "dead" creatures is Aura Health Tint, which checks if hp &lt;= 0 so still works. What is the other script are you referring to? I want to keep the ability to go negative, since this the intent is for the script to be as system agnostic as possible and many do use negative hp (even in 5e you die if you go to "negative" max hp value from a single hit). That being said, I could add an option to not go below a minimum value. I'll add it to my list of about 10 things I want/need to look at with this script haha.
SmartAoE is great! For that reason, I'm using it a lot. Now I found a small issue: If you set a save but there is no damage, nothing appears in the chat. The wall is formed in the map as normal, but no entry in the chat.&nbsp; As suggested, I tried: &nbsp; --damageFormula1|0 but to no avail. Even: --damageFormula|[[0]] does not work. But: --damageFormula|[[1]] works... And: --damageFormula|[[0-1]] works as well. It is as if --damageFormula didn't accept a 0 value of any kind. Thanks!
1657983824
David M.
Pro
API Scripter
Can you post your full macro?
1657986236

Edited 1657986302
Here it is in working form (with --damageFormula|[[1]]): !smartaoe {{ --title|Wall of Stone --leftsub|15 5 ft. squares, 3'' thick --rightsub|DC 23 Reflex --aoeType|wall --forceIntersection|0 --width|5ft --origin|nearest, face --minGridArea|0.5 --minTokArea|0.5 --fx|burn-charm --dc|23 --saveFormula|&lt;&lt;1d20 + &lt;&lt;0a{Ref}&gt;&gt; + &lt;&lt;0a{CGen_Ref}&gt;&gt;&gt;&gt; --damageFormula1|[[1]] --ignore|SmartAOE_ignore,1 --instant|0 --playerID|L6wcxCfg9emuY3j6MBN --desc|El famoso muro de roca }}
1657987052
David M.
Pro
API Scripter
Hmm, I'm getting chat output using either --damageFormula1|1 or --damageFormula1|0. I tried trigger-all and trigger-target to cover the bases. Did you have a valid target within the shaded AoE region?
David, if you are in the mode of making future enhancement requests, here is one: * Allow Line type to utilize both length and width parameters.&nbsp;&nbsp; Currently, a line can only be 5' wide.&nbsp; It would be nice to create a 10' wide line originating on the caster.&nbsp; I tried utilizing the Wall type, but it didn't quite work well for a line.
1657995312

Edited 1657996435
You are right, the problem arises if there is no target (as often happens with a wall). If there is no target, --damageFormula1|1 and --damageFormula1|[[1]] work, but --damageFormula1|0 and --damageFormula1|[[0]] don't. If there is no target, --damageFormula does not accept zeroes. David M. said: Hmm, I'm getting chat output using either --damageFormula1|1 or --damageFormula1|0. I tried trigger-all and trigger-target to cover the bases. Did you have a valid target within the shaded AoE region?
1658014083
David M.
Pro
API Scripter
Will, line types with a width get a little wonky due to how you are to define the "width". It would really depend on the relative angle of the caster to the control token. E.g. for a 10ft wide "line" do you add the width to the top/bottom/left/right? Along the center line would prob require a high minGridArea to prevent wider lines than expected, but might also then result in thinner lines than you'd want for certain angles. In contrast, line types currently don't follow the "normal" rules for how the affected areas are determined. For all other types, an area is outlined and the percentage of overlapping area is calculated based on minGridArea. Line types instead use the Bresenham algorithm for determining affected "pixels" (squares) between two points. I'd have to figure out how that would/should interact with the map/token geometries so that it would make sense for the majority of game systems.&nbsp; The wall type is the closest thing to an existing solution, as you mentioned. I would play around with various --minGridArea and --forceIntersection settings to see if there is something that is a reasonable approximation. If it were me, I'd probably start with walls with --forceIntersection|1 and --mingridArea|0.51-0.75. For orthogonal directions, a [0.51 min area] 10ft wide, 120ft line gives 48squares of coverage orthogonally, 49 squares at the 45 degree diagonals, and 50 squares at around 30-ish degree angles. Pretty close. 0.75 looks pretty good too, imo. The 30-ish deg angles are the worst offenders, as they often will catch 3 squares adjacent to the caster token.&nbsp;
David - you are nailing exactly the issues I was having with wall and I absolutely understand the issue with 30 degree lines. &nbsp;For a 10’ wide line, &nbsp;I’ve decided to use the 5’ wide line as a base and have the player (or me) indicate what side the other 5’ follows the base on. &nbsp; Not all solutions have to be technical. &nbsp; Thanks for developing this great script. Will
David I am new to your script and I love it! Thank you for SmartAoE. I am wondering if you or anyone else can tell me how to call a macro-mule macro from within a spell description. Keithcurtis shows us in another thread that it can be done for a Macro that is in the collections: [Wild Magic Surge?](!&amp;#10;#WildMagicSurge) What I can't get it to do is call a macro that is in a Macro-mule. Any help is appreciated.&nbsp;
1658081284
David M.
Pro
API Scripter
KoS, try this syntax: [buttonText](~sheetName|abilityName)
Thank you David! I must have had a brain fart, I thought that I had tried that syntax, yes it does work!
Say, is there a way to simply set a bar to a new value? I was thinking 5e Twilight Sanctuary and temporary HP. Currently, I can get the bars to increase and decrease in value, but not just set them to a new value. Or is there a way to reference the target's current bar value in the damage formula? Thanks in advance!
1658248517
David M.
Pro
API Scripter
Pusikas, that's not currently possible. I would personally just use an aura for that ability, and a token-mod macro to apply the temps. Something like this (using bar3 as example)? !token-mod --set bar3_value|[[{[[0d0+@{selected|bar3}]],[[1d6+5]]}kh1]] --report all|"**Twilight Sanctuary**: Previous temp hp = @{selected|bar3}. Rolled $[[1]]." Or a scriptcard to make the adjustment and have nicer looking and more robust/flexible display than the token-mod report function. This uses the object modification feature of scriptcards which doesn't require a token-mod call. !script {{ --#title|Twilight Sanctuary --#sourcetoken|@{selected|token_id} --#targettoken|@{target|select target|token_id} --#emoteText|[*T:t-name] starts their turn within the zone of Twilight --=roll|1d6+[*S:level] --=currentTemps|[*T:t-bar3_value] --+Roll|[$roll] [b]vs. Existing temp hp[/b] [$currentTemps] --?[$roll] -gt [$currentTemps]|[ --!t:[*T:t-id]|bar3_value:[$roll] --+Temp hp increased to|[$roll] --]|[ --+Temp hp unchanged| --]| }}
Having an issue with SmartAOE where it is not applying damage anymore.&nbsp; I'm using slightly modified version of Nick O.'s script from his youtube video.&nbsp; Everything works except damage is not being applied.&nbsp; Am I missing something??? !smartaoe {{ &nbsp; --title|Ball AoE (Dex Save) &nbsp; --rightsub|DC ?{Spell Save DC?} &nbsp; --titlecardbackground|linear-gradient(blue, cyan) &nbsp;&nbsp; &nbsp; --oddrowbackground|#00ccff &nbsp; --evenrowbackground|#edfcfc &nbsp; --oddrowfontcolor|#000000 &nbsp; --tablebgcolor|#edfcfc &nbsp;&nbsp; &nbsp; --controlTokName|AoEControlToken &nbsp; --controlTokSize|1 &nbsp;&nbsp; &nbsp; --aoeColor|#00ccff50 &nbsp; --aoeOutlineColor|#0099ff &nbsp; --aoeType|circle, float &nbsp; --radius|?{Radius?}ft &nbsp; --minGridArea|0.25 &nbsp; --minTokArea|0.25 &nbsp;&nbsp; &nbsp; --fx|burst-holy &nbsp; --dc|?{Spell Save DC?} &nbsp; --saveFormula|?{SaveType|Normal,5eDEX|Advantage,&lt;&lt;2d20kh1 + a{dexterity_save_bonus}&gt;&gt;|Disadvantage,&lt;&lt;2d20kl1 + a{dexterity_save_bonus}&gt;&gt;} &nbsp;&nbsp; &nbsp; --damageFormula1|[[?{Damage Roll?}]] &nbsp; --instant|1 &nbsp;&nbsp; &nbsp; --autoApply|yes &nbsp; --bar|1 &nbsp; --zeroHPmarker|dead }}
1658606725

Edited 1658606874
David M.
Pro
API Scripter
The closing curly braces in the adv/disadv query for damageFormula1 is messing up the query. Try replacing the interior "}"'s with the html code "&amp;lbrace" like this: &nbsp; --saveFormula|?{SaveType|Normal,5eDEX|Advantage,&lt;&lt;2d20kh1 + a{dexterity_save_bonus&amp;lbrace;&gt;&gt;|Disadvantage,&lt;&lt;2d20kl1 + a{dexterity_save_bonus&amp;lbrace;&gt;&gt;}&nbsp; EDIT - Note that the following lines are not necessary since they are just setting the parameters to the default values. Doesn't hurt anything to have them, but just in case you want to streamline your macro :) &nbsp; --controlTokName|AoEControlToken &nbsp; --controlTokSize|1 &nbsp; --bar|1
I'm new to this script and I've been looking around, reading the wiki, the forum here and experimenting. Wonderful script!!! I understand that the usual way to go about adding spells to use the script is through macros that you have to activate ("press the button"). I was wondering if there would be a way to have the API "listen" to the spell being cast through "normal" means (such as directly from the sheet) and then activate the spell. Note: I don't care much for the autoApply feature, to be honest. I'm really looking for a way to determine the areas when the spell is cast. Thanks in advance. Marvelous work!
So, here I am again. I believe the answer to my previous question is probably "no" (advanced a bit in the documentation). Nevertheless, I'd like to know if that could somehow be possible. But as I tried to implement your example Ice Storm macro, I keep getting the following message: &nbsp;(DM) Unable to find imgsrc for default token of (undefined) You must use an image file that has been uploaded to your Roll20 Library. I have uploaded the image to my Library (from my purchased assets), but it still shows this message. I tried deleting the 3 lines dealing with the token controller and the default token controller worked just fine. Thanks in advance and cheers, Alryon
1659614514
David M.
Pro
API Scripter
Alryon, listening for chat events is really outside the scope of this script. You may want to check out the Customizable Roll Listener script. I've never used it but it looks like you can trigger macros based on the content of things sent to chat. See the "Saving Throw Trigger" example at the bottom of the link for how to trigger a macro mule ability. I imagine you could set the trigger conditions to match spellcard output or similar. Regarding your Ice Storm issue: Make sure the character sheet that you are referencing has a default token set. The "undefined" part of the error message you shared is pointing me in that direction. If you manually drag that "character" from the journal, does the token image match what you are expecting? If you are still having issues after checking the default token, can&nbsp; you post the current version of your macro?