Gameplay content

Sharing a home

Let a contact move into the player's home for real, with stated money terms, and move out cleanly; keep children and other dependents who are never drawn.

Household makes living together real: the person becomes the player's housemate (a relationship role), the player's home becomes theirs (their routine sleeps there), and any money between them is stated up front and paid through the ledger.

lualocal M = "ynl_Flatshare"

local why = Household:invite(M, person, { contribution = 150, dueDay = 1, deposit = 100 })
if why then return why end                     -- "You need a home of your own first."...
-- Their answer is yours to decide, in your story:
local yes = person:GetStat("rapportwithplayer") >= 30
why = Household:respond(M, person, yes)          -- nil when they moved in

What it does

  • Invitation, then an answer. invite checks there is a home, room (capacity), and that the person is an adult in the player's contacts; the invitation lasts 72 game hours. respond is the person's answer, which your mod decides.
  • Money is theirs, and stated. The deposit comes from the person's own money and is held in your mod's ledger account (the wallet shows it); it is refunded whenever they leave, for whatever reason. The contribution is paid to the player on dueDay each month, from the person's money. A month they cannot pay is reported to the player ("could not pay their share"), not invented. The player's own rent is unaffected.
  • Leaving. Household:leave(mod, person, reason), or automatically when the person is blocked or deleted, or the player moves to another home. Their previous home is restored and the role removed.
  • Mod turned off. Nothing is charged while your mod is off; due dates move on rather than piling up.
  • House rules are shared values: Household:setRule(mod, "guests", "Ask first"), read by anyone with Household:rule("guests"), for example in an action's AVAILABLE check.

Capacity is data

Household/*.ulhouse sets how many people can share a home, by the home's venue tag:

luareturn { capacity = { default = 2, apartment = 3, studio = 1 } }

Moving an older agreement in

If an earlier version of your mod recorded a narrative "living together" agreement, do not turn it into a household by yourself: offer the move-in as an explicit choice, with its terms. ul_Housemates 0.2 does exactly that.

Call Does
Household:home() { id, capacity, members }, or nil without a home.
Household:members() { { id, name, module, joined, contribution, dueDay, nextDue, deposit, missed } }
Household:isMember(person) Lives with the player.
Household:invite(mod, person, terms) nil, or why not.
Household:respond(mod, person, accept) nil when done, or why not ("They cannot afford the deposit.").
Household:leave(mod, person [, reason]) true if they lived there.
Household:invites() Open invitations.
Household:setRule(mod, key, value), Household:rule(key) House rules.
Household:version() The API version, 1.

Dependents: people in the player's care, never drawn

A child, a ward or a frail parent does not have to be a person with a body. Actor:addDependent keeps them as a record: a name, a relation and a birth date. They are listed under In your care in the player's People panel, with an age that moves with the calendar, and they are never rendered in 3D.

lualocal M = "ul_Adoption"

local id = Player:addDependent({ name = "Mia", relation = "daughter", gender = "female", age = 4, mod = M, school = "St Anne's" })

for _, d in ipairs(Player:getDependents()) do
	if d.mod == M and d.age >= 5 then Player:setDependent(d.id, "stage", "school age") end
end

Player:removeDependent(id)      -- grown up and moved out
  • age (years) or birth (game hours, negative for before the game began) sets the birth date. A story that compresses time can set age again as the child grows, as ul_Parenthood does with its stages.
  • Any other field you pass (school, stage, allergy) is kept as text and returned by getDependents: no variable per child.
  • mod tells your records from another mod's. Every mod sees all of them, so a school or a babysitting mod can ask whether the player has a child, whoever added it.
  • A child born of a pregnancy is a full person with a body; use a dependent when the child should stay off screen.