SetDogMode
Tells a dog to stay, follow or roam.
mode is one of the game’s dog modes - DOG_STAY (0), DOG_FOLLOW (1, what a new dog does), DOG_FREE (2) and the
others of the list above. It is kept on the dog’s state bag as mode, so it survives the master walking out of range and
back, and GetEntityState(dog, "mode") reads the same number. False for an id that is not a dog or a mode outside 0-7.
The /dog stay|follow|free built-in does exactly this.
Syntax
Section titled “Syntax”SetDogMode(id, mode)| Parameter | Type | |
|---|---|---|
id |
number | the dog’s entity id |
mode |
number | DOG_STAY, DOG_FOLLOW, DOG_FREE, … (0-7) |
Returns
Section titled “Returns”boolean - true when the mode was set
Example
Section titled “Example”-- the dog waits while its master is in the arenafunction OnPlayerEnterZone(pid, zone) local dog = GetPlayerDog(pid) if dog and zone == "arena" then SetDogMode(dog, DOG_STAY) endendSee also
Section titled “See also”GetDogMode · GetPlayerDog · CreateDog · the Dogs group of the index
