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

(5e) Variable Query for Targets of Spells? (Magic Missile)

I'm not sure if the Sheet is going to matter, I'm using OGL if it becomes important. I'm trying to make my Magic Missile Spell limit it's ?{queries} . I have this idea that makes it query the Spell Level, & run it through a comparator (Conditional Statement), I have everything else primed & ready to go, but, currently, every Cast, it's going to ask for 11 Targets, even at Lv 1. ! ?{Cast at what level?|Level 1,1|Level 2,2|Level 3,3|Level 4,4|Level 5,5|Level 6,6|Level 7,7|Level 8,8|Level 9,9} /ooc &{template:default} {{name=@{selected|character_name} Casts Magic Missile}} {{Level=?{Cast at what level?} Spell Slot}} {{Per Dart=[[1d4+1]] Force Damage}} {{Firing=[[2 +?{Cast at what level?}]] Darts}} {{1st Dart=@{target|1|token_name}}} {{2nd Dart=@{target|2|token_name}}} {{3rd Dart=@{target|3|token_name}}} {{4th Dart=@{target|4|token_name}}} {{5th Dart=@{target|5|token_name}}} {{6th Dart=@{target|6|token_name}}} {{7th Dart=@{target|7|token_name}}} {{8th Dart=@{target|8|token_name}}} {{9th Dart=@{target|9|token_name}}} {{10th Dart=@{target|10|token_name}}} {{11th Dart=@{target|11|token_name}}} As you can see, I'm using a simple Numbering System to Multi-Target, this was a happy accident, as I had not planned to use such a facet (it was to be a Placeholder), this means that if I can get it to recognize the Targets that are above the ?{Cast at what level?} 's range ( [[2 +?{Cast at what level?}]] ) to reset to a Target I shall name in the future, for now, I just want it to Target " @{target|0|token_name} " if it is not within the Spell's Level Range, but I've been wrestling with Code all day on here, switching from Community to OGL, updating my GitHub Repo, Debugging, Testing, Organizing, Sifting... you get the Idea, my brain is in need of a nap, and there's this amazing community on here, I figure at the very least, it's a good thing to post so it's at least got something people can look up for future use. If you are curious about the way I have Magic Missile Built, this is the RAW (Read as Written) version. PHB says in the Damage section to roll once and use the damage for all injuries incurred, similar to Fireball, Scorching Ray, or Eldritch Blast, according to Jeremy E. Crawford (he explicitly stated, it's Roll once) on his Twitter almost 2 Years before posting this thread (1 Year, 10 Months, 2 Weeks, approx). @{target|0| token_name} is likely going to link back to the Caster. I would love to use this idea instead of my other idea (merge all of the macros for all of the different levels of casting into the Query, this would create a gargantuan Server based Lag Spike for the Game it would be used in though, every time it gets used, so, this idea I'm posting is preferable, because it's MUCH smaller & causes much Much MUCH less Lag)
1532692437

Edited 1532692570
GiGs
Pro
Sheet Author
API Scripter
The only way to vary the number of target popups in a macro, might be to build a query macro with the full list of needed targets on each row. for example (in pseudo-code form) ?{Number of Attacks?| 1, <include target selection for 1 target here| 2, <include target selection and any other variables needed for each target here, for first target, then repeat again for 2nd target| 3, <include target selection and other stuff for 1st target, then again for 2nd target, then again for 3rd target| etc } There is no other way  to vary the number of target prompts in a single macro at the free level. And to be honest, I am not sure this will work either (I think the roll20 parser will go through the entire script and prompt for each target, and then start reporting the results), but it's the only way that has a chance of success.  Those conditional statements you are trying to use here absolutely will not  work for this. 
1532975851

Edited 1532975951
I have 3 words for your statement: Order of Operations. Technically speaking you are completely incapable of rolling a variable number of Dice, such as: [[((floor((@{level} +1) /6)) +1)d10]] Fire Damage for Fire Bolt however, if we enforce a specific Order of Operations: [[[[((floor((@{level} +1) /6)) +1)]]d10]] Fire Damage for Fire Bolt it should work fine. I'm simply suggesting something along the lines of: @{target|1|token_name} into @{target|[[{{0,?{Cast at what level?}}1}*1]]|token_name} P. S. Sorry for taking so long to respond, there's been a Heat Wave lately.