Using a defined variable to make X rolls on a treasure table

My current generator returns creatures which have a No. Appearing value. I set the result to a HowMany variable. Now I'm trying to use that result to have IPP roll on a treasure table for as many times as there are monsters appearing. Here's my current code:

Table:Goblin
Set:HowMany={2d4}
1: Goblin\nNo. Appearing: {$HowMany}\n\n &
HD(3 hp) AT 1 DAM 1d6 THACO 19 ML 7\n\n&
Saves:
D 14 W 15 P 16 B 17 S 18\n\n&
Treasure:\n{HowMany}[@TreasureTypeR]\n\nActivity:[@SentientDoing]

Table:TreasureTypeR
{2d6}ep

All the other tables referenced work fine.

Check these two results I just got:

Goblin
No. Appearing: 2

HD(3 hp) AT 1 DAM 1d6 THACO 19 ML 7

Saves: D 14 W 15 P 16 B 17 S 18

Treasure:
212ep

Activity:Drinking

Goblin
No. Appearing: 6

HD(3 hp) AT 1 DAM 1d6 THACO 19 ML 7

Saves: D 14 W 15 P 16 B 17 S 18

Treasure:
67ep

Activity:Butchering

The first Treasure result is impossible. The second is possible, but I've noticed that "possible" results all skew unexpectedly high--I typically get about ~10 ep per goblin, and I've run the gen several hundred times without seeing any lowest-possible results.

Any thoughts?

Comments

  • The treasure is returning a value {2d4} (from HowMany) and then the {2d6} number immediately afterwards. So the first digit will be 2-8, and then after that 2d6. The lowest you will get is 22 (2 followed by 2), and the highest 812 (8 followed by 12). That's not what you want of course. But the important point is that IPP is super literal.

    To do multiple picks from a table, the number of picks needs to be inside the call for the table. Otherwise it is just some separate text. So:

    [@{HowMany} TreasureTypeR]

    Also, that's just going to return a bunch of numbers and put one after the other. So for example if there are two rolls that return a 2 followed by a 3, it will display as 23.

    If you want to separate them with commas, you can add an implode filter:

    [@{HowMany} TreasureTypeR >> implode]

    If you want to add them all up, you'll want to have TreasureTypeR silently add them to a variable and then not display the variable until the main table.

    If you're picking text from a list instead of values, the implode option is good but you might also want to prevent repeats. In that case you would use ! instead of @ like this:

    [!{HowMany} TreasureTypeR >> implode]

  • Many thanks! A lot clearer now.

Leave a Comment