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

Macro/Math Question

I'm trying to create a macro to simulate this damage, This spell’s damage increases by 1d6 when you reach 5th level (2d6), 11th level (3d6), and 17th level (4d6). It starts at a 1d6 at level 1. I personally am unable to find a way to link 1-4->1, 5-10->2, 11-16->3, 17+->4 mathematically, so I am wondering if there is a math way to do so, or if I have to rely on macro'ing it, and how to macro it.
@Tim F. - This is essentially a 5e cantrip formula, so the following will work for you: [[((@{level} + 1) / 6 + 0.5)d6]] If you are not using the 5e sheet, you can substitue @{level} with whatever value you want to use, and of course this works for all other cantrips by swapping out the die value.
1428933669

Edited 1428933879
yes, i guess i could have clarified that is what the formula was for haha, thank you very much!!! edit: how would I be able to impliment this into my damage roll for the spell macro, or should I just build my own instead of using the given sheet?
If you are adding this to the Spellbook, then you can simply eliminate the "[[ ]]", putting "((@{level} + 1) / 6 + 0.5)d6" in the damage box.
Kevin said: If you are adding this to the Spellbook, then you can simply eliminate the "[[ ]]", putting "((@{level} + 1) / 6 + 0.5)d6" in the damage box. you sir are awesome, thank you so much
Another question, how do I add in a concentration modifier for a spell that I can enter while clicking the macro button?
1429032184

Edited 1429032199
Kryx
Pro
Sheet Author
API Scripter
What do you mean concentration modifier? For 5e concentration checks you just roll a concentration save. If you're looking to prompt you for some reason you can use ?{PROMPT MESSAGE HERE|0} Change 0 to whatever default you want.
Mark said: What do you mean concentration modifier? For 5e concentration checks you just roll a concentration save. If you're looking to prompt you for some reason you can use ?{PROMPT MESSAGE HERE|0} Change 0 to whatever default you want. Guess I wanted both (two different reasons), Where is the concentration save? And is there a reference to it I can use in the macro?
1429086041
Kryx
Pro
Sheet Author
API Scripter
5e does not have spell failure or anything like 3.X. A concentration check is made by a caster who is concentrating on a spell and takes damage. They make a Constitution save . There is a "Save" button on the default sheet as well as on my Shaped sheet. To access it you can use: %{CHARACTERNAME|Constitution_Save}
I have run into an issue, without changing my code, my first set of code "[[((@{level} + 1) / 6 + 0.5)d6]]" is now giving the issue of: Could not determine result type of: [{"type":"M","expr":"(((((abs(0-1)) (0+0+0+0+0+0+0+0+1+0+0+5+0+0+0+0+0+0))+(0 0))+1)/6+0.5)"},{"type":"C","text":"d6 + 0 + 0 + (0) + 0d0"}] My DM changed it to the shaped 5e player sheet, and this issue started to occur
1429258742
Lithl
Pro
Sheet Author
API Scripter
Tim F. said: I have run into an issue, without changing my code, my first set of code "[[((@{level} + 1) / 6 + 0.5)d6]]" is now giving the issue of: Could not determine result type of: [{"type":"M","expr":"(((((abs(0-1)) (0+0+0+0+0+0+0+0+1+0+0+5+0+0+0+0+0+0))+(0 0))+1)/6+0.5)"},{"type":"C","text":"d6 + 0 + 0 + (0) + 0d0"}] My DM changed it to the shaped 5e player sheet, and this issue started to occur You can't use functions (such as abs ) in an expression to calculate the number of dice to roll, and @{level} is expanding to an expression including abs . The regular 5e sheet's @{level} attribute is simply the sum of all of the class levels. The Shaped 5e sheet multiplies that same sum with @{is_pc}, which is defined as " abs(@{is_npc} - 1) ". Now you see the problem. @{is_pc} could be redefined as " 1 - @{is_npc} ", still get the same values, and wouldn't have this problem with rolls.
where could i change this issue? because this is just code that i was just trying to use with the preset macros
1429260285

Edited 1429260532
Kryx
Pro
Sheet Author
API Scripter
Brian said: @{is_pc} could be redefined as " 1 - @{is_npc} ", still get the same values, and wouldn't have this problem with rolls. Thanks for the investigation and solution, Brian! I will fix this. EDIT: Fixed this, committed it, and put in a pull request. It won't be live using the normal sheet for a few days (up to a week). If your GM wants he can get my code from github and copy it into his campaign settings. Code is here: <a href="https://github.com/mlenser/roll20-character-sheets/tree/master/D%26D_5e_Shaped" rel="nofollow">https://github.com/mlenser/roll20-character-sheets/tree/master/D%26D_5e_Shaped</a>