Skip to content

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.

SetDogMode(id, mode)
Parameter Type
id number the dog’s entity id
mode number DOG_STAY, DOG_FOLLOW, DOG_FREE, … (0-7)

boolean - true when the mode was set

-- the dog waits while its master is in the arena
function OnPlayerEnterZone(pid, zone)
local dog = GetPlayerDog(pid)
if dog and zone == "arena" then SetDogMode(dog, DOG_STAY) end
end

GetDogMode · GetPlayerDog · CreateDog · the Dogs group of the index