Random NPC generation in Trunk Notes

Published
12 October 2012
Tagged

This week on the Story Games roleplaying forum, there's been a thread entitled: Dealing with Bad GMing Habits: Better NPCs. It's been an interesting read, mainly because of the tips and tricks that people let slip for how they make NPCs generated on the fly more interesting.

One of the things I noticed was that a lot of people have random X roll as their means for generating interesting NPCs. To be honest, I think random rolls for NPCs are good, because:

  • They allow for systematic 1-2-3-done NPC generation
  • They often bring two differing or opposing elements to light, which makes for conflict and interesting characters
  • They allow us to let go of biases, conscious of unconscious

Here are some of the random rolls suggested for NPCs:

  • attitude (tactile, loud)
  • accent or verbal tic (drums fingers, ums and ahs, etc.)
  • adjective (accommodating, hostile, loyal)
  • gender
  • positive/negative physical/mental aspects
  • motivation ( from the thread: "In its most basic form, this has two results: the NPC wants out of her situation, or the NPC wants to preserve her situation")

All of these are ripe for some form of random pick-from-list tool. Handily, Trunk Notes has that capability.

The Lists

The first thing to do is to construct a series of lists to do your picking from. These could be anything - names (first, last), ethnicities, objects, relations...you name it. I've namespaced these in my wiki: they all start with List:, which makes search easy. For example, List:Clothes:

gaudy rags
camo gear
scrounge wear
piecemeal armour
old leathers
canvas and cloth
cast-offs
jewelery
piercings and tattoos
dust-covered rags
worn-out luxe wear
too many clothes for the weather
not enough clothes for the weather
robes
a veil

It's important to have enough in each list that you won't get duplicates. I think it's also good, following Vincent Baker's advice, to misdirect, not to speak the name of the list item aloud. This means if two NPCs in a row are wearing cast-offs, the players are less likely to twig that I'm re-using the same element. Of course, if they speak to two people in a row wearing veils, they might start getting paranoid that a new cult's in town...this is not a bad thing.

The Snippet

The next step is to make a random NPC generator. I have a snippet set up, called Snippet:NPC. Whenever I'm in a note and I type NPCXX[^1], it will be replaced by the text of the NPC snippet.

Recall that if you type fooXX it'll take the contents of the page Snippet:foo and dump it on your cursor.

Inside a note, you can use the following syntax to pick a random line from another note: {{random NoteName}}. So in my NPC snippet I have the phrase: {{random List:Clothes}}. When the page renders, this will be replaced with a random entry from the clothes list. I can use a number of these in the same snippet, so if I make an NPC, I'll put a title for their name, then I'll type NPCXX and suddenly they'll be populated with a random set of clothes, gender, outlook, motivation, etc. etc.

There's still one problem: every {{random}} field regenerates whenever I reload the page. It makes sense - when you expand a snippet, Trunk Notes just dumps the entirety of the snippet wherever you're typing, without regard to evaluating code.

{% figure url="flow-1.png" %}

There is, however, a way around this.

If you put !! at the start of a snippet, Trunk Notes will evaluate the snippet before inserting it. That means that where you have {{random List:Clothes}}, Trunk Notes will actually go out and grab a random type of clothing before inserting the snippet. Effectively, we're shunting the code evaluation from page-load to the snippet insertion point.

{% figure url="flow-2.png" %}

Now when you generate an NPC, you get a randomly-generated list of attributes to play with, and no fiddling around rolling on tables either. Nice and simple.