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

[Scriptcard] Making AOE spells without target ?

1679150141

Edited 1679150155
Hi! I've been working on Scriptcard for a while now, and I just found an issue with the way it works : If I wanted to make a spell that hits multiple targets, but their number can vary every single time, this means I cannot use the "Target" function since it needs a specific number of them (Target 1, Target 2, etc..) The only solution I found was using "Selected", however Scriptcard only reads the first Selected token and there is multiple issues with using Selected in general (for example if I wanna read attributes from specific tokens) Any idea on how to do this ? I thought about breaking the macro in two but that would be a bother to do..
1679151138
David M.
Pro
API Scripter
(1) If the AoE spell hits everything within a certain range, you could try an approach similar to Kurt's Fireball example . You'd still need a target token on which to "center" the AoE. One option is to use the Spawn script to spawn a targeting token (the default token could have an aura that matched the AoE size), and your actual spell scriptcard could be a token action ability on the default token's character sheet.  (2) If you need to target a variable number of specific targets and ignore others, you could try building a dynamic  information request string with a loop as shown in Kurt's Magic Missile example here . (3) Finally, you may also want to check out the SmartAoE script ( forum thread ,  wiki ) which may be able to do the heavy lifting for you.  
1679342774

Edited 1679342824
There is a trick to doing this with Scriptcards and [rbutton] . Look at my Bless Script for an example. !script {{ --/|Script Name : Bless --/|Version : 0.1 --/|Requires SC : --/|Author : Will M. --/|Description : Implements Bless on 3 targets --/| --/|Spell Description: You bless up to three creatures of your choice within range. --/| Whenever a target makes an attack roll or a saving throw before --/| the spell ends, the target can roll a d4 and add the number rolled --/| to the attack roll or saving throw. --/| At Higher Levels. When you cast this spell using a spell slot of --/| 2nd level or higher, you can target one additional creature for each --/| slot level above 1st. --/| Select each character impacted --/| For each character impacted - Update their Global Attack and Save Mods (not done yet) --/| Add a status marker to show the effect --/| Send a message to that person to let them know they are blessed --/| Add a turnorder counter --/| Add a Concentration Marker --:TOP| --#title|BLESS --#timezone|America/Chicago --#overridetemplate|dnd5e --#sourceToken|@{selected|token_id} --#whisper|self --#debug|1 --#emoteText|@{selected|token_name} Casts Bless -->SETUP_GLOBAL_VARS| --&BlessedSM|Blessed::4082922 --&ConcentrationSM|Concentrating::4082926 --+Bless Description:| --+| [b][i]Casting Time:[/i][/b] 1 Action --+| [b][i]Duration:[/i][/b] 1 Minute --+| [b][i]Range:[/i][/b] 30 ft. --+| [b][i]Components:[/i][/b] V, S, M (holy water) --+|You bless up to [b]three creatures[/b] of your choice within range. Whenever a target makes an [b][i]attack roll[/i][/b] or a [b][i]saving throw[/i][/b] before the spell ends, the target can roll a [b]d4[/b] and add the number rolled to the attack roll or saving throw. --+|[b]At Higher Levels.[/b] When you cast this spell using a spell slot of 2nd level or higher, you can target one additional creature for each slot level above 1st. --+|[hr] --/| Get Slot Level and Check for space -->GET_SPELL_SLOT|SlotLevel -->BUILD_TARGETS|[&SlotLevel];BlessTargets --=TargetCount|[&SlotLevel]+2 --+|[c][rbutton]Select [$TargetCount.Raw] Characters to Bless::BLESS;[&SlotLevel]\[&BlessTargets][/rbutton][/c] --:EXIT| --x| --:GET_SPELL_SLOT| --/| Select Level to determine number of creatures impacted --&SL|?{Spell Slot Level Used?|1|2|3|4|5|6|7|8|9} --=SlotsExpended|[*S:lvl[&SL]_slots_expended] --&[%1%]|[&SL] --?[$SlotsExpended.Total] -eq 0|NOSLOTSLEFT -->DEDUCT_SPELL_SLOT| --<| --:NOSLOTSLEFT| --&[%1%]|0 --+|[*S:character_name] has no level [&SL] spell slots available. --#emoteText|[*S:character_name] tries to cast a spell but farts in instead. --X|NoSlotsLeftStop --:DEDUCT_SPELL_SLOT| --=SlotsExpended|[*S:lvl[&SL]_slots_expended] - 1 --/@setattr|_charid [*S:character_id] _lvl[$SlotLevel]_slots_expended|[$SlotsExpended] _silent --!a:[*S:character_id]|lvl[&SL]_slots_expended:[$SlotsExpended] --+|Level [&SL] Slots Left: [$SlotsExpended] --<| --:BLESS| --#whisper| --~Arg|string;split;\;[&reentryval] --=iCnt|[&Arg1]+3 --%i|2;[$iCnt.Raw];1 --&TokenId|[&Arg[&i]] --&TokenIds|+ [&Arg[&i]] --&CharIds|+ [*[&TokenId]:character_id] --?[&i] -ne [$iCnt.Raw]|&CharIds;+, --+|[b][c][*[&TokenId]:t-name][/c][/b] --&Blessed|+ [*[&TokenId]:t-name], --vtoken|[&TokenId] nova-holy -->TURN_GSM_ON|[*[&TokenId]:character_id];Bless -->TURN_GAM_ON|[*[&TokenId]:character_id];Bless --%| --+|[b][i][c]Have been Blessed[/c][/i][/b] --@token-mod|_set statusmarkers|[&BlessedSM] _ids [&TokenIds] _ignore-selected --@token-mod|_set statusmarkers|[&ConcentrationSM] _ids [*S:t-id] _ignore-selected --~|turnorder;addcustom;>>[*S:t-name] Concentrating;1;+1 --e[*S:t-name]|/em Is Concentrating -->LOG|Concentration Started; [*S:t-name] (For casting Bless on [&Blessed]) --+|[hr] --+For the next minute, or until the spell ends:| --+| Whenever a you make an [b][i]attack roll[/i][/b] or a [b][i]saving throw[/i][/b], the you can roll a [b]d4[/b] and add the number rolled to the attack roll or saving throw. --+Note:|[i]You'll need to manually uncheck the [b]Global Attack[/b] and [b]Global Save[/b] Modifiers for [b]Bless[/b] from your character sheet or the Actions macro[/i] --X| --:BUILD_TARGETS|Count;rtnTargetString --=iCnt|[%1%]+2 --=i|0 --&TS| --/*iCnt|[$iCnt] --%i|1;[$iCnt.raw];1 --&TS|+[&TB]target|[&i]|token_id} --?[&i] -lt [$iCnt.Raw]|&TS;+\ --/*[&i]|[&TS] --%| --&[%2%]|[&TS] --<| --:TURN_GSM_ON|CharacterId, GSM Name --Rfind|[%1%];[%2%];repeating_savemod;global_save_name --?"[*R:global_save_name]" -eq "NoRepeatingAttributeLoaded"|EXIT_GSM --!a:[%1%]|[*R>global_save_active_flag]:1 --:EXIT_GSM| --<| --:TURN_GAM_ON|CharacterId, GAM Name --Rfind|[%1%];[%2%];repeating_tohitmod;global_attack_name --/rdump| --/\GAM1|GAM1 [*[%1%]:name] [*R:global_attack_name] --/\GAM2|[%1%] [*R:global_attack_name] [*R:global_attack_roll] [*R:global_attack_active_flag] [*R>global_attack_active_flag] --?"[*R:global_attack_name]" -eq "NoRepeatingAttributeLoaded"|EXIT_GAM --!a:[%1%]|[*R>global_attack_active_flag]:1 --:EXIT_GAM| --<| --:LOG|Subject, Note --~DT|system;date;getdatetime --@note-log|[&DT]: [%1%]; [%2%] --<| --:SETUP_GLOBAL_VARS| --&QB|? --&QB|+{ --&QE|} --&AB|@ --&AB|+{ --&TB|& --&TB|+# --&TB|+64 --&TB|+; --&TB|+{ --&BED|& --&BED|+# --&BED|+128719; --&CLOCK|& --&CLOCK|+# --&CLOCK|+128336; --&SPACE|X X --&SPACE|[&SPACE(1,1)] --&spc|  --&obrac|[ --&cbrac|] --&vbar|| --&DASH|- --&DDASH|[&DASH][&DASH] --<| }}