Skip to content

MonstersSpawnedEvent

Monsters were put into the session by the referee.

Full documentation: MonstersSpawnedEvent. Wire type: monsters_spawned.

Default visibility: referee

Message codes: session.monsters.spawned

JSON Schema

{
  "$defs": {
    "Visibility": {
      "description": "Who may see an event: the players, or only the referee.\n\nEvery event has one of these values, because in B/X the referee makes some rolls behind a screen. Filter\na log on it before you show anything to a player, or call\n`GameSession.view`, which builds the players' view and the referee's\nview for you. A narrator that plays the referee reads every event.\n\nA serialized event contains the lowercase value. The values stay fixed within a `schema_version`, the version\nstamp of the saved format.\n\nExamples:\n    ```python\n    from osrlib.core.events import DamageDealtEvent, HitPointsReportedEvent, Visibility\n\n    log = [\n        DamageDealtEvent(target_id=\"monster-0001\", amount=5),\n        HitPointsReportedEvent(target_id=\"monster-0001\", current_hp=2, max_hp=7),\n    ]\n    shown = [event.code for event in log if event.visibility is Visibility.PLAYER]\n    assert shown == [\"combat.damage.dealt\"]  # the goblin's remaining hit points stay hidden\n    ```",
      "enum": [
        "player",
        "referee"
      ],
      "title": "Visibility",
      "type": "string"
    }
  },
  "description": "Monsters were put into the session by the referee.\n\nEmitted by `SpawnMonsters`, first in its\nresult. When no encounter is open, the events of the encounter's opening follow. When\none is open, the monsters join it as a new group.\n\nIt has referee visibility, and it contains ids rather than a description. The party\nlearns which monsters arrived from\n`EncounterStartedEvent` when the\nencounter opens, or from\n`EncounterGroupJoinedEvent` when the\nmonsters join an open one.",
  "properties": {
    "code": {
      "default": "session.monsters.spawned",
      "title": "Code",
      "type": "string",
      "description": "The message code, always `session.monsters.spawned`."
    },
    "visibility": {
      "$ref": "#/$defs/Visibility",
      "default": "referee",
      "description": "Referee visibility: this is bookkeeping, not a moment in the fiction."
    },
    "event_type": {
      "const": "monsters_spawned",
      "default": "monsters_spawned",
      "title": "Event Type",
      "type": "string",
      "description": "The event type, `monsters_spawned`, which identifies this class in serialized form."
    },
    "template_id": {
      "title": "Template Id",
      "type": "string",
      "description": "What was spawned, as a monster catalog id."
    },
    "monster_ids": {
      "items": {
        "type": "string"
      },
      "title": "Monster Ids",
      "type": "array",
      "description": "The session ids of the new instances, in spawn order. Every later event about\nthose creatures refers to them by these ids."
    }
  },
  "required": [
    "template_id",
    "monster_ids"
  ],
  "title": "MonstersSpawnedEvent",
  "type": "object"
}