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 .
×

Using value of roll in the same spell (Pathfinder 2e Character Sheet)

1617661525

Edited 1617661548
Hey all, I was trying to get some automatic damage calculations for my spells working and couldn't figure out something so was wondering if anyone here can provide any insight in case I have missed something obvious. I would like to reference the value of the save_failure roll result in the other two fields (success and critical failure). As depicted below: However the result is each field rolling its own Xd4 dice instead of only failure rolling and the other two using the resulting value. Is there a way for me to get around that and reference the result of the 1 failure roll instead of getting 3 independent rolls? Thanks for any insight in advance :)
Hey! What you're looking for is this: $[[0]] That will reference a roll in a macro. Counting from 0, it'll reference each macro that happens, in order, within a macro.  So for example: [[1d2]]   [[1d4]] . $[[0]] will reference the result of the 1d2, and $[[1]] will reference the result of the 1d4. It'll take a bit of fiddling around. This has the limitation of not being able to modify the roll at all. IE, you can't then later say [[$[[1]] + 2]]. It won't like it. The best way I know to achieve this, is to roll all operations on it ahead of time, and then reference them later. Ie, if you did want to roll a 1d4, and then show that, and then later show it with +2 to it, you could do this: [[ [[1d4]] + 2]]    $[[0]] to show the 1d4 roll, and then $[[1]] to show the 1d4+2 roll. It'll could the highest member of a nested roll as the last number in the macro for that section.  Hope this made sense, and is also useful. 
1617704650

Edited 1617704991
Thanks for the reply, that works perfectly in a macro but unfortunately doesn't really well for what I wanted to do on the character sheet itself. My goal was to roll once for failure and then double it for critical failure and halve it for success but it seems that referencing the nested roll before it is rolled causes the further nested calculations to be ignored. This is my optimised input so that it all happens in one line for critical failure and referenced for the other two from the nested steps: Side note $[[2]] is the Spell DC value that is why I have used $[[1]] and $[[3]] only, as from my understanding and what I see: $[[1]] = [[ @{current_level}d20 ]] $[[3]] =  [[ [[ @{current_level}d20 ]] /2 ]] And here is what I got as a result: When I remove the $[[3]] reference the calculation happens normally:
When referencing rolls it's important to reference them after they happen. You may be able to reorder the rolls to get what you want though as such Success [[ [[ [[ @{current_level}d20 * 2]] / 2 ]] / 2 ]] Critical Failure   $[[1]]   Failure   $[[3]]   You may need to tweak the numbers used.
I realise what the issue is in the end, when I reference $[[3]] before the actual full roll in critical failure that locks the value in and it cannot alter it further via nested rolls.  I rearranged my formula and put it in success, referencing its nested rolls in failure and critical failure and it worked perfectly. Thanks again for pointing me in the right direction :)
RainbowEncoder said: When referencing rolls it's important to reference them after they happen. You may be able to reorder the rolls to get what you want though as such Success [[ [[ [[ @{current_level}d20 * 2]] / 2 ]] / 2 ]] Critical Failure   $[[1]]   Failure   $[[3]]   You may need to tweak the numbers used.  I managed to figure that out a few seconds before you posted but thanks for the reply and confirming my suspicion :)
It's a pretty sick little trick, I've utilized it a few times, it makes things a bit more complicated to set up, but when  you do, it's pretty sick.