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

[Script] D&D 5e Minor and Medium Loot

1496248630

Edited 1496349575
Bast L.
Pro
API Scripter
Hello. I've been using tables and macros to let players generate loot in my games from encounters (not treasure hordes, but just what they find on henchmen or random monsters). My friend asked me to copy it into his game, but I don't think you can import tables, so I made it into a script. edit: This is for D&D 5E, I should have specified I haven't tested it much, and given how much I typed, there may be some typos in there, but so far it seems to work. To generate loot, you either type !MinorLoot or !MediumLoot (or put them in a macro). It can obviously be extended for greater loot levels, and also can be changed to whisper the result to the GM. It's obscenely long, mostly because of the tables I hand coded in. Hopefully this is useful for someone. Here's the GIST: edit below for updated. Edit: fixed a bug (was adding 1 to random rolls to make them 1-100, but also added 1 for arrays, which put the index outside the array, and never hit the 0th index).&nbsp; <a href="https://gist.github.com/anonymous/223e51487e67122e" rel="nofollow">https://gist.github.com/anonymous/223e51487e67122e</a>... Edit update 2: coins now generate in a for loop, instead of multiplying just a single d6 roll:&nbsp; <a href="https://gist.github.com/anonymous/c180cdbc189ecf9c" rel="nofollow">https://gist.github.com/anonymous/c180cdbc189ecf9c</a>...
1496249788
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Nice! There is a&nbsp; script that lets you import and export tables from tab-delimited data, BTW. (By Aaron, naturally)
1496250503
Bast L.
Pro
API Scripter
Heh. I was thinking of writing a table importer, but figured if I searched for it, someone would have already done it. Exporting too makes it all the sweeter. Still, this script prevents what I had before, where the players would click a macro, then another, then another to get the final loot results, so it's sort of useful for me anyways. Maybe I'll use that table exporter to get my scroll tables out, and make my script pick the spells (I was just getting too tired of typing in arrays, couldn't be bothered to put in the spell lists for each level).
Recursive tables might be what you are looking for so players don't have to click multiple buttons:&nbsp;<a href="https://app.roll20.net/forum/post/4954818/script-update-recursivetables-now-with-direct-support-for-whispering-roll-templates-and-more/?pageforid=4954818#post-4954818" rel="nofollow">https://app.roll20.net/forum/post/4954818/script-update-recursivetables-now-with-direct-support-for-whispering-roll-templates-and-more/?pageforid=4954818#post-4954818</a>