Merry Boxing Day everybody!
So I'd like to generate a set of related traits for my NPCs. Here's how I'm doing it right now:
<<set $npc to {}>>
<<set _jobRoll to random (1, 4)>>
<<if _jobRoll == 1>>
<<set $npc.job to "rat catcher",
$npc.socialClass to "low",
$npc.equipment to "rat trap">>
<<elseif _jobRoll == 2>>
<<set $npc.job to "witch finder",
$npc.socialClass to "medium",
$npc.equipment to "pointy hat">>
<<elseif _jobRoll == 3>>
<<set $npc.job to "peasant",
$npc.socialClass to "low",
$npc.equipment to "mud">>
<<elseif _jobRoll == 4>>
<<set $npc.job to "priest",
$npc.socialClass to "high",
$npc.equipment to "holy book">>
<</if>>
This works, but I feel like I'm doing it inefficiently. Is there a way to do this without the _jobRoll bit? What I'd like to do is something like:
<<set $npc to {}>>
<<set setup.jobs to [
Job title: 'Rat catcher' Social class: 'low' Equipment: "rat trap",
Job title: 'Witch finder' Social class: 'medium' Equipment: "pointy hat"]>>
<<set $npc.job to setup.jobs.random()>>
Is that possible?