Attach a companion to a character
vault_attach_companionAttach a buddy (animal companion, hireling, follower, granted NPC, stock monster) to a Main character the user may edit (their own, or any for an admin with Admin Mode on). The row appears in the sheet's Companions section. Mode is decided by ownership: 'owned' for a character the Main character's owner already owns (its values are then edited on its own document via vault_update_character — the row is a live window, no copy is made, no character slot is used); 'link' for a character someone else owns (the source is never written; track its hit points and uses via vault_update_companion_state). The same source may be attached more than once — each row is independent. Response is { companion, companions, updatedAt }; ADOPT the returned updatedAt as the Main character's fresh stamp for any follow-up write.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Mongo `_id` of the Main character (owned by the calling user, or any character for an admin with Admin Mode on) the companion is attached to. | |
| mode | Yes | 'owned' when the Main character's owner owns the companion character (edits then write through to that character's own document; vault answers 403 otherwise). 'link' for a character anyone else owns — stock monsters, a GM's NPC — tracked via a local overlay that never writes to the source. To get a fully-editable copy of a creature the user does NOT own, vault_clone_character it first, then attach the copy with mode 'owned'. | |
| characterId | Yes | Mongo `_id` of the character to attach as the companion. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||