Skip to content

NpcPartySpawnedEvent

The engine generated an NPC adventuring party and added it to the session.

Full documentation: NpcPartySpawnedEvent. Wire type: npc_party_spawned.

Default visibility: referee

Message codes: encounter.npc_party.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": "The engine generated an NPC adventuring party and added it to the session.\n\nEmitted by the referee's\n`SpawnNpcParty` and by a wandering roll\nthat comes up adventurers, before the encounter opens.\n\nIt has referee visibility and contains the whole roster. What the party sees is the\n`EncounterStartedEvent`, which labels\nthem as adventurers and contains a count. The party learns their classes and levels by\ntalking or by fighting.",
  "properties": {
    "code": {
      "default": "encounter.npc_party.spawned",
      "title": "Code",
      "type": "string",
      "description": "The message code, always `encounter.npc_party.spawned`."
    },
    "visibility": {
      "$ref": "#/$defs/Visibility",
      "default": "referee",
      "description": "Referee visibility: the players see only the label and the count on the encounter event."
    },
    "event_type": {
      "const": "npc_party_spawned",
      "default": "npc_party_spawned",
      "title": "Event Type",
      "type": "string",
      "description": "The event type, `npc_party_spawned`, which identifies this class in serialized form."
    },
    "party_kind": {
      "title": "Party Kind",
      "type": "string",
      "description": "Which table the party was rolled from: `\"basic\"` or `\"expert\"`."
    },
    "npc_ids": {
      "items": {
        "type": "string"
      },
      "title": "Npc Ids",
      "type": "array",
      "description": "The session ids of its members, in roster order. The other three tuples line up with this\none."
    },
    "class_ids": {
      "items": {
        "type": "string"
      },
      "title": "Class Ids",
      "type": "array",
      "description": "Each member's class, as a class catalog id."
    },
    "levels": {
      "items": {
        "type": "integer"
      },
      "title": "Levels",
      "type": "array",
      "description": "Each member's level."
    },
    "alignment": {
      "title": "Alignment",
      "type": "string",
      "description": "The party's alignment, as a lowercase `Alignment` value."
    }
  },
  "required": [
    "party_kind",
    "npc_ids",
    "class_ids",
    "levels",
    "alignment"
  ],
  "title": "NpcPartySpawnedEvent",
  "type": "object"
}