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

OGL Sheet reference level of spell as cast

Hey guys! I have a spell that, like magic missile, casts more "attacks" per spell level, rather than more dice. However, I can't seem to find a way to have it reference the spell level as chosen to cast with, and I want to automate as much as I can. I have a description of the spell which says "Number of metorites: [Formula] I even know the formula needed, which is [[[Spell Level] -3] /2] and can get it to spit out the right number when I have it query me for the spell level. However, I want the spell to detect what level I have it cast at, whether that be 5, 7, or 9. I've tried things like @{spell-level], @{slot-level}, and things in a similar line, but I can't find whatever variable is used for what level the spell is cast at.
1593834814
Oosh
Sheet Author
API Scripter
Are you talking about 5e? There is no "cast at level" variable stored in spells, as you can always choose which slot to use (even if the spell has no higher level casting, you can still use a higher level slot). The only thing that comes close is the spell tracking in the 5e Companion API - even then, you need to tell the VTT & the API  what level you wish to cast the spell at, not the other way around. You can pull the default spell level from the repeating spell field if you wish, but only YOU know which level you want to cast the spell at, and that requires a Query - using the value stored in the spell means you can only ever use the minimum spell slot. You can reuse a Query provided it has the same label. So this will only prompt once, for example: &{template:default}{{name=Spell level ?{Spell Slot?|3|4|5|6|7|8|9} }} {{Number of meteorites=[[floor((?{Spell Slot?}-3)/2)]]}} {{Damage per meteorite=[[?{Spell Slot?}*8]]}} I'm assuming this is a homebrew spell?
1593835288

Edited 1593835842
Yeah, it's a homebrew spell. I was hoping there was a variable to determine what spell level it's cast at, remembering some of the automatic upcasting results, but a query with a drop down list should suffice. EDIT: Only issue I have now is that it asks me twice for an answer, once when I roll the attack roll, and again when rolling damage. The damage doesn't change when cast with a higher level, so is there some way for it to only ask me this question once?
1593836254

Edited 1593836435
Oosh
Sheet Author
API Scripter
It sounds like you're using the Higher Level Cast fields in the spell settings. If you disable these (just changing the die type to NONE should do the trick) it shouldn't give you the default Query. This is in the spells tab, by the way, not in the Attacks & Spellcasting section. You could set up your own Attribute for storing the last spell slot used (as you've mentioned), but writing a value to it from a macro would require API access/Pro subscription.
Nah, I have this written in spell description now: number of meteorites: [[?{What level is the spell cast at?|Level 5, 1|Level 7, 2 1|Level 9, 3}]] It's just, it asks me the question both when I select the spell from my character sheet, as well as when I click in the chat to roll damage.
1593858978
Oosh
Sheet Author
API Scripter
Ah I see, the only way to avoid 2 queries would be to output the damage at the same time as the spell description. You can't reuse a query across multiple commands without using the API.