Hey all! I am currently trying to find a way to snippet code a feature with options. Most options need to return 2d6 between levels 1 and 17, and return 4 between levels 18 and 20. I can't find a way to make that represent accurately without needing to place the post processor @rounddown in the middle. Any suggestions would be amazing!
I haven't tested if {{scalevalue}} works in a feature's options' snippets but you can try filling out the level scaling section and see if {{scalevalue}} works
Most options need to return 2d6 between levels 1 and 17, and return 4 between levels 18 and 20
I assume you mean 4d8 for levels 18 through 20.
If {{scalevalue}} doesn't work in options' snippets then you'll need to use @rounddown in there because the best way to delineate between stuff that happens before a particular level and what happens after that level is to divide by that level. In your instance, you're dividing by 18. Simplified your code would be:
This snippet code starts with 2, which is the starting value for number of dice from levels 1-17.
Adding to this is the (classlevel/18)@rounddown*2. For any level below 18 classlevel/18 returns 0.something. For 18 it returns 1 and above 18 it returns 1.something. Using @rounddown eliminates everything after the decimal giving every level below 18 the result of 0 and 18 and up a result of 1. Multiply that 0 or 1 by 2 since the difference between your starting value and your ending value is 2. 0 times 2 is 0 and 1 times 2 is 2. This result is added to your starting value of 2 giving 2+0 or 2+2 depending on that classlevel.
I call this a level switch and I gave a decently explained breakdown in this comment the other day and explore quite a few snippet codes in this thread a few years back.
Hey all! I am currently trying to find a way to snippet code a feature with options. Most options need to return 2d6 between levels 1 and 17, and return 4 between levels 18 and 20. I can't find a way to make that represent accurately without needing to place the post processor @rounddown in the middle. Any suggestions would be amazing!
I haven't tested if {{scalevalue}} works in a feature's options' snippets but you can try filling out the level scaling section and see if {{scalevalue}} works
I assume you mean 4d8 for levels 18 through 20.
If {{scalevalue}} doesn't work in options' snippets then you'll need to use @rounddown in there because the best way to delineate between stuff that happens before a particular level and what happens after that level is to divide by that level. In your instance, you're dividing by 18. Simplified your code would be:
This snippet code starts with 2, which is the starting value for number of dice from levels 1-17.
Adding to this is the (classlevel/18)@rounddown*2. For any level below 18 classlevel/18 returns 0.something. For 18 it returns 1 and above 18 it returns 1.something. Using @rounddown eliminates everything after the decimal giving every level below 18 the result of 0 and 18 and up a result of 1. Multiply that 0 or 1 by 2 since the difference between your starting value and your ending value is 2. 0 times 2 is 0 and 1 times 2 is 2. This result is added to your starting value of 2 giving 2+0 or 2+2 depending on that classlevel.
I call this a level switch and I gave a decently explained breakdown in this comment the other day and explore quite a few snippet codes in this thread a few years back.
How to: Replace DEX in AC | Jump & Suffocation stats | Spell & class effect buff system | Wild Shape effect system | Tool Proficiencies as Custom Skills | Spells at higher levels explained | Superior Fighting/Martial Adept Fix | Snippet Codes Explored - Subclasses | Snippet Math Theory | Homebrew Weapons Explained
My: FEATS | MAGIC ITEMS | MONSTERS | SUBCLASSES Artificer Specialist: Weaveblade
Dndbeyond images not loading WORKAROUND FIXED!!! (TY Jay_Lane for original instructions)