# Quest Events

Quest events are one of the most amazing features of this system and it allows you to add fully custom logic happening around the world after quests are being completed. You can either trigger the EVR on Namalsk, or change weather, spawn creatures, items, explosions, whatever you want.&#x20;

There are two types of Quest Event Handlers

* QuestEventHandlerServer
  * This is responsible for triggering the logic upon completion on the server side. Spawning creatures, objects and changing the game environment should be done here so everything is synchronized to the other players. As you might remember, in the [Quest](/mods/crdtn-quests/server-side/installation/quests-json.md)/[Goal](/mods/crdtn-quests/server-side/installation/quests-json/goal.md) definition, the parameter  **"TriggerSendToClient": false**
  * This paramater does the passing of an information, that the event should also happen on the client.&#x20;
  * **IMPORTANT -** it doesn't mean, that this logic is the same on client
* QuestEventHandlerClient
  * You can specify additional logic like post processing changes, specifically sounds and other things you can do on the client only.&#x20;
  * Sound for example

    <figure><img src="/files/KFUzcpsyJ3y2j7aIzGLM" alt=""><figcaption><p>You can invoke sounds by calling <strong>CRDTN_PluginBase.CRDTN_PlaySound("SOUNDSET", GetGame().GetPlayer());</strong></p></figcaption></figure>

#### EXAMPLE OF THE TELEPORTATION TRIGGER

This trigger teleports a player to a certain location when completing the quest. You can see the event key `test_quest_complete` which has to be in the quest definition at parameter&#x20;

````csharp
```c
modded class QuestEventHandlerServer
{
    override void OnQuestEvent(PlayerBase questCompleteActor, Quest questDefinition, string eventKey, ref Param params = NULL, ref PlayerIdentity identity = NULL, ref Object target = NULL, bool sendToClient = true)
    {
        if (questCompleteActor == NULL || eventKey == "")
        {
            return;
        }

        // Event triggered by the explore trigger in the quest
        // THIS EVENT KEY NEEDS TO BE IN THE QUEST DEFINITION
        if (eventKey == "test_quest_complete")
        {
            questCompleteActor.SetPosition("9817.386719 250.825714 11459.413086");
        }

        super.OnQuestEvent(questCompleteActor, questDefinition, eventKey, params, identity, target, sendToClient);
    };
};
```
````

Make sure you check the examples in the package. If you're still not sure what is this about. Do not hesitate to ask on the discord.&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dayz.foxapo.com/mods/crdtn-quests/server-side/installation/quest-events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
