Quest Event Reporter

QuestEventReporter.cs

Overview

QuestEventReporter is the central reporting hub for all gameplay events in the Quest Forge system. It is the single point of contact between your game systems (combat, inventory, dialogue, movement) and the quest tracking system.

When something significant happens in the game world — an enemy dies, an item is picked up, the player reaches a location — your game calls a method on QuestEventReporter. It wraps that information into a typed event data object and publishes it to the QuestEventBus, which distributes it to all active quest objectives listening for that event type.

QuestEventReporter is a singleton MonoBehaviour that persists across scene loads (DontDestroyOnLoad). It lives inside the QuestForgeManagers prefab and should never be manually instantiated.

Architecture

The QuestEventBus is a pure C# singleton (not a MonoBehaviour) that manages subscriptions internally. You do not need to interact with it directly in normal usage — QuestEventReporter is the intended public-facing API. However, advanced users can subscribe to the bus directly for custom systems - see the Quest Event Buspage for more details.

Inspector Properties

Property
Description

Debug Mode

Logs all published events to the console via QuestLogger. Useful during development to verify events are firing correctly.

Player Transform

Optional TransformReference pointing to the player. Used to populate worldPosition and instigator on events that don't have a natural source position (e.g. ReportItemCollected).

Public API

ReportEnemyKilled

Reports that an enemy has been killed. Publishes an EnemyKilledEventData event.

Parameter
Description

enemyId

The specific enemy identifier (e.g. "goblin_warrior_01"). Used for precise per-enemy objectives.

enemyTag

The category or group tag (e.g. "Goblin", "Undead"). Used for type-based kill objectives.

enemyLevel

Optional enemy level. Defaults to 1.

enemyObject

Optional reference to the enemy GameObject. Used to set worldPosition on the event.

Typically called by: QuestEnemyReporter


ReportItemCollected

Reports that one or more items have been collected. Publishes an ItemCollectedEventData event.

Parameter
Description

itemId

The item identifier. Must match CollectObjective.itemId exactly.

quantity

Number of items collected in this single report. Defaults to 1.

Typically called by: QuestCollectable


ReportNPCTalkedTo

Reports that the player has spoken to an NPC. Publishes an NPCTalkedToEventData event.

Parameter
Description

npcId

The NPC identifier. Must match the target NPC ID in a TalkToObjective.

dialogueId

Optional. The specific dialogue ID that was started or completed.

speaker

Optional. Reference to the DialogueSpeaker component involved.

Typically called by: The dialogue system when a conversation begins or ends.


ReportObjectInteracted

Reports that the player has interacted with an object. Publishes an ObjectInteractedEventData event.

Parameter
Description

interactableId

String identifier for the interactable. Must match InteractObjective.interactableId.

interactIndex

The MInteract.Index value from the Malbers interact system.

instanceId

A unique instance ID for this specific object. Used for objectives requiring interaction with multiple distinct objects.

interactableObject

Optional reference to the interactable GameObject. Used to set worldPosition.

interactorId

The Malbers MInteractor.ID of the character performing the interaction.

Typically called by: QuestInteractable


ReportLocationReached

Reports that the player has reached a location. Publishes a LocationReachedEventData event.

Parameter
Description

locationId

The location identifier. Must match the target location ID in a GoToLocationObjective.

position

World position of the location. When using the no-position overload, defaults to the player's current position.

Typically called by: Zone trigger colliders, PointOfInterest discovery logic, or QuestTrigger with OnTriggerEnter.


ReportCustomEvent

Reports a named custom event for extension, modding, or one-off quest logic. Publishes a CustomEventData event.

Parameter
Description

eventName

A string name identifying the custom event.

stringValue

Optional string payload.

intValue

Optional integer payload.

Use this when no built-in event type fits your objective. Your custom objective class subscribes to QuestEventType.Custom on the QuestEventBus and filters by customEventName.


PrintEventStatistics

Prints a log of how many times each event type has been published since session start, plus a total count. Useful for debugging event flow during development.

Event Types

All events published through QuestEventReporter are categorised by QuestEventType. The full list of available types is below. Note that not all types have a dedicated Report method on QuestEventReporter — some are reserved for internal system use or future extension.

Combat

Type
Raised By
Description

EnemyKilled

ReportEnemyKilled

An enemy has been killed.

EnemyDamaged

(reserved)

An enemy has taken damage. No built-in reporter method — subscribe and publish manually for custom damage objectives. This may be added in, in the future.

BossDefeated

(reserved)

A boss-tier enemy has been defeated. Can be reported via ReportEnemyKilled with a matching ID, or published manually. This may be added in, in the future.

Collection

Type
Raised By
Description

ItemCollected

