# Quick Setup

***

## STEP 01 – CHANGE THE AI CONTROLLER

The first thing you have to do after importing this product into your project is to open up the character blueprint of the character/s that you want to use as your Advanced Companion AI.

After opening the blueprint, you need to navigate to the Class Defaults. Now you can locate the AI Controller Class in the details panel, click on the dropdown and select "ACA\_Companion\_AIController\_BP". This will allow the Advanced Companion AI Controller to take control of this character when in-game.

***

## STEP 02 – ADDING THE COMPANION COMPONENT

Still inside of the character blueprint, you now have to add the Companion Component. This component identifies the chosen character as your AI companion and contains all the settings for the AI. Adding the component is very important, so don’t miss this step.

To add the component, navigate to the Components Panel. In here you can see a button labeled “Add Component +”. When pressing this button, you will see a huge list of all available objects to add to this character. Search for the “ACA\_Companion\_Component\_BP” and add it to your character.

***

## STEP 03 – ADDING THE PLAYER COMPONENT

You now have successfully setup your companions character blueprint but before you can hit the play button and test out the product you have to add the Player Component to your player character.

Open the blueprint of your player character. In here navigate to the Components Panel and press the “Add Component +” button. Now select the “ACA\_Player\_Component\_BP”. You can now select the component and do some changes to its settings or leave it as is.

The Player Component will take care of detection the companion in your level when the player is looking at it. Also, it will take care of detection what the player is looking at which will later on be very useful for the command system.

***

## STEP 04 – ADDING GAMEPLAY TAGS

This is the last step and it is very important so don’t miss this out! We wanted to make this product available to as much developers as possible. Knowing that many buyers already have ongoing projects in which they want to implement this product, selling it as a complete project is out of question. Because the project is using Gameplay Tags which will most likely not be included in your project by default, so you have to add them yourself.

Adding them is very simple: When in your Unreal Engine editor, open up the project’s settings and search for the Gameplay Tag List setting. In here you have to add the following tags:

* Dynamic Attack Behavior
* Dynamic Command Behavior
* Dynamic Interactable Behavior
* Dynamic POI Behavior

Please make sure that you don’t make any typos when adding the Gameplay Tags. If you are a bit more familiar with the engine you can also use a custom .ini source, already containing the Gameplay Tags. We will provide a download link in the technical description of the product. After adding the tags, please restart your editor.

**.ini code:**

```
[/Script/GameplayTags.GameplayTagsSettings]
ImportTagsFromConfig=True
WarnOnInvalidTags=True
ClearInvalidTags=False
FastReplication=False
InvalidTagCharacters="\"\',"
NumBitsForContainerSize=6
NetIndexFirstBitSegment=16
+GameplayTagList=(Tag="Dynamic Attack Behavior",DevComment="")
+GameplayTagList=(Tag="Dynamic Command Behavior",DevComment="")
+GameplayTagList=(Tag="Dynamic Interactable Behavior",DevComment="")
+GameplayTagList=(Tag="Dynamic POI Behavior",DevComment="")
```

***

## STEP 05 – CLEANING UP THE SETUP

Congratulations! You know should have successfully setup the Advanced Companion AI. In this step we will do some small adjustments and bugfixes to make sure the system is running smoothly and without any problems.

**Controller Settings:**

At first, we do have to make some small changes in the character blueprint for your companion AI, so open it up again. The AI uses the “SetFocus” Node a lot, which will result in the companion to look at the character. However, this will not work if you don’t do the following changes in the characters class defaults:

* In the Details Panel, search for “Use Controller Rotation Yaw” and disable it.
* In the Details Panel again, search for “Use Controller Desired Rotation” and enable it.

This should now make the AI be able to use the “SetFoucs” Node. You can test this out by using the command mode in game. If the AI turns to you when you select it (looking at it will also do the trick), everything worked out.

**Gameplay Tags Fix:**

If the command system, the attack mode, the interactable behavior or the POI behavior is not working as wanted or not working at all this is the fix you might be looking for. Sometimes even after adding the Gameplay Tags and restarting the editor, the functions which use these Gameplay Tags still think they don’t exist. Don’t worry there is an extremely easy fix for that.

The first thing you have to do is open up the Blackboard Functions Blueprint Library. You can find it in the blueprints folder in a sub-folder called Libraries. In there you will find a category called Dynamic Behaviors. Under this category are a few functions that all take care of dynamically changing behavior in the behavior tree using the Gameplay Tags. Each function contains multiple nodes called Set Dynamic Behavior. Each of these nodes has a Inject Tag pin.

When you click the edit button on those pins you will see that there already is a Gameplay Tag selected. All you have to do now is deselect this tag and then select the exact same tag again. Please make sure to always select the exact same Gameplay Tag because messing with them will have a huge impact on the AI behavior later on. Also make sure to find all Set Dynamic Behavior Nodes of the functions included in the Dynamic Behaviors category. (There should be about 8 nodes)

***
