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

Reroll just once?

1411633084
Gen Kitty
Forum Champion
I'm updating my pathfinder macros and I'd really like to have 1d20r>18 only reroll ONCE, no matter what the next number is. I'm using HoneyBadger's powercards script if that means something can be shoved in there to help.
1411633190

Edited 1411633268
Gauss
Forum Champion
At this time there is no way to reroll once without using the API. What some people are doing is to put in a "Crit: [[18+modifiers]]" section and then reroll manually if the attack roll equals or exceeds the crit value.
1411633825
Gen Kitty
Forum Champion
Yeah. I've been doing a second 'crit confirm' section and I was hoping to do something more elegant. Since I *am* using API....
I don't know the API'language, but logically couldn't you do a basic if/then/else? assign the initial roll to a variable if variable is greater than 17, assign that variable a new 1d20 roll else variable doesn't change return the value of variable, whether it changed or not #pseudo BS code, DEFINITELY not correct syntax function (CritThreat) ; { varRoll = 1d20 If (varRoll > 17) Then ( varRoll = 1d20) Return (varRoll); }
1411665767

Edited 1411666066
The Aaron
Roll20 Production Team
API Scripter
You definitely can. The real question is how you want to interact with it. // Mark G's pseudo code in javascript: var rerollThreats = function (critThreat) { var theRoll = randomInteger(20); theRoll = (theRoll >= critThreat) ? randomInteger(20) : theRoll; return theRoll; };
Wow on this note for D&D 5e, I need one for rerolling 1s and 2s once. (Takes in a # for number of die, and takes in a # for number of sides to each die) Then I also need one which turns 1s into 2s. (Takes in a # for number of die, and takes in a # for number of sides to each die) Totals it up, called by a command !, and bam, two minor issues (very minor) issues I have remaining for 5e.
1411669748
The Aaron
Roll20 Production Team
API Scripter
Right. That's leaving out the whole "how you want to interact with it" part. If you want to pass it as a die mechanic to any existing scripts, it's not going to work correctly. For example, it would be easy to write an api script for: !rollWithRerollThreatOnce 20 17 which would roll a d20, then reroll it once if it was 17 or greater. It would be hard to fit that into an HB Powercard because the dice system for HB Powercards don't understand a syntax for this.
Ah, I see, oddly enough the first one is just a display as a roll, the latter (1 -> 2s) is eventually going to be merged with the 5e Powercard system once it is done.
It's possible to add dice syntax of a sort to the powercard script, as shown by the highlighting of high/low numbers. I just need to expand on that system and figure out how to make it more robust, but as I've said elsewhere... I'm a little burnt out on scripting right now and have other things occupying my attention.
1411674153
Lithl
Pro
Sheet Author
API Scripter
Aaron said: You definitely can. The real question is how you want to interact with it. // Mark G's pseudo code in javascript: var rerollThreats = function (critThreat) { var theRoll = randomInteger(20); theRoll = (theRoll >= critThreat) ? randomInteger(20) : theRoll; return theRoll; }; You would also need to display the original roll (or otherwise indicate that the reroll ocurred), since this is about confirming a critical. If you roll 20, 10 and only display the 10, it would be pretty useless for crits.
1411674602

Edited 1411677639
The Aaron
Roll20 Production Team
API Scripter
Brian said: Aaron said: You definitely can. The real question is how you want to interact with it. // Mark G's pseudo code in javascript: var rerollThreats = function (critThreat) { var theRoll = randomInteger(20); theRoll = (theRoll >= critThreat) ? randomInteger(20) : theRoll; return theRoll; }; You would also need to display the original roll (or otherwise indicate that the reroll ocurred), since this is about confirming a critical. If you roll 20, 10 and only display the 10, it would be pretty useless for crits. Good point. I was just translating the pseudo code, but you're absolutely right. Maybe something like: // Mark G's pseudo code in javascript: var rerollThreats = function (critThreat) { var roll = randomInteger(20), res = { first: roll, second: (roll >= critThreat) ? randomInteger(20) : NaN, value: 0, rerolled: false }; res.value = (res.rerolled = !_.isNaN(res.second) ) ? res.second : res.first; return res; };
1411676666

Edited 1411676671
Lithl
Pro
Sheet Author
API Scripter
You have a typo in your ternary condition =P
1411677660
The Aaron
Roll20 Production Team
API Scripter
Thanks! Fixed. =D