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 Ask for Target later

Hello, i'm trying to writ a script, where it first ask for a target, after selecting one, this will draw an "aura" around it. and after this, i click on a button "boom" in this case, and i will have the chance to target X token, based on how many there are inside the aura of the first target. is it possible? below you will find the code! thank you so much to anyone that could help me with this! !scriptcard {{ --#title|Corpse Explotion --Lsettings| @ {selected|character_name} --#leftsub| --#rightsub| --#sourceToken| @ {selected|token_id} --#emoteText| @ {selected|token_name} makes a cadaver go boom! -->GetAndCheckAp| -->UsaAp| -- @modattr |_charid [* S : character _ id ] _ms_3_xp| 1 --+|[ img ]https:// s3.amazonaws.com /files.d20.io/images/ 260361476 /FbTcvEbBEXG7jfzNFBmNwg/original.png[/ img ] --+|[ c ][ rbutton ]BOOM!::BOOM; 9 [/ rbutton ][/ c ] -- @token -mod| _set aura1_radius| 4 _ids @ {target|token_id} FIRST TARGET --X| --:BOOM| --#title|BOOM! --=AdditionalTarget| ? {How may targets?| 2 } --+EFFECTS:|The cadaver goes Boom and it damages ? {How may targets?| 2 } targets. -- @token -mod|_ignore-selected _ids @ {TARGETS|token_id} _set bar1_value| -10 --X| --:GetAndCheckAp| --=ApCost| 40 --=ApDisp|[* S : Ap ] --?[ $ApCost .Total ] -gt [ $ApDisp .Total ]|NoSlotsLeft --<| --:NoSlotsLeft| --+|[* S : character _ name ] doesn 't have enough AP. AP available [$ApDisp.Total]. --X| --:UsaAp| --=ApDisp|[$ApDisp] - [$ApCost] --@modattr|_charid [*S:character_id] _Ap|-[$ApCost] --<| }}
1639612564

Edited 1639612663
Andrew R.
Pro
Sheet Author
Off the top of my head, I suggest you ignore the Aura, and collect the position of all the tokens on the map & layer, calculate the distance to all those tokens, and remove any with a distance greater than the radius of the Aura. 
1639613337
Kurt J.
Pro
API Scripter
The fireball sample script on  my Github Repo  does what sounds like this, including calculating the distances from a target point as Andrew suggests. It should be a simple matter to modify the range on it and potentially change the visual effects and wording.
1639643421

Edited 1639645798
thank you so much! this seems exactly what i was looking for.  I have to admit that i looked before are your example but i was still learning scriptcard and they seemed to complex for me:D Now i have only one thing that i don't understand, here at [%8%] you have dex, but what is the difference between [%8%] and [%2%]? i'm not playing with D&D so i dont't have a save throw + a save bonus but just an attribute called switf. should i eliminate one of the two? and also, i might be missing something, but token-mod doesn't do anything, could it be because there is no applydamage line? -->MakeSavingThrow|[& tokenid ];dexterity; @ {selected|spell_save_dc};[ $Damage .Total ];fire;thisTokenDamage;saveResult;dex --+[*[& tokenid ]: character _ name ]:|Save [ $savingThrow ] [ r ][ $thisTokenDamage ] fire damage[/ r ] --/|Put a burn-fire visual effect on impacted tokens --vtoken|[& tokenid ] burn-fire --/|Get the next token and continue the loop until we run out. --~tokenid|array;getnext;inRange --?[& tokenid ] -ne ArrayError|loopDisplay --/|Add some extra visual effects - a nova-fire at the target, and a beam-fire from source to target --vtoken| @ {target|token_id} nova-fire --vbetweentokens| @ {selected|token_id} @ {target|token_id} beam-fire --:endOutput| --X| --/|Subroutine to make saving throws and calculate damage amounts --:MakeSavingThrow|tokenid;savetype;dc;damage;damagetype;damagevariable;saveresultvariable;shortabilityname --? "X[*[%1%]:npc_[%8%]_save_base]" -eq "X" |>set_string;baseSaveBonus;|>set_string;baseSaveBonus; + + [*[% 1 %]: npc _[% 8 %]_ save _ base ]
1639651358
Kurt J.
Pro
API Scripter
The attributes for saving throws on the 5E sheet aren't consistently named, so while one is npc_dex_save_base, there is also dexterity_save_bonus. Since I need to access both, it was easier just to pass both versions of the name.