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

API or macro needed for giving player control of Spell token images

I tried making a rollable table of spells they use with my images but they all are tied to the same size. I'd like for them to cast a spell, and if it has an image - it auto sizes to the correct size. Sleep, Fog, Thunderwave, Fireball, etc.
1660500041
David M.
Pro
API Scripter
Have you looked at the SpawnDefaultToken script/mod? You can make a macro for the spell that looks something like this: !Spawn{{ --name|MyGenericSpellMultiSidedToken --offset|1,0 --size|8,8 --side|5 }} This example spawns the default token for character "MyGenericSpellMultiSidedToken" on the map centered one square to the right of the selected token, with a width/height of 8 and set to the 5th side. 
1660500228
David M.
Pro
API Scripter
The SmartAoE script can also do something similar. Syntax is more involved, but can also incorporate automatic rolling of saving throws and damage application, with a ton of options. The default "control token" is just a reticle graphic, but custom graphics are supported much like the Spawn script.
1660504167

Edited 1660504245
vÍnce
Pro
Sheet Author
For games that do not have access to the API/Mod or just want an alternative for spell template overlays;  One method I have used for spell templates is to create a new "template character" for each template needed and name it accordingly.  ie "Cone 15" Then change the default token for the "template character" to the appropriate template image/overlay accordingly.  You can make these images yourself, marketplace, internet search, etc. It is important that you If you want everyone to have access to drag/drop templates: ensure all players have permission to view/edit the "template characters" (edit character journal settings permissions). Physically scale/resize the image to the grid to match the AoE. (use a map with grid enabled 1 square = 5' or whatever scale your game requires) Optionally set the the token settings"Advance: Is Drawing".  This can help to have a little more control over placement when dragged out.You also might show the name of the token, etc. Do these changes BEFORE you save it as the default token image. These steps are often missed and people wonder why their template needs to be resized every time they drag a template to the map.  You should only need to move/rotate to match the origin of the spell. I simply move these template into Sub-folder on the sidebar.  Player's can drag them out as needed. Cheers
1660504791
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Although I have updated and refined it over the years, this video shows the system I still use. You could adapt it to use your existing token table work. Thread is in the video comments
1660506543
David M.
Pro
API Scripter
Automating Keith's approach was actually the reason I wrote the Spawn script in the first place haha.
1660516173
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I used a spreadsheet, because coding for me is like deciphering heiroglyphs. Slow, painful and requiring much reference and help from scholarly folk. :)