open-campaign-logger / generator-library

This repository contains the generator library files for https://campaign-logger.com/generator which can be referenced like this: "{lib:adjColor}".
Apache License 2.0
31 stars 13 forks source link

Percentage chance of producing something from certain table or not at all #5

Open hkokko opened 7 years ago

hkokko commented 7 years ago

To be clear on my wish: I would like to see 100 percent chance of seeing an entry from table itemFromBasicItems and 20 percent chance of seeing an item from another table (magic items) so this is not weighing as such. Weighing is within the same table. Normal situation could be something from table a, something from table b, something from table c and then 20 percent from table d and 5 percent from table e. All the tables might be completely unrelated or they might be related (all are items). Another example: day at jungle - weather temperature, rainy season weather, jungle terrain, 40 percent chance of jungle standard event, 10percent chance of jungle special event, 20 percent chance of encounter of the enemy, 20 percent chance of encountering something from plant table a, 10 percent chance of there being a jungle trap - altogether 8 things could be the outcome - printed together as the daily event, 3 of which are there always and the rest might be depending on their percentage. All of these are tables in my current campaign and I have such a daily event generated - would like to use the campaign logger custom encounter tool for this... would think that this is relatively common need. It could be caravan loads, characteristics of a person, what is available in the market and what happens there etc.

JochenLinnemann commented 7 years ago

Using the current syntax (shortened, not real JSON) this would likely be:

"resultPattern": "{weather temperature}\r\n{rainy season weather}\r\n{jungle terrain}{additional jungle events}"

Define tables "weather temperature", "rainy season weather", and "jungle terrain" as normal.

Table "additional jungle events" just gets one entry for ease of reference: "{je_std_chance}{je_spc_chance}{ee_chance}{epa_chance}{jt_chance}"

Table "je_std_chance": { m: 40, v: "\r\n{jungle standard event}" }, { m: 60, v: "" }

Table "je_spc_chance": { m: 10, v: "\r\n{jungle special event}" }, { m: 90, v: "" }

Table "ee_chance": { m: 20, v: "\r\n{encounter of the enemy}" }, { m: 80, v: "" }

Table "epa_chance": { m: 20, v: "\r\n{plant table a encounter}" }, { m: 80, v: "" }

Table "jt_chance": { m: 10, v: "\r\n{jungle trap}" }, { m: 90, v: "" }