Twine Version: 2.3.9 (online)
Story Format: Sugarcube 2.31.1
I am writing an interactive fiction story. Throughout the course of the story some of the NPCs that the character meets can and will die, some by design others by choices made. The player has a ‘rolodex’, in which I track all the notable NPCs the player has met, as well as their relationship status. For example in my StoryInit I have the status key-value-pair and variable set as:
<<set $relations to {
0: "Not Met",
1: "Unknown",
2: "Acquaintance",
3: "Friend",
4: "Best Friend",
5: "Involved",
8: "Deceased",
9: "Enemy"
}>>
<<set $rstatusnpc1 to 0>>
As the player progresses, NPC1 (for example) will change up and/or down throughout the story. Once the NPC has been met, I use math.clamp() to ensure any changes don’t go outside the 1-5 range. The rolodex hides entries that are marked ‘0’ and displays the rest of them with the status displayed as the text for the key.
If NPC1 dies in Chapter 2, I would set the variable to 8, and the rolodex would reflect they are deceased. At this point I want that variable locked so that I don’t accidentally clobber myself at some point in a future chapter and accidentally resurrect the NPC.
My current status updating is fairly simple, maybe too much on the simple side, but they can happen pretty often in some sections depending on choices and conversations:
<<set $rstatusnpc1 to Math.clamp($rstatusnpc1 - 1, 1, 5)>>
In this case the status would drop by 1 and stay within range of 1-5. This would prevent me from accidentally setting the status back to 0 or 6+
If the status is set to 8 (NPC is deceased), and I run the set macro example a couple lines above, it sets the variable to 5 as I’ve said that’s the upper limit of the range. The problem is, for a dead NPC this would then set them to ‘Involved’. Now, I don’t want the players involved with dead bodies, as necrophilia is not somewhere I want to go. So I want to make sure not to make that mistake.
I could toss an ‘if’ around it to filter out the 8 and 9 values before setting, but I’d rather not have to do that each time I need to do a change. In some sections the status can change a few times, for better and/or worse.
I’ve debated trying to write a widget to manage the status changes so it can do the backend processing and prevent me from inadvertently resurrecting an NPC. I’ve incorporate some example/template widgets but need to put some time into actually writing one from scratch. A widget may be the easiest way to properly maintain the state with proper sanity checking built right in, to ensure I don’t break things.
Does this make any sense? Is there a better way to handle it?
Thanks in advance!