Pets
The .ulpet files that put a companion animal in the player's home, and how to add a kind, a coat or a clip.
A pet is a companion animal that lives in the player's home: it idles, sits, lies down and walks from spot to spot
on the floor. It is not a person: it has no stats, no scenes of its own and no needs. Its life (hunger, health,
the bond with its owner) belongs to the mod that gives it, ul_Pets, which keeps it in the owner's
variables. The engine only reads what kind of pet the player has and shows it.
Pets are companions only. They are a separate system from creatures: a pet can never be cast in a scene.
When a pet shows
When the player is inside their own home, the game reads three variables from the player:
| Variable | Set by | Meaning |
|---|---|---|
pet_health (stat) |
ul_Pets |
above 0: the player has a pet |
pets_kind |
Player:adoptPet(kind, name) |
which .ulpet to show, by its kind |
pets_coat |
your mod (optional) | which coat; without one, the pet keeps a coat picked from its name |
The pet appears on one of the room's free floor spots and leaves with the player.
The .ulpet file
One file per kind, in Pets/ of any mod (a later mod replaces an earlier one with the same id):
json{
"id": "cat",
"kind": "cat",
"mesh": "Pets/Cat/Cat.fbx",
"normal": "Cat_N.png",
"fur_opacity": "Fur_M.png",
"yaw_offset": -90,
"scale": 1.0,
"walk_speed": 24.4,
"slots": { "Coat": "body", "Fur": "fur", "Eye": "eye" },
"clips": {
"idle": "Pets/Cat/Cat_idle.fbx",
"walk": "Pets/Cat/Cat_walk.fbx",
"sit": "Pets/Cat/Cat_sit.fbx",
"loaf": "Pets/Cat/Cat_loaf.fbx"
},
"coats": [
{ "id": "brown_tabby", "diffuse": "Coat_BrownTabby_BC.png", "eye": "Eye_Amber_BC.png" }
]
}
| Key | Meaning |
|---|---|
kind |
what pets_kind holds for this animal |
mesh |
a rigged FBX under Meshes/; its textures sit in a Textures/ folder beside it |
slots |
each material of the mesh and what it is: body (opaque coat), fur (cut out by fur_opacity), eye |
normal, fur_opacity |
shared by every coat; the fur cards use the coat's own UVs, so one opacity map serves all coats |
coats |
the coat texture and the eye texture that goes with it |
clips |
one looping FBX per state, on the mesh's own skeleton (bones matched by name) |
walk_speed |
cm/s of the walk clip's stride, so the paws do not slide |
yaw_offset, scale |
turn and size the mesh to face the actor's forward and stand at its real size |
The four states the engine plays are idle, sit, loaf (lying down) and walk. A clip that is missing leaves
that state on the previous pose.
One skeleton for four legs
Every four-legged pet of the official mods uses the same bone names: root, pelvis, spine_01 to spine_03,
chest, neck_01, neck_02, head, jaw, ear_l/r, eye_l/r, scapula, upperarm, forearm, hand, finger
(front, _l/_r), thigh, calf, foot, toe (back, _l/_r) and tail_01 to tail_08. Each kind has its own
lengths; a clip made for one kind plays on another and is tuned there.
Checking a pet
The room test shows pets in a lit room, in a row:
-RoomTag=home -RoomSweep=1 -RoomNoNpcs -RoomPets=cat:brown_tabby,cat:ginger [-RoomPetState=sit]
The log prints each pet's size and where its feet stand against the floor.
In a normal game, two console commands help: ul.Pet.Give cat brown_tabby Biscuit gives the player that pet (as
the adoption does) and shows it at once when they stand in their home; ul.Pet.Look [cm] [side|front|back] puts
the camera on it (focus:off in a -MapHudPress list gives the view back).