Dog

A dog companion belonging to a player: an NPC of the game's dog class with an owner and a mode. When its owner leaves, it is removed, or with removedWithOwner false, it waits there until giveTo hands it to someone. The NPC events npcDamage and npcDeath also fire for its body.

dog.spawn()

Dog.spawn(owner, position, rotation, soul, name)

Spawns a dog for an owner.

dog.all()

Dog.all()

All dog companions.

dog.getById()

Dog.getById(id)

The dog with this network id, or null.

dog.soul

soul

The game soul it was spawned from.

dog.name

name

Its name, shown on all players' nameplates. You can assign to it.

dog.ownerId

ownerId

The owner's player id, or 0 with no owner.

dog.owner

owner

The owner, or null.

dog.removedWithOwner

removedWithOwner

Whether the dog is removed when its owner leaves, true by default. With false, it stays there with no owner.

dog.mode

mode

The companion mode: 0 Wait, staying put; 1 Follow, the default, trailing the owner and running to catch up; 4 Search, roaming to places within 12 m of the owner; 5 Hunt, running at the nearest living animal within 40 m, chasing it up to 80 m and biting for 12 health per second, as the attacker, or following the owner if none; and 2 Free, 3 Aggressive, 6 Guard and 7 Ambush, which are not implemented yet, so the dog stays put. Assigning sends the order again, and dogModeChanged fires only if the mode differs.

dog.objective

objective

What it is doing: 'waiting', 'following', 'searching', 'hunting', or 'idle' in a mode not yet implemented.

dog.morale

morale

The dog's morale. The game does not report it yet, so it is always 0.

dog.dimension

dimension

Its dimension, which is the owner's when spawned.

dog.position

position

Its location. Assigning teleports it.

dog.rotation

rotation

The direction it faces.

dog.state

state

Its shared state.

dog.giveTo()

giveTo(player)

Changes the owner. null removes the owner.

dog.destroy()

destroy()

Removes the dog.

dog.id

id: number

The dog's network id, the same as its NPC's.