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] Areas of Effect

1482357841
Ada L.
Pro
Marketplace Creator
Sheet Author
API Scripter
I'm not quite sure what you mean. It does take into account the scale set for the page when it creates the effects. For example, if your scale is 20km per square, then the effect's radius is set to 20km on the map if you enter 20km as the radius.
Maybe this picture will do a better job of showing what I am asking . 
1482504955
Ada L.
Pro
Marketplace Creator
Sheet Author
API Scripter
Ok, I see what the problem is now. When you create the burst effect, you give it the radius, not the diameter. When the effect is created, it also takes into account the source token's radius. So the final radius is the radius you specified, plus the radius of the source token. 
When I did the initial setup I made a line 5' and put it inside the token which had a diameter of 10' and saved it. When i entered 15 in the burst it created a cloud with a 35' diameter.  Have tried doing a 15' line with a 30 diameter token ends up being 35'  Finally tried a line drawn to 15' plus an effect also sized to 15' which ends up as as about a 17' long cloud. I know that I am misunderstanding you- what am I getting wrong :)
1482530912
Ada L.
Pro
Marketplace Creator
Sheet Author
API Scripter
... okay.... When you drew that first line ontop of the effect and saved it, you were setting the baseline for it by drawing the line from the center of the graphic to its circumference. For burst effects, this is effectively the radius of the effect, NOT THE DIAMETER. So, when you create the effect, you are specifying its RADIUS, not its diameter. This radius starts at the edge of the token you caused the burst to originate from. So, if you set the burst on a 5' diameter token (with a 2.5' radius), and then specify 15' in the prompt for the RADIUS. you are going to wind up with a total radius equal to 17.5', which is a diameter of 35'.
1485088298
None of the links for the instructions work.
1485115226
Ada L.
Pro
Marketplace Creator
Sheet Author
API Scripter
Mal said: None of the links for the instructions work. Oops... Forgot to update the link when the branch was merged. The link should be fixed now.
1485240906
Hi.  Love the script but I think I found a bug. I set up a bunch of AOEs and got them to work exactly how I wanted.  Then I exited the game and the next time I logged in and tried one, it was scaled so large it didn't fit on the map.  Also, the AOE menu didn't retain many, if not all, of the AOEs and settings that I set up in my previous session. What do you think?
1485269092
Ada L.
Pro
Marketplace Creator
Sheet Author
API Scripter
Sorry, but I haven't been able to reproduce this problem. Once the effects are initially spawned, the script doesn't do anything else to scale the graphics. More likely, there is interference from someone else's script that is scaling the graphics on start-up and erasing this script's state (and possibly erasing other scripts' states).
1485406264
So I think I figured out the scaling thing... When I started making AOEs, I interpreted a key step in the instructions the wrong way.  When I figured out my error, I went back and re-created the same AOEs per the instructions.  But here's where it's still weird.  The script seems to be retaining many of the initial, incorrect AOEs; not the corrected versions.  (Even though I deleted the fubar'd AOE just before saving the corrected version.)  I test each one before moving on to the next.  All seems to be fine.  Then I logged out and logged in some time later.  When I go to activate an effect, the scaling was way off when using the script properly and worked right when accounting for my initial misinterpretation of the instructions.  So the problem is not AOEs getting corrupted, it just isn't retaining the "corrected" AOEs. Is there a limit to the total number of AOEs that can be set up?  I have 24 right now but when I add more than that, they all work fine until I restart the API.  When I do that, the script reverts back to those same 24.
1485439943

Edited 1485439959
Ada L.
Pro
Marketplace Creator
Sheet Author
API Scripter
There is no theoretical limit to the number of AOEs that can be set up. In all of my tests thus far I have been unable to reproduce your issue. Would it be possible for you to create a video showing how you are setting up your AoEs and how you are spawning them?
1485903467

Edited 1485903560
Let me add what I'm seeing, with some pictures to help: 1. I have a map that is set to 5' squares, as such:           2. I've created a circle template that was 10' in DIAMETER.  I drew a line across the entire image that also measured 10', and then saved it, as such:   3. Next I attempted to create a burst of 12.5' (radius), expecting it to measure 20' in total (2.5' [half of target token] + 10' in both directions from the center of the target token.  The result was a 15' DIAMETER circle, starting from the center of the target token:       (After being centered on token) So if I wanted a circle of 20' in diameter, what should I have entered?
1485914541
Ada L.
Pro
Marketplace Creator
Sheet Author
API Scripter
When you draw the line, you're supposed to draw the radius, not the diameter of the circle. Draw the line from the center to the edge, then save the effect.
Ahh ok.. I think I finally get it now.. thanks!
Whilst using the scripts. I have found that the #areasOfEffectMenu only works if you have a fullstop at the end of your name.
If anybody uses this script with the shaped sheet I have had good results adding the burst macro to the characters spells. Makes everything painless and very efficient. 
Hey Stephen im having an issue with making new effects. I have 10 or 12 saved already, but im adding a new one and getting this error in chat when trying to user the new effect. (From Areas Of Effect ERROR:): C. Firebase.set failed: First argument contains NaN in property 'left' This expanded version shows up in the API Output "Areas Of Effect ERROR: Firebase.set failed: First argument contains NaN in property 'left'" "Error: Firebase.set failed: First argument contains NaN in property 'left'\n at Ba (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:9:186)\n at Ba (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:10:207)\n at Aa (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:8:462)\n at J.set (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:146:98)\n at createObj (/home/node/d20-api-server/api.js:1853:26)\n at applyEffect (apiscript.js:16632:20)\n at apiscript.js:17016:9\n at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:146:1), <anonymous>:65:16)\n at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:146:1), <anonymous>:70:8)\n at /home/node/d20-api-server/api.js:1510:12"
Im not sure what changed, but it's working now.... ???
1492004001
Ada L.
Pro
Marketplace Creator
Sheet Author
API Scripter
I recently put in a pull request that will fix this issue. You can get it early from here:&nbsp;<a href="https://github.com/Cazra/roll20-api-scripts/blob/bb635d1163c73ab96324cd5be7cf7f626699275a/AreasOfEffect/1.3.1/aoe.js" rel="nofollow">https://github.com/Cazra/roll20-api-scripts/blob/bb635d1163c73ab96324cd5be7cf7f626699275a/AreasOfEffect/1.3.1/aoe.js</a>
Stephen I have noticed that the size of the target affects the size of the area of effect? &nbsp;If I use a medium token as the target everything scales correctly. A tiny token &nbsp;will make a mini AoE and as the tokens get larger so does the AoE. Targeting a gargantuan token invokes armageddon
1492089888
Ada L.
Pro
Marketplace Creator
Sheet Author
API Scripter
That's because the effect's radius actually includes the target tokens radius. The number you enter is the radius that the effect extends from the target token's edge. It seems like it's confusing to a lot of people though. I think I'll change it.
In the meantime I have just started reminding people to target a medium monster or themselves and move it :)
1492090547
Ada L.
Pro
Marketplace Creator
Sheet Author
API Scripter
I just added this change to the current AoE pull request. You can get it and the earlier bug fix here:&nbsp;<a href="https://github.com/Cazra/roll20-api-scripts/blob/608f600b45047602d75a88d6e18eb740255b8b00/AreasOfEffect/1.4/aoe.js" rel="nofollow">https://github.com/Cazra/roll20-api-scripts/blob/608f600b45047602d75a88d6e18eb740255b8b00/AreasOfEffect/1.4/aoe.js</a>
Thanks Stephen- getting a ton of use out of this &nbsp;script. I set them up on the shaped sheet to fire automatically on AoE spells. Use them on magic items to create things. There is no end to the utility. It is a very, very useful script.&nbsp;
1492096797
Ada L.
Pro
Marketplace Creator
Sheet Author
API Scripter
Glad you're enjoying it!
1492098303
Gary, &nbsp;I would love for you to explain how you do that. &nbsp;I started using the Shaped Sheet and love it. &nbsp;But I need some help. &nbsp;How is using the AoE script different from creating custom fx and having those go off from the spell?? I feel like I'm not getting how those two things work out. &nbsp;Also, what do you put and where do you put it to attach it to the individual spells??
1492099079

Edited 1492099195
You can keep using the FX feature for some flashy effects on the screen, and use the AoE script to help judge how many people your spell hits or as a reminder of controlling effecting left on the map. First, you set up the spell effects as normal in the AoE script. Once that is done you can use an API command placed in the freeform section of the Shaped Sheet to fire it off every time the spell is used.&nbsp; !areasOfEffectApplyEffectAtToken @{target|token_id} 7.5 Shatter_7.5
1495722761
I just installed aoe. &nbsp;when I run AreaofEffectMenu I get the following error: "Areas Of Effect ERROR: HtmlBuilder is not defined" "ReferenceError: HtmlBuilder is not defined\n at _showMenu (apiscript.js:4211:23)\n at apiscript.js:4409:9\n at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:146:1), &lt;anonymous&gt;:65:16)\n at Object.publish (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:146:1), &lt;anonymous&gt;:70:8)\n at /home/node/d20-api-server/api.js:1510:12\n at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560\n at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147)\n at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546)\n at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489)\n at Zd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425)"
1495723176

Edited 1495723189
The Aaron
Forum Champion
API Scripter
You need to install the required scripts it depends on, Kevin lists them our here: &nbsp; <a href="https://app.roll20.net/forum/permalink/4042399/" rel="nofollow">https://app.roll20.net/forum/permalink/4042399/</a> I believe all the required scripts are in the 1-click install, so should go pretty quickly.
1495724377
Thanks, that did it
Gary W. said: You can keep using the FX feature for some flashy effects on the screen, and use the AoE script to help judge how many people your spell hits or as a reminder of controlling effecting left on the map. First, you set up the spell effects as normal in the AoE script. Once that is done you can use an API command placed in the freeform section of the Shaped Sheet to fire it off every time the spell is used.&nbsp; !areasOfEffectApplyEffectAtToken @{target|token_id} 7.5 Shatter_7.5 This is great. Does anyone know how to set this up for the OGL Sheet?
1496586306
The Aaron
Forum Champion
API Scripter
OGL doesn't have a freeform section where you can place commands. &nbsp;If you want a single button to do this, your best bet is to execute the spell, then press up in the chat to get what it ran for the command. &nbsp;Copy that, then paste it into an ability on the character, then place the !areasOfEffectApplyEffectAtToken command on the next line of the ability and set it as a token action.
1496672922

Edited 1496672965
Thank you very much Aaron, when i try it this way i get: (From Areas Of Effect ERROR:): Cannot read property 'rotateOffset' of undefined My macro to cast the spell looks like that: /w @{selected|token_name}&{template:spell} {{level=conjuration 1}} {{name=Verstricken}} {{castingtime=1 Aktion}} {{range=27m}} {{target=}} {{v=1}} {{s=1}} 0 {{material=}} {{duration=Bis zu 1 Minute}} {{description=Umschlingende Gräser und Ranken wachsen in einem Quadrat in 6 Metern Kantenlänge in Reichweite aus dem Boden. Bla bla bla (some text for the atmosphere) .}} {{athigherlevels=}} 0 {{concentration=1}} @{selected|charname_output} !token-mod --set aura1_color|#ff0000 aura1_radius|3 --ids @{target||token_id} !token-mod --set statusmarkers|fishing-net:+1 --ids @{target||token_id} !areasOfEffectApplyEffectAtToken @{target|token_id} 7.5 Test_7.5 "Test" is the name of my image for this spell I guess, i didn't understand something. Tried some things, but nothing helps. Any hints? BTW: Thank you for tokenmod, awesome script i use often!
1496673364
The Aaron
Forum Champion
API Scripter
So, I don't know if it's related, but you have two | in the TokenMod commands, they should be: !token-mod --set aura1_color|#ff0000 aura1_radius|3 --ids @{target|token_id} !token-mod --set statusmarkers|fishing-net:+1 --ids @{target|token_id} For testing API commands, I often will leave the ! off the front so it just prints whatever it would send to the API in the chat. &nbsp;Try taking the !'s off and running the macro and see if you are getting token ids in the right places. &nbsp;In the past, there have been issues with using @{selected} and @{target} together in the same macro, but I think those are fixed at this point... And...
1496673501
The Aaron
Forum Champion
API Scripter
Also, you could write those TokenMod commands together and it would be more efficient (fewer object lookups, fewer notifications, etc..): !token-mod {{ --set aura1_color|#ff0000 aura1_radius|3 statusmarkers|fishing-net:+1 --ids @{target|token_id} }}
1496673558
The Aaron
Forum Champion
API Scripter
(Unless you intended those to be pointing at different Tokens.. which you might with the || in there... hmmm... guess you'll let us know. =D )
Gary, I've tried using your method, and although it asks for a target, it does not work properly, it seems the effect isn't generated. If I put the part you suggested putting in the freeform text in a seperate macro, it works as expected. Any idea what might be causing this behaviour?
Thank you for the more efficient code for token mod, i thought there must be a way to write this "smoother". I did the two "|" for less pop-ups and get it work with only one click, but your way is much cleaner :) I tried it, without the rest of the macro, to exclude other mistakes, i only typed !areasOfEffectApplyEffectAtToken @{target|token_id} 7.5 Test_7.5 and it prompts me the same error. So i tried it without the second _7.5 and it works :) (i expect the second one ist for the angle of path when you use it the "normal" way or something ) Thank you for your help and your patience If anyone can use this, the correct working way is now (5OGL): 1. Name an image in your library you want to use for a spell, for example "Fireball" and set it up as usual with AreaofEffect 2. Drag the spell from the compendium and drop it to your character 3. Cast the spell from you Core! section of the character sheet&nbsp; 4. Go to your chat and press up to get the code of the spell 5. Copy the spell and make the following changes ( bold ) to made it "all-in-one" and not character specific @{ selected |wtype}&{template:atkdmg} {{mod=DC12}} {{rname=Fireball}} {{r1=[[0d20@{ selected |halflingluck}cs&gt;20]]}} {{r2=[[0d20@{ selected | halflingluck}cs&gt;20]]}} 0 {{range=150 ft}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[8d6]]}} {{dmg1type=Fire }} 0 {{dmg2=[[0]]}} {{dmg2type=}} {{crit1=[[8d6[CRIT]]]}} {{crit2=[[0[CRIT]]]}} {{save=1}} {{saveattr=Dexterity}} {{savedesc=Half damage}} {{savedc=[[[[(@{Lia Amakiir|spell_save_dc})]][SAVE]]]}} {{desc=}} {{hldmg=[[(1*?{Cast at what level?|Level 3,0|Level 4,1|Level 5,2|Level 6,3|Level 7,4|Level 8,5|Level 9,6})d6]]}} {{spelllevel=cantrip}} ammo= @{ selected |charname_output} 6. Add the following code and change the name in bold to your spell image name and change the 3 to the radius of your effect&nbsp; !areasOfEffectApplyEffectAtToken @{target|token_id} 3 Fireball 7. Tick off "as token action" because you have to target a token to use the macro 8. Additional add: !token-mod {{ --set aura1_color|#ff0000 aura1_radius|3 statusmarkers|fishing-net:+1 --ids @{target|token_id} }} for an aura (for additional spell range overview after deleting the effect) and a status marker like poisoned or something.&nbsp; This should work with the most of the spells and you can add an /fx bomb-fire for more "bling-bling-loving-freakiness" and&nbsp;!roll20AM --play|yoursoundofchoice&nbsp; My complete test code for that is: @{selected|wtype}&{template:atkdmg} {{mod=DC12}} {{rname=Fireball}} {{r1=[[0d20@{selected|halflingluck}cs&gt;20]]}} {{r2=[[0d20@{selected|halflingluck}cs&gt;20]]}} 0 {{range=150 ft}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[8d6]]}} {{dmg1type=Fire }} 0 {{dmg2=[[0]]}} {{dmg2type=}} {{crit1=[[8d6[CRIT]]]}} {{crit2=[[0[CRIT]]]}} {{save=1}} {{saveattr=Dexterity}} {{savedesc=Half damage}} {{savedc=[[[[(@{selected|spell_save_dc})]][SAVE]]]}} {{desc=}} {{hldmg=[[(1*?{Cast at what level?|Level 3,0|Level 4,1|Level 5,2|Level 6,3|Level 7,4|Level 8,5|Level 9,6})d6]]}} {{spelllevel=cantrip}} ammo= @{selected|charname_output} !areasOfEffectApplyEffectAtToken @{target||token_id} 3 Feuerball !token-mod {{ --set aura1_color|#ff0000 aura1_radius|3 statusmarkers|fishing-net:+1 --ids @{target||token_id} }} /fx Feuerball @{target||token_id} @{target||token_id} \\n &{template:foo} !roll20AM --play|Feuerball and it looks like that (sadly you can't here the awesome sound): Probably there is a cleaner way to do this,&nbsp;but hey, im just a try and error coder-noob : p You'll to remove the status markers and the aura manual or with this macro: !token-mod --set statusmarkers|-bleeding-eye|-broken-heart|-edge-crack|-screaming|-grab|-lightning-helix|-aura|-chemical-bolt|-back-pain|-fishing-net|-fist|-sleepy|-ninja-mask|-angel-outfit|-red|-blue|-green|-brown|-purple|-pink|-yellow|-dead|-skull|-sleepy|-half-heart|-half-haze|-interdiction|-snail|-lightning-helix|-spanner|-chained-heart|-chemical-bolt|-death-zone|-drink-me|-edge-crack|-ninja-mask|-stopwatch|-fishing-net|-overdrive|-strong|-fist|-padlock|-three-leaves|-fluffy-wing|-pummeled|-tread|-arrowed|-aura|-back-pain|-black-flag|-bleeding-eye|-bolt-shield|-broken-heart|-cobweb|-broken-shield|-flying-flag|-radioactive|-trophy|-broken-skull|-frozen-orb|-rolling-bomb|-white-tower|-grab|-screaming|-grenade|-sentry-gun|-all-for-one|-angel-outfit|-archery-target name|@{selected|character_name} !token-mod --set aura1_radius| (don't know how to do the code in such a nice scrollable line). Regards
1496682275
The Aaron
Forum Champion
API Scripter
Nice! &nbsp;To clear statuses, here's a little trick you can use: !token-mod --set statusmarkers|=blue|-blue Here's some instructions on formatting posts:&nbsp; <a href="https://wiki.roll20.net/Forum_Posting#Formatting_a" rel="nofollow">https://wiki.roll20.net/Forum_Posting#Formatting_a</a>...
Arne K. said: Gary, I've tried using your method, and although it asks for a target, it does not work properly, it seems the effect isn't generated. If I put the part you suggested putting in the freeform text in a seperate macro, it works as expected. Any idea what might be causing this behaviour? Following up on my previous question, it also seems like all saved effects are lost whenever I reload the game. I can't really find any answers as to why this is happening, so would very much appreciate some help!
Arne K. said: Gary, I've tried using your method, and although it asks for a target, it does not work properly, it seems the effect isn't generated. If I put the part you suggested putting in the freeform text in a seperate macro, it works as expected. Any idea what might be causing this behaviour? Make sure there is a blank line before the command is all I Can think of. It works reliably for me in two different campaigns.&nbsp;
No idea on the lost effects
1496767366

Edited 1496767547
Ada L.
Pro
Marketplace Creator
Sheet Author
API Scripter
Arne K. said: Arne K. said: Gary, I've tried using your method, and although it asks for a target, it does not work properly, it seems the effect isn't generated. If I put the part you suggested putting in the freeform text in a seperate macro, it works as expected. Any idea what might be causing this behaviour? Following up on my previous question, it also seems like all saved effects are lost whenever I reload the game. I can't really find any answers as to why this is happening, so would very much appreciate some help! It sounds like there is some other script you have that is clearing out your global state variable. Could you please share the output you are getting in your API console? Has anyone else been experiencing this issue?
The Aaron said: Nice! &nbsp;To clear statuses, here's a little trick you can use: !token-mod --set statusmarkers|=blue|-blue Here's some instructions on formatting posts:&nbsp; <a href="https://wiki.roll20.net/Forum_Posting#Formatting_a" rel="nofollow">https://wiki.roll20.net/Forum_Posting#Formatting_a</a>... Thank you again : )
1496772096
The Aaron
Forum Champion
API Scripter
No problem! &nbsp;Happy Rolling!
Gary, it seems like ammo tracking is messing with this, as it puts the ammo tracking part of the code after the freeform, which makes it not work. I managed to set up it after resolving that issue. Stephen, as for the API Console, do you want the whole lot? (Sorry, a bit new at all this API/scripting goodness)
1496873243
Ada L.
Pro
Marketplace Creator
Sheet Author
API Scripter
Arne K. said: Gary, it seems like ammo tracking is messing with this, as it puts the ammo tracking part of the code after the freeform, which makes it not work. I managed to set up it after resolving that issue. Stephen, as for the API Console, do you want the whole lot? (Sorry, a bit new at all this API/scripting goodness) Yeah, just dump the whole thing.
Hello Stephen, Apparently the cause of this issue is user failure. I was going enabling/disabling scripts for the purposes of debugging my other issue, not realizing that a reload/restart of the API cleared all saved states. Did I mention I was a bit new to this? Thank you for taking the time to look at my issue, I'll report back if something else than my failing causes issues.