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

Looking to implement the HexSystem counter draw from bag mechanic

I'm looking for a way to implement drawing positive and negative pips from a bag. The Not the End RPG uses positive and negative counters (or tokens) to randomly select from to determine the results of a challenge. The setup is that the GM determines the target number difficulty which is also number of negative counters placed in the draw "bag". A player adds a positive counter for each of their character's traits involved achieving success against this challenge. Once all counters are in the bag, the player reaches into the bag and randomly selects 1 to 4 counters.  If at least one positive counter is drawn, then the task is a success, and any other positive counters drawn bolster the success in some way.  Each negative counter is drawn creates a complication or some other difficulty for the player. If more than 1 token is drawn from the bag both positive and negative tokens can be drawn, but do not cancel each other.  I hope I've explained this correctly.
1666483086
Andrew R.
Pro
Sheet Author
There’s a similar mechanic in the 13th Age class Chaos Mage which we implemented with a card deck in Roll20. 
That sounds great. I don't know what that is, but I'll try to find out.
1666498560
David M.
Pro
API Scripter
Card deck would certainly work. Here's another option using the Scriptcards Mod/script, if I'm understanding the mechanics properly.&nbsp; This queries for the number of Positive and Negative tokens to put into the bag as well as the number of tokens to draw. These are displayed in the subtitle of the output card. Creates an array containing the values of the bag contents, then randomly rolls (draws) the prescribed number of times against the remaining contents of the bag. After an array element is rolled, that element is removed from the array for subsequent draws. As a sanity check, I output the remaining contents of the bag before each draw is performed.&nbsp; If you want to save on chat space, you can remove those lines by deleting the following full line from the macro below (In the DrawToken function) --+|[r][b]Remaining:[/b] [&amp;remainingToks][/r] Example output: Here's the scriptcard macro. !scriptcard {{ --#title|Not the End RPG --#leftsub|+1's: [?{Num Positive Counters?|1}] --#rightsub|-1's: [?{Num Negative Counters?|0}] --:Formatting| --#titleCardBackground|#000000 --#titlecardbackgroundimage|url('<a href="https://s3.amazonaws.com/files.d20.io/images/310650058/OlhR4KGJz1KJzCOpsaxP_w/max.png?');background-size" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/310650058/OlhR4KGJz1KJzCOpsaxP_w/max.png?');background-size</a>: 100% 100%; background-repeat: no-repeat --#subtitleFontColor|#000000 --#titleFontColor|#bbbbbb --#oddRowBackground|#bbbbbb --:Initialize Roll Vars| --=NumPos|?{Num Positive Counters?} --=NumNeg|?{Num Negative Counters?} --=TokensRemaining|[$NumPos] + [$NumNeg] --=NumDraws|?{Num Draws?|1} --=NumSuccess|0 --=NumFail|0 --:Data Validation| --?[$NumDraws] -gt [$TokensRemaining]|[ --+[#990000][c]Error[/c][/#]|[c][$NumDraws] Draws(s) requested, but only [$TokensRemaining] Token(s) available![/c] --X| End Macro --]| --:Define an array representing the draw bag| add the req'd number of +1/-1 entries --?[$NumNeg] -gt 0|[ --%i|1;[$NumNeg];1 --~|array;add;DrawBag;-1 --%| --]| --?[$NumPos] -gt 0|[ --%i|1;[$NumPos];1 --~|array;add;DrawBag;1 --%| --]| --:Draw Tokens from Bag| --+[#990000]DRAWS ([$NumDraws])[/#]| --=DrawCount|0 --:BaseDiceLoop| --=DrawCount|[$DrawCount] + 1 --&gt;DrawToken| --?[$DrawCount] -lt [$NumDraws]|BaseDiceLoop --:Evaluation| --+[#990000]RESULTS[/#]| --:Output Success and Failure counts| --+|[c][b]Successes = [$NumSuccess][/b][/c] --+|[c][b]Complications = [$NumFail][/b][/c] --X| End macro --:FUNCTIONS| --:DrawToken| --=DrawNum|[$DrawNum]+1 --~remainingToks|array;stringify;DrawBag;, --+|[r][b]Remaining:[/b] [&amp;remainingToks][/r] --=ThisIndex|1d[$TokensRemaining.Raw] - 1 --=ThisDraw|[@DrawBag([$ThisIndex.Raw])] --+Draw [$DrawNum]|[$ThisDraw] --~|array;removeat;DrawBag;[$ThisIndex.Raw] --~length|array;getlength;DrawBag --=TokensRemaining|[&amp;length] --?[$ThisDraw] -eq 1|&gt;AddSuccess --?[$ThisDraw] -eq -1|&gt;AddFail --&lt;| --:AddSuccess| --=NumSuccess|[$NumSuccess] + 1 --&lt;| --:AddFail| --=NumFail|[$NumFail] + 1 --&lt;| }}
Thank you. The scriptcard worked out nicely.