# Event-Aware Convai Characters

## Use of Invoke Speech function&#x20;

Our goal in this example is to have the character welcome the player whenever the player enters a certain area, this can be done by using the `Invoke Speech` node that basically invokes the AI character to talk and a simple collision box.

1. Open your AI character blueprint and select the `Viewport` tab.\
   Note: the character blueprint can be a MetaHuman, ReadyPlayerMe, Reallusion or even a custom one you have created, just ensure that it has the `Convai Chatbot` component.
2. From the `Components` list add a `Box Collision`.&#x20;

<figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FL8s4YMyMBiCA34skGrD4%2FEvent%20awareness%201.jpg?alt=media&#x26;token=82c29ab5-1296-4d58-a1e7-f4b54680de08" alt=""><figcaption><p>Add box collision to your Convai Character</p></figcaption></figure>

3. Switch back to the `Event Graph` tab.
4. Select the `Box Collision` you just added and scroll down in the `Details panel`.  Under `Events`  add the `On Component Begin Overlap`  event to your event graph.&#x20;

<figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2Fkqp5FhMZYqh3UVJeOwfl%2Fevent%20awareness%202.jpg?alt=media&#x26;token=aea00727-d619-435c-bd91-3b403a2618ab" alt=""><figcaption><p>Add On Component Begin Overlap event to EventGraph</p></figcaption></figure>

6. Setup the following blueprint schematic which uses the `Invoke Speech` node from the `Convai Chatbot` component.&#x20;

<figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FuLnza27aVFyyAkrml8Bu%2Fimage.png?alt=media&#x26;token=b49538b7-b794-48cf-bfb1-54ad42b20e4f" alt=""><figcaption><p>Invoke Speech function from Convai Chatbot component</p></figcaption></figure>

7. Enter a `Trigger Message` that expresses what happened (i.e. "Player Approached") and you can add a simple instruction (i.e. Greet the player).
8. Setting the `In Generate Actions` and `In Voice Response` boolean to true will let the Convai Characters perform actions and generate audio responses respectively.
9. Hit `Compile` and `Save` then run the program.&#x20;
10. On approaching a certain vicinity will trigger the event and the Convai Character will greet the character as mentioned in the Trigger Message.&#x20;

<figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2F0eU5aXhHAlhfMaYRncwj%2Fimage.png?alt=media&#x26;token=51aedc6b-b8d2-4f3d-8f46-fde74a16e345" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
The above example is just a simple use case. However, the use of Invoke Speech opens new doors to limitless use cases.&#x20;
{% endhint %}


---

# 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://docs.convai.com/api-docs/plugins-and-integrations/unreal-engine/guides/event-aware-convai-characters.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.
