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

Adapting Macro Help(Auto Damage Adapter)

I don't even know where to start with this macro, so here I am. One of the people in the campaign is playing an Alchemical Artificer. Their alchemical formulas change damage frequently, like cantrips but more often. I need a macro that I can set into the roll that will check the player's level and change the dice accordingly. In this case, the player's level will be an attribute in the character sheet. I need the macro to recognize things like "Hey, this character is level 4, so his damage for this should be 2d6". The damage for this particular option changes at 4th level, 7th, 10th, 13th, 16th, and 19th. An idea I had was to try to make a formula that derives the number of dice to roll from the level somehow, but I don't know where to start with that. Any help would be appreciated. PS: We don't use the 5e character sheets, we just use the bare bones one.
1515931378

Edited 1515932318
GiGs
Pro
Sheet Author
API Scripter
Assuming the damage starts at 1d6, and increases by 1 d6 at level 4, 7, etc., the following should work /roll [[floor((@{Level}+2)/3)]]d6 Breaking it down,  level +2 converts each breakpoint (1, 4, 7, etc) into a number perfectly divisible by 3. The floor function takes a number and rounds down. the double square brackets [[ ]] are called inline rolls, and they calculate what's inside them. You can grab Attributes from a character sheet by putting them inside @{ } (but make sure you have no spaces. If you want to grab the attribute in a global macro, use the character name first, like so: @{name_of_character|Level} If making an Ability on the Attributes and Abilities tab, though, you can leave out the character name. So in this case, the inline roll calculates how many dice to roll. Here's the same formula broken up into its components so you can more easily see how it's constructed: /roll [[ floor( ( @{Level}+2 ) / 3 ) ]]d6 Edit: and naturally immediately after posting, i realised the ceil() function is much a better fit for this function: /roll [[ceil(@{Level}/3)]]d6 Ceil() rounds up instead of down, so no need for the +2 part.
This already helps me a lot, but is there a way to make the entire thing an inline roll?
1516491669
GiGs
Pro
Sheet Author
API Scripter
yes, just remove the /roll and put another set of double brackets around it: [[ [[ceil(@{Level}/3)]]d6 ]] I left some spaces there for clarity, but you don't need them.
Thanks a ton man, this really helps me out.