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

Multiplying and Division in Macro

So I am pretty sure there are already other topics about this, but I am new to the world of macro. (Like 0 experience with other code languages before). I am playing some pathfinder and I want to have an Arrow of Law wrote as a Macro.  What it does: Against Chaotic Non-Outsider, it deals 1d8x1/2 caster level (max 5d8) / Against Chaotic Outsider, it deals 1d6xcaster level (max 10d6) So I am guessing that we will be using the Dh and (). Can anyone explain to me how it's done?  In the past, I have succeeded to make a macro that does 1d8 + caster level damage max 5 for example, but never 1d8 x 1/2 caster level (max 5d8).  
1622607244

Edited 1622608915
vÍnce
Pro
Sheet Author
Here's one way (fyi: attribute names and how you leverage these macros depend on the sheet you are using); vs Chaotic Non-Outsider = [[ [[ { [[ {floor(@{caster_level}/2),1}kh1 ]], 5 }kl1 ]]d8 ]] I nested grouping rolls to compare two values.  Using the kh1 (keep high 1), you can ensure your 1/2 caster level can never go lower than 1.  floor rounds down decimals. Then I use the kl1 (keep low 1) to ensure it can never go higher than 5d6. vs Chaotic Outsider = [[ [[ {@{caster_level},10 }kl1 ]]d6 ]] using 10 here to cap at 10d6
Cool, I had to change @{caster_level} to @{level}. But it works! Thanks