At this point I'm guessing what I'm trying to do isn't really possible, but I'm kind of desperate for a solution.
I'm currently trying to make weather tables for a survival-focused campaign. Right now, I'm trying to make the temperature table. The table, on paper, works like this:
- Roll a d20
- Temperature is that number in Celsius
- Final result is affected by a myriad of modifiers, for example altitude or season
- Low altitude is +1, Mid is nothing, and High is -1
- Spring is +1, Summer is +3, Fall is -3, Winter is -5
- Northern regions are -1, Mid regions are nothing, and Southern regions are +1
As you can see these aren't exactly standard table results as the total of it is affected by math directly. Northern regions in the spring at high altitude, for example, would be a total of ({1d20} - 2)C for temperature. I want 0 and below (and 21 and above) to be possible, just not by default which is why I've opted to simply have a 1d20 instead of a list of results. If no other modifiers, it should just be between 1 and 20.
The problem I'm running into is finding a way to input the modifier data. I want to avoid making separate tables for every single combination of modifier. So naturally I looked into prompts and attaching variables to their selected option. This didn't work and resulted in the program getting rather buggy. Since I'm kinda new to this I don't have the line of code I was using as a result. But I was probably definitely doing it wrong anyway. Regardless, something tells me using prompts for this isn't really possible, but I can't say for sure.
Does anyone have any advice for how to attach conditional modifiers to the final result of a table? The conditional modifiers are not randomly rolled and are determined by the area and time of year the party is currently in.
As another thing, I also want the option to roll twice and take the result closest to or furthest away from 10 in order to simulate the more/less extreme weather in landlocked/coastal areas, respectively. I suspect the way to do this would be by calculating some difference of 10, but again I'm sort of new to all of this stuff and not great at math.
Any help would be appreciated.
Comments
It's possible, and you do want prompts. Let me take a look.....
This works for altitude and season. Latitude is left for you. Note the "Roll is" and "Result is" are just there so you can see that it is working. If you don't want the first value to show up, you would just put x=={1d20} instead of a single equals sign, and then it would be silent.
Ok, and here it is with your roll twice option. "Mild" takes the result closer to 10, "Extreme" takes the result farther from 10. To figure out the distance from 10, we subtract 10, and then take the absolute value because we don't care if it is above or below zero, only how far.
I haven't made any tables lately so this forced me to remember everything!
Also note, for the mild and extreme values, I have it showing both values followed by the final value. In practice you would remove the {x} {y} part to just get the final value, but it's always helpful to put in that sort of thing to check that it's doing what you want, until you are satisfied with it.
Also, I handled the modifiers differently. There's usually more than one way to do things, the second way is easier if you are going to do it with multiple variables.