Skip to content

Create characters while the game runs

Goal: a new person joins the world in the middle of a game, with a name, a family and a face.

  1. Add a Create Actor node where the person should appear.
  2. Set Create. A newcomer is a stranger. A child of is the child of one or two actors: pick the Parent and, with Second Parent on, the Other Parent.
  3. Fill in what you know. Name empty means a name from the culture’s name list. Gender is Random, Male or Female. Age 0 means a newborn. Culture empty gives a child the culture the world’s custom names, by default that of the parent whose family it is born into, else the other parent’s. A newcomer has none.
  4. Put the person somewhere. A newcomer has Family and Clan, or Clan Another Way for a clan named by a variable or by someone else’s clan. A child has Born into and Clan; the defaults follow the marriage and the world’s customs.
  5. Give a face with Look, or with Portrait (a sprite). Look wins over Portrait.
  6. Turn on Store In and pick an Actor variable of the scheme, so the nodes after it can reach the new person.

You will see: the flow continues through Out. The new actor has no entry on the Actors page. A saved game keeps it, and a load brings it back (see Actors made while the game runs).

With no Look and no Portrait, the actor has no face unless the setting Give actors without a look one that fits is on. It sits on the Settings page, in the section Portraits, and is off by default. When it is on, an actor made while the game runs gets a look that fits its gender, culture and age. The looks themselves are on the Looks tab, next to Actors; see Actors: Looks.

Intrigues makes a scene object for each new actor. To touch that object, put a component that derives from RuntimeActorHandler in the scene. Example. Compiled against the package’s runtime assembly; not run in Unity. The member is from RuntimeActorHandler.cs:

public class NewcomerHandler : RuntimeActorHandler
{
protected override void OnRuntimeActorCreated(Actor runtimeActor, GameObject actorGameObject)
{
// name the object, add a component, set a sprite
}
}

If you override OnEnable or OnDisable, call the base method first. The handler listens only while it is enabled.

  • A child is refused: a child older than a parent is refused when the world’s rule A parent must be older than the child is on.
  • The flow stops at the node: a newcomer’s clan was set with Clan Another Way and is not available.
  • The actor exists but never appears in a loaded scene: add a Runtime Actor Loader. See Runtime Actor Loader.

More: Create Actor, Actors in code.