ReportItemCollected

An item has been collected.

ItemCrafted

(reserved)

An item has been crafted. Publish manually from your crafting system. This may be added in, in the future.

ItemEquipped

(reserved)

An item has been equipped. Publish manually from your equipment system. This may be added in, in the future.

ItemUsed

(reserved)

An item has been used or consumed. Publish manually from your inventory system. This may be added in, in the future.

Interaction

Type
Raised By
Description

NPCTalkedTo

ReportNPCTalkedTo

The player has spoken to an NPC.

DialogueCompleted

(reserved)

A full dialogue sequence has completed. Can be published manually from dialogue end nodes.

ObjectInteracted

ReportObjectInteracted

The player has interacted with a world object.

Location

Type
Raised By
Description

LocationReached

ReportLocationReached

The player has reached or discovered a location.

AreaEntered

(reserved)

The player has entered a defined area. Publish manually from area trigger volumes.

AreaExited

(reserved)

The player has exited a defined area.

Quest Lifecycle

Type
Raised By
Description

QuestStarted

Internal (QuestManager)

A quest has been started.

QuestCompleted

Internal (QuestManager)

A quest has been completed.

QuestFailed

Internal (QuestManager)

A quest has been failed.

QuestProgressUpdated

Internal (QuestManager)

A quest's objective progress has changed.

World Map

Type
Raised By
Description

FastTravelCompleted

Internal (World Map)

The player has completed a fast travel via the world map.

Custom

Type
Raised By
Description

Custom

ReportCustomEvent

A developer-defined custom event. Filter by CustomEventData.customEventName in your subscriber.

Event Data Classes

Each event type carries a typed data payload that extends the base QuestEventData class.

Base — QuestEventData

All event data classes inherit these fields:

Field
Type
Description

eventType

QuestEventType

The type of this event.

timestamp

float

Time.time at the moment the event was created.

worldPosition

Vector3

World position associated with the event.

instigator

GameObject

The GameObject that caused the event (typically the player).


EnemyKilledEventData

Field
Type
Description

enemyId

string

Specific enemy identifier.

enemyTag

string

Enemy category/group tag.

enemyLevel

int

Enemy level at time of death.

enemyObject

GameObject

Reference to the enemy's GameObject.


ItemCollectedEventData

Field
Type
Description

itemId

string

Item identifier.

quantity

int

Number of items collected.

itemCategory

string

Optional category (e.g. "weapon", "potion"). Not populated by QuestCollectable — set manually if needed.


NPCTalkedToEventData

Field
Type
Description

npcId

string

NPC identifier.

dialogueId

string

Specific dialogue that was triggered (optional).

speaker

DialogueSpeaker

Reference to the dialogue speaker component (optional).


ObjectInteractedEventData

Field
Type
Description

interactableId

string

Type identifier for the interactable.

interactIndex

int

Malbers MInteract.Index value.

instanceId

string

Unique ID for this specific object instance.

interactableObject

GameObject

The interactable's GameObject.

interactorId

int

Malbers MInteractor.ID of the activating character.


LocationReachedEventData

Field
Type
Description

locationId

string

Location identifier.

locationName

string

Display name of the location.

locationData

PointOfInterest

Reference to the PointOfInterest asset (if populated by POI discovery).

distanceFromCenter

float

Distance from the location's centre when the event fired.

wasFirstDiscovery

bool

true if this is the first time the player has discovered this location.


FastTravelEventData

Field
Type
Description

destinationLocationId

string

Location ID of the fast travel destination.

destinationName

string

Display name of the destination.

originPosition

Vector3

World position the player fast-travelled from.

destinationPosition

Vector3

World position the player arrived at.


QuestProgressEventData

Field
Type
Description

questId

string

The ID of the quest that changed state or updated progress.


CustomEventData

Field
Type
Description

customEventName

string

Developer-defined name for the event.

stringValue

string

Optional string payload.

intValue

int

Optional integer payload.

floatValue

float

Optional float payload.

Other Notes

  • QuestEventReporter uses DontDestroyOnLoad — it persists across scene changes. There should only ever be one instance in your project (provided by QuestForgeManagers).

  • Events are published synchronously. All subscribers are notified immediately when a Report method is called, within the same frame.

  • The QuestEventBus takes a defensive copy of the subscriber list before notifying, meaning it is safe to subscribe or unsubscribe from within an event callback.

  • Any exception thrown by an individual subscriber is caught and logged without interrupting delivery to other subscribers.

  • To add support for a new event type, add it to the QuestEventType enum, create a new QuestEventData subclass, and add a corresponding Report method to QuestEventReporter. The QuestEventBus initialises listener lists for all enum values automatically.

Last updated