Monster Sleeping Hours

Jump to: navigation, search

Monsters can be set up to have certain sleeping hours during which they are passive. Currently no backend interface exists to facilitate this; the data needs to be changed directly in the database.

Internally, the server divides every in-game hour into ten equal parts, which equals a total of 240 parts per day. These are stored in a char array, each entry containing the amount of hours the monsters should still sleep at that time. This means that the smallest time period you can control the sleeping hours of a monster is six minutes (in-game time), which is one minute in the real world. The sleeping time of a monster is further increased by a random amount of time between 0-30 seconds, in order to prevent all monsters from waking up at the exact same time. Unless a monster reacts to any event, upon waking up they will be idle for two seconds before becoming active, in order to look more natural.

Monsters only go to sleep after they have been in the idle state for one minute. A sleeping monster that gets woken up (this can happen by dealing damage to it, or by casting Taunt on it) therefore remains active for at least one minute before it can fall asleep again.

The status effect they receive is referred to as "Asleep" by the server, and is similar to the "sleeping" status, except that the exact behaviour can be adjusted by flags, on a per-monster basis:

  • M_AI_SLEEP_HIDDEN (bit 1): The monster also receives the "Hidden" status for the same duration as the "Asleep" status, when it falls asleep.
  • M_AI_SLEEP_UNHIDE_ON_WAKEUP (bit 2): The monster loses the "Hidden" status when they get waken up by an event.
  • M_AI_SLEEP_WAKE_ON_ASSIST (bit 3): The monster wakes up if one of its own kind gets attacked. Currently requires the "assist" AI to be set, this should be fixed at some point.
  • M_AI_SLEEP_CHECK_ON_SPAWN (bit 4): A monster that spawns during its sleeping hours immediately falls asleep. This is especially important for aggressive monsters, as they would only fall asleep if no player is on their map for at least one minute.