It looks like you're new here. If you want to get involved, click one of these buttons!
Is it possible to use a lookup table and have the Roll: xxx value passed from a variable instead of a die roll?
Or is it possible to modify the Roll: xxx for a lookup table (e.g. Roll: 1d100 + {$1} )?
Comments
Yes. In the code below, there is a variable called SpellLevel. It's value basically set by a user prompt, but it could really be set by anything in the generator, but it better be an integer!
Then I call for a {1d{{SpellLevel}+1}-1} which is 1 roll of a (SpellLevel plus 1) sided die minus 1.
So say that SpellLevel was set to 5. It would call for a 1d{5+1} - 1, that is a 1d6 - 1, with integer results from 0 to 5. In this generator, it's used to generate a spell from level 0 (cantrip) to level 5 for a scroll of magic level 5.
You would use syntax more like Roll: 1d{100+{$var}}
And again, $var better have an established integer value before the die roll is called.
Maybe you were asking something more basic, like can I have a lookup table without a Roll: call. Yes, I use it often. Try calling the table like this:
[#{$var} TableName]
It sends the value of {$var} to the table, and if the table is defined as a lookup table, then it uses that value to lookup a result.
In the generator below, it looks like:
[#{1d28+90} CmdrTitle]
Which sends a value of 91 to 118 to table CmdrTitle, which effectively shifts the result to the higher end of the table, resulting in a much higher chance to have a noble or royal title.
Now, you can combine that with my previous post and make the 28 a variable, or the 90 a variable, or both. I suppose you could maybe even make the 1 a variable, if the number of dice rolled is determined by something else in your generator.
Here's a generator that I trimmed down from a much bigger one to demonstrate. In this one, if the knight's rank is low, like a Bachelor, then he rolls 1d104 on the noble title table, meaning he will be likely titled "Sir", and at best be titled "Baron". Whereas a Knight Commander sends a 1d28+90 to the table, making him more likely than not to have a noble title (must roll 11+ on the 1d28 to be a Baronnet or better, and yes, Baronnet is not technically a noble) and at best he may be a Crown Prince (rolls a 28 on the 1d28).
Thank you! Example #2 was almost exactly what I needed.