Skip to content

ObjectiveCompletedEvent

One objective of a quest is done.

Full documentation: ObjectiveCompletedEvent. Wire type: objective_completed.

Default visibility: player

Message codes: session.quest.objective_completed

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": "One objective of a quest is done.\n\nEmitted by `CompleteObjective`.\nCompleting a hidden objective also reveals it, with no\n`ObjectiveRevealedEvent`, so the\nplayers may learn of an objective first from this event.",
  "properties": {
    "code": {
      "default": "session.quest.objective_completed",
      "title": "Code",
      "type": "string",
      "description": "The message code, always `session.quest.objective_completed`."
    },
    "visibility": {
      "$ref": "#/$defs/Visibility",
      "default": "player",
      "description": "Player visibility: the party sees its progress."
    },
    "event_type": {
      "const": "objective_completed",
      "default": "objective_completed",
      "title": "Event Type",
      "type": "string",
      "description": "The event type, `objective_completed`, which identifies this class in serialized form."
    },
    "quest_id": {
      "title": "Quest Id",
      "type": "string",
      "description": "The quest the objective belongs to."
    },
    "quest_name": {
      "default": "",
      "title": "Quest Name",
      "type": "string",
      "description": "The quest's display name. The engine always fills it. It's empty only on an event loaded from\na save written before the field existed."
    },
    "objective_id": {
      "title": "Objective Id",
      "type": "string",
      "description": "Which objective was completed."
    },
    "name": {
      "default": "",
      "title": "Name",
      "type": "string",
      "description": "The objective's display label: the name its author wrote, or its id when the author wrote\nnone."
    },
    "narrative": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Narrative",
      "description": "The progress text the author wrote, or `None`. The journal has the same line."
    }
  },
  "required": [
    "quest_id",
    "objective_id"
  ],
  "title": "ObjectiveCompletedEvent",
  "type": "object"
}