History
Life events people remember, shown on their sheet, recorded by scripts and rolled as backstories.
Everyone keeps a history: born, moved to the city, started dating someone, had coffee with you three times, backpacked across Japan. It shows on a person's sheet, newest first, and scripts can read it.
Event types are mod data, defined in History/*.ulhistory files; scripts record events of those types.
Defining event types
A .ulhistory file returns a list of types:
lua-- History/ynl_nightlife.ulhistory
return {
{ id = "ynl_danced_with", text = "{a} danced with {b} at {club}", you_b = "Danced with you at {club}",
icon = "Locations/nightclub" },
{ id = "ynl_kicked_out", text = "{a} got thrown out of {club}", icon = "Moods/angry",
level = "major", repeats = "always" },
{ id = "ynl_dj", text = "{a} DJ'd at {club} for a summer", icon = "Stock/instrument",
backstory = { chance = 0.05, min_age = 18, max_age = 35 },
pick = { club = { "Fabric", "Berghain", "the Warehouse" } } },
}
| Field | Meaning |
|---|---|
id |
What record uses. A later mod reusing an id redefines the type completely. |
text |
The line. {a} is the person it is about, {b} the other person; {a_he}, {a_his}, {a_him} (and {b_…}) are pronouns; any other {key} comes from the event's parameters |
you_a, you_b |
The text when the player is {a} / {b} |
icon |
<Group>/<name> from Map/Icons/ |
level |
"major" (always shown, top of the sheet) or "minor" (the default) |
repeats |
"stack" (default: the same event with the same person becomes one line with a count), "unique" (only ever once between two people), "always" (a new line each time) |
backstory |
{ chance, min_age, max_age, gender, needs_job }: may be part of a person's past, rolled once when the player meets them |
pick |
{ key = { values… } }: one value per key rolled into the parameters (for backstories) |
Recording events
luaActor:record("ynl_danced_with", Player, nil, { club = "the Anchor" })
Player:record("ynl_kicked_out", nil, nil, { club = "Velvet" })
Actor:record(type, other, level, params):
other: the second person, ornil.level:"major"/"minor"to override the type's default, ornil.params: a table filling the{key}placeholders.- Returns
falsewhen a"unique"event already happened between these two.
Reading history
lualocal times = Actor:hasEvent("ynl_danced_with") -- how many times (0 = never)
for _, e in ipairs(Actor:history()) do -- newest first
Game:Log(e.date .. " " .. e.text .. (e.count > 1 and (" x" .. e.count) or ""))
end
Each entry of history() has type, text, date, count, major and icon.
What the engine records itself
The base types in ul_Base/History/life.ulhistory include born, moved_to_city, finished_school, graduated, started_job, married, started_dating, broke_up, affair, child_born, met, exchanged_numbers, and minor ones meant for mods: coffee_together, dinner_together, argued, gift_received. Reuse those ids when they fit, so every mod's coffee dates stack on the same line.