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

Random Encounter Macro

Need help with syntax on the following: If a d20 roll is 12 or higher then roll on encounter table. Would like to set this all up as a macro which references a weighted encounter table I will set up. Seems rather easy but I can't seem to wrap my head around the language/syntax of roll20.  Thanks!
1582128547

Edited 1582128583
Kraynic
Pro
Sheet Author
There isn't a way to do if/then type logic.  You can have each thing you need to do have a line of code.  I don't know what your roll table name is, so that would need to be put in correctly, but something like this should work: &{template:default} {{name=Random Encounter}} {{Encounter Chance=[[1d20cs>12cf<11]]}} {{Encounter Type=[[1t[rolltablenamehere]]]}} With it set up that way, any roll of 12 or higher is highlighted in green, while 11 or lower is highlighted in red.  If it is green, you check out your table result.  If you are like me, you may want to have a duplicate 2nd line for the rollable table.  If there are a lot of potential results, it could be that some will fit the current situation (or just be more interesting) better than others.
Ah fair enough, thanks for the input.
1582131482
GiGs
Pro
Sheet Author
API Scripter
Since you're a Pro user, I believe the Aaron's recursive tables script can be used for this. Offhand, I think you'd set up a table to replace your initial d20, with weight 11: nothing happens (representing roll 1-11), weight: 9 having a table call, and the recursive roll script will roll on the table and return its value. You can build several levels of nesting with it.