Generator Building 5 - Potion Effects and Input Dropdowns

Duncan Thomson

Now it's time to look at more potion effects and adding an input dropdown to start filtering our results.

This is part 5 of a series of articles on Creating a Random Generator. Part 4 is here. Part 6 is here.

The Magic of Effects

The magic of potions is the variety of abilities and boosts they might give, temporary or permanent. We want some more beyond the ten or so we have.

So using the resources from our potion research, the existing effects and thinking of a few we've got 40 new effects. These have been split out into different effects so that we can work more magic with them.

The arbitrary groups are Physical, Magical, Psychic and Unusual. Unusual covers curses, things that aren't potions and weird stuff.

Physical Effects

  • an extra pair of arms
  • ability to survive without air, but cannot speak
  • skin as hard as iron
  • a large pair of sharp horns
  • the form of {a} {swarm of bees|cat|dog|crab|kangaroo|bear|stick insect|duck}
  • a body glows with a bright light
  • an always loud voice
  • arms that stretch four times as far
  • hair that grows a month's worth each minute
  • an arm turned into a snake

Magical

  • ability to move through solid objects
  • enhanced {speed|strength|vision|agility|sense of smell}
  • ability to {fly|climb any surface|levitate up and down}
  • invisibility to undead
  • darkvision
  • ability to speak with {beasts|fish|birds|plants|corpses|metal|stone}
  • walk on liquid as if solid ground
  • instantly heal all wounds and afflictions
  • a cloud of glowing glitter that surrounds them
  • immunity to fire but is also on fire

Psychic

  • ability to comprehend all written languages
  • immunity to fear and a nosebleed
  • enhanced {intelligence}
  • telepathy with creatures you can see, hear or smell
  • the memories of everything in your life
  • a {hatred|phobia|love} of {arrows|swords|fire|gold|cats|dogs|water}
  • telekinesis
  • ability to cast the same spells as the nearest spellcaster
  • thought-reading of anyone you are looking at
  • the ability to make a masterpiece out of anything

Unusual

  • a petrified body and gear
  • a curse where they cannot stop dancing
  • nothing. But they release a ghost that was trapped inside!
  • nothing. It is in fact a type of tea. Slightly magical to keep it fresh and hot.
  • a time jump forward 24 hours
  • the form of a piece of furniture
  • a curse to be unable to talk except in rhyme
  • severe craving for {cheese|apples|anything spicy|water|alcohol}
  • attractiveness to all {humanoids|beasts|undead|others of your species}
  • a massive headache

Using the Effects

In Chartopia and Perchance these 4 types of effect are split into separate lists.

In Perchance the old "potion effect" table was renamed to "effect_all" with an equal chance of using each of the 4 new lists

Perchance Effect All

For Chartopia I created sub-charts for each list and changed the "Potion Effects" table to have 4 options, each using one of the new sub-charts.

Chartopia Potion Effects

Input Variable

Next up was to figure out how to add input for "Effect Type" to the generator. Using the 4 lists we've just added to give different options of effects.

Inputs allow generators to return more specific results such as an encounter terrain or type of NPC.

The Random Inn and Tavern Generator at donjon has two simple inputs.

Inputs at donjon Inn Generator

Adding an input is an involved task in both Chartopia and Perchance. This was complicated by using 5 different templates for the potion text.

Adding a Filter in Perchance

This was worked out from Perchance example generators

To get the input dropdown, a select tag was added to the HTML window. It had options for "Any" and the four new lists.

The piece of code:

oninput="effect_input = this.value, update()

sets the variable "effect_input" to the selection of the Potion Type input and refreshes the potion generator output.

perchance potion type input!

The next part was setting up the potion_effect list to match the effect lists for the selected input.

potion effect list

The effect_input = "any" is used for the first result of the potion generator.

In the "potioneffect" list each possible value of the effect input points to the appropriate effect list. When "magic" is chosen from the input, the effectinput variable is "magic" and the "effectmagic" list is used as the result for "potioneffect"

Look at the code for the updated Potions Generator v5 at perchance to have a closer look.

Adding a Filter in Chartopia

Adding the Input was simple in Chartopia by adding a Dropdown under "Input Variables" but then adding in the logic got trickier.

Chartopia inputs

The first part was where to put the code related to the potion effect input.

To allow for the logic this I moved the main chart (the topmost / first chart) into a sub-chart called "Potion Template". The easiest way to copy over the text was by selecting all of the text from ".csv" mode. Then pasting the text into the "Potion Template" sub-chart using "csv" mode again.

Then it was time to make use of the Input Variables help at Chartopia.

To match the chosen dropdown input with the relevant sub-chart a column was added to Potion Effects called EffectType. This has the same 5 values as the input variable.

A row for "Any" was added at the start of the sub-chart. This has an equal chance of using the four new "effect" sub-charts

Potion Effects new column

Next was the main template. Here a variable "rolled_effect" is created. The next section

{%rolled_effect = {CHART(id="30842", filter="{$Potion_Effect}", filter_cols="2", cols="1" )}%}

is rolling on the Potion Effects sub-chart (chart 30842), using the chosen value from the Potion_Effect input. This is then matched to the second column "EffectType" of Potion Effects subchart, and the first column is used to choose one of the new lists.

(so if "Physical Effect" is selected in the input, this is matched with "Physical Effect" in the EffectType column and we "roll on Effect Physical" subchart)

Main Chartopia Template

And then we use the Potion Template sub-chart which uses the rolled_effect variable.

Chartopia potion layout chart

And the Chartopia Potions v5 gen is good to go

Things That Need Attention

What we've added is great with more effects and an input for type of potion

But the following bits need to be tidied up.

  1. some effects could happen more often than others
  2. only one potion result is being shown at a time
  3. some effects are instantaneous but have a duration on them
  4. all the potions are the same duration

And the potion generator could benefit from

  1. detail and variety in the containers
  2. expanding potion to "philter", "elixir" and other potion synonyms.
  3. an effect that gives "the delusion of" another potion effect happening
  4. unique potions that don't fit any template
  5. more variety in the appearance
  6. possibly potion names
  7. possibly some more templates
  8. possibly... labels

Finishing Up

So we have 40 effects and an input table to filter them by different types.

New versions of Chartopia Potions and Perchance Potions are up.

Any questions or requests welcome.

If you've got feedback leave a comment, head on over to r/rpg_generators at reddit or come join the Rand Roll discord server.