Random NPC generation in Trunk Notes

Published
2012-09-12
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:

1
gaudy rags
2
camo gear
3
scrounge wear
4
piecemeal armour
5
old leathers
6
canvas and cloth
7
cast-offs
8
jewelery
9
piercings and tattoos
10
dust-covered rags
11
worn-out luxe wear
12
too many clothes for the weather
13
not enough clothes for the weather
14
robes
15
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.

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.

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.