# Setting up AI Dialog

Friendly AI characters will not attack player and can be used for plethora of things regarding player interaction toward them. One of those interactions is Dialog that can be started between player and AI. To add dialog to your AI select "Setup Dialog" inside Top Down AI Component.

![](https://2722297649-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0IDuQr8K7sz65uYn3vSb%2Fuploads%2Faavmz1a15MoZr6K0Uq6a%2Fimage.png?alt=media\&token=d95e2743-95fb-403e-b93d-dd8a76519a95)

Now a new game object will be spawned as child of your AI containing new dialog component. Then you can enter your opening line (line of dialog that will show up when conversation is started) and you can add player controlled dialog responses from which numerous actions can be called.

![](https://2722297649-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0IDuQr8K7sz65uYn3vSb%2Fuploads%2F6fC3uW2Ev5D56zw3owNt%2Fimage.png?alt=media\&token=c5f45bd1-840b-431f-abd8-ec7f4eab9a20)

There are few types of responses. First is none, where only a new dialog text will show when clicked on. Close Dialog means that after choosing that response AI will show his dialog text and then conversation will be closed. Immediate Close will close conversation window immediately when response is selected. Branch Dialog will create yet another Dialog component and game object as child of first Dialog component and that response will lead to that Dialog. Combat Dialog response will on shown AIs dialog text make AI hostile and after conversation closes AI will become hostile.

You can also set various Unity Event calls like custom functions and other (giving player item, enabling/disabling objects, starting/updating/finishing quests etc) that will be called when response is selected.

If you check 'Remove After Activating' that response will be removed from conversation when clicked on and AIs dialog is shown.

![](https://2722297649-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0IDuQr8K7sz65uYn3vSb%2Fuploads%2F5dTSfWvgXLigvFBhRFDA%2Fimage.png?alt=media\&token=3fd0df56-3c86-4afe-bbbe-fbd7cb99d1c9)
