Skip to content

Make betrothals and pregnancies

Goal: a promise to marry now, a wedding later, and a child some time after the wedding.

The package does not know the word betrothal or pregnancy. There is no engaged state and no pregnancy state. The README says it plainly: a betrothal is a relationship variable, a Wait Until and a Marry node, and a pregnancy is a Wait before Create Actor, or your own timer before actor.HaveChild.

You want The package gives you You build
A wedding Marry node, actor.Marry(spouse) The reason it happens now
A promise before it Nothing A variable or a tie, and a wait
A birth Create Actor with Create set to A child of, actor.HaveChild(...) The delay and the odds
  1. Add a variable that records the promise. Set its Belongs To to Each Relationship, so each actor can hold a value toward each other actor (see Variables). A tie works too: the demo scheme Pledge the Young uses an Add Tie node with Promised, a tie kind of the demo’s own database; make your own on Behaviour ▸ Opinions.
  2. After the promise, add a Wait Until. Its list of conditions is the moment of the wedding, for example both partners at least 16, as the demo does.
  3. Add a Check Marriage node with Check set to Can marry, and the partner in Other Actor. Then Marry with Actor and Spouse.
  4. Wire Married to what happens next, and Refused to undoing the promise.

You will see: the scheme waits at Wait Until, and the wedding runs when its conditions are met. Marry continues through Married, or through Refused when a rule forbids it.

  1. Add a Wait. The Unit can be Days, Months or Years, and Random Length gives a range.
  2. Add Create Actor. Set Create to A child of, pick the Parent, and turn on Second Parent for the other parent.
  3. Use Store In to keep the child for later nodes.

Example. Compiled against the package’s runtime assembly; not run in Unity. Both calls are in Actor.Family.cs; Marry and HaveChild return null when refused.

if (woman.CanMarry(man)) woman.Marry(man);
var child = woman.HaveChild(man);

IM.onChildBorn fires after a birth. See Families in code.

  • Marry or Marry(...) is refused: a world rule or FamilyLaw.CanMarry said no. Ask CanMarry(spouse, out var check) and read check.Text.
  • The child never appears: the wait did not end, or HaveChild returned null. The reason is logged at Log level.
  • One partner dies or marries someone else while you wait: the demo’s Wait Until also ends when a child is dead or already married, so add those conditions to yours.