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

Modifying query option to give various results based on a calc

1487459649
AquaAlex
Sheet Author
Translator
API Scripter
So if you ask a question you can do something like this: ?{NumberofMissiles|1,([[1d4+1]])|2,([[1d4+1]] and [[1d4+1]])|3,([[1d4+1]] and [[1d4+1]] and [[1d4+1]])|4,([[1d4+1]] and [[1d4+1]] and [[1d4+1]] and [[1d4+1]])|5,([[1d4+1]] and [[1d4+1]] and [[1d4+1]] and [[1d4+1]] and [[1d4+1]])} But what if I want to do a macro that calculates the number of missiles and then roles the number of sets? [[{5,(ceil((@{Selected|MageLevel})/2))}kl1)]] and that gives me a result of 1 to 5 which I then want to use as input for the query. Is there some way to do this? I need to see each role seperately as the different results can be applied to different targets
1487459967

Edited 1487461913
AquaAlex
Sheet Author
Translator
API Scripter
Here is an example of script that works: &{template:2Espell}{{title=@{selected|token_name} casts Magic Missile}}{{splevel=Level 1 Wizard}}{{school=Evocation/Invocation}}{{components=V, S}}{{time=[[1]] segment}}{{range=[[60+(@{selected|MageLevel}*10)]] yds/ft}}{{duration=Instant}}{{aoe=Targeted Creature(s) in a 10' cube}}{{save=None}}{{damage= ?{NumberofMissiles|1,([[1d4+1]])|2,([[1d4+1]]+[[1d4+1]])|3,([[1d4+1]]+[[1d4+1]]+[[1d4+1]])|4,([[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]])|5,([[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]])} }}{{damagetype=Force}}{{effects=Fires [[{5,(ceil((@{Selected|MageLevel})/2))}kl1)]] missile(s) at one or more targets designated by the caster before the spell is cast. Each missile unerringly strikes it's target causing damage as indicated above.}} But as you can see user has to select how many dice for damage ( BOLD PART), but in ITALIC BOLD   we determine how many dice to roll so would be nice if we could combine those two parts
1487476129
Tetsuo
Forum Champion
AFAIK, this isn't possible without the help of an API script, though Power Cards can handle this neatly.
Not possible with macros or roll templates (to the best of my knowledge), but my PowerCards script can definitely handle that.
1487494941
Andrew C
Marketplace Creator
The other way you could do it, is similar to how I did for Monk Flurry of Blows. The structure is this: you always do 5 missiles BUT if their level isn't high enough you multiply later missiles by 0. I will adapt the Monk Macro to what you're after and post it below.
1487495344

Edited 1487495474
Andrew C
Marketplace Creator
2nd Edition Magic Missile Macro This could be adapted for any other 'get another at later levels', like Acid Arrow from 3.5E (and I think in 2E as well).  You just replace the number after the ">" with the level at which you gain the next missile.  So if you get the next missile at levels 5, 9, 13, 17... then you replace the 3, 5, 7, 9 with those numbers. &{template: … blah blah blah…} {{damage= Missile 1: [[ 1d4+1]] Missile 2: [[ [[1d4+1]]*({0,@{MageLevel} }>3) ]] Missile 3: [[ [[1d4+1]]*({0,@{MageLevel} }>5) ]] Missile 4: [[ [[1d4+1]]*({0,@{MageLevel} }>7) ]] Missile 5: [[ [[1d4+1]]*({0,@{MageLevel} }>9) ]] }} {{ blah blah blah…}}
1487505350
AquaAlex
Sheet Author
Translator
API Scripter
Andrew (Halfling Gypsy) said: &{template: … blah blah blah…} {{damage= Missile 1: [[ 1d4+1]] Missile 2: [[ [[1d4+1]]*({0,@{MageLevel} }>3) ]] Missile 3: [[ [[1d4+1]]*({0,@{MageLevel} }>5) ]] Missile 4: [[ [[1d4+1]]*({0,@{MageLevel} }>7) ]] Missile 5: [[ [[1d4+1]]*({0,@{MageLevel} }>9) ]] }} {{ blah blah blah…}} neat little fix
1487522321
AquaAlex
Sheet Author
Translator
API Scripter
&{template:2Espell}{{title=@{selected|token_name} casts Magic Missile}}{{splevel=Level 1 Wizard}}{{school=Evocation/Invocation}}{{components=V, S}}{{time=[[1]] segment}}{{range=[[60+(@{selected|MageLevel}*10)]] yds/ft}}{{duration=Instant}}{{aoe=Targeted Creature(s) in a 10' cube}}{{save=None}}{{damage= Missile 1: [[ 1d4+1]] Missile 2: [[ [[1d4+1]]*({0,@{selected|MageLevel} }>3) ]] Missile 3: [[ [[1d4+1]]*({0,@{selected|MageLevel} }>5) ]] Missile 4: [[ [[1d4+1]]*({0,@{selected|MageLevel} }>7) ]] Missile 5: [[ [[1d4+1]]*({0,@{selected|MageLevel} }>9) ]] }}{{damagetype=Force}}{{effects=Fires [[{5,(ceil((@{Selected|MageLevel})/2))}kl1)]] missile(s) at one or more targets designated by the caster before the spell is cast. Each missile unerringly strikes it's target causing damage as indicated above.}}
1487548160
Andrew C
Marketplace Creator
Hope it works for you just fine.
1487605987
AquaAlex
Sheet Author
Translator
API Scripter
Andrew (Halfling Gypsy) said: Hope it works for you just fine. It is not perfect but it is workable :) Thanks a stack