> For the complete documentation index, see [llms.txt](https://picnic-in-the-oblivion.gitbook.io/level-editor/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://picnic-in-the-oblivion.gitbook.io/level-editor/ai-npc-zones-or-normal/enemy-and-eyezone.md).

# Enemy and eyezone

Go to the **AI/** folder and drag **ai\_enemy.tscn** on the scene or just turn on is\_hostile parameter in our friendly NPC.

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2FG9YZ1iY9HbtE9Vimoqmv%2Fimage.png?alt=media&amp;token=569a671d-7bca-4b33-982c-17d3115e4ddb" alt=""><figcaption></figcaption></figure>

Then give it's new ENEMY ID PROFILE, can be found in assets/creatures/enemy.json. It can be **bandit**, **stalker**, **soldier**, **mercenary**. Let's put "bandit".

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2FHg7bjHQMqazbWvRnhbcD%2Fimage.png?alt=media&amp;token=f5acd59c-d4e0-45d1-afc8-3c91774856ad" alt=""><figcaption></figcaption></figure>

Let's set start animation, if we hold mouse on this parameter we'll get a tooltip with anims. Lets put shoot\_sit\_start, this animation I've used when enemies are hiding by the box, or other low obstacles.

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2F3WkygggKYwDL5zhs0gKw%2Fimage.png?alt=media&amp;token=ed75eb97-1fe6-4bf5-83dd-8ca007689f38" alt=""><figcaption></figcaption></figure>

Next hover Attack Animations field and get tooltip about available animations.

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2FiA7lzghSGq1sPc3SytFA%2Fimage.png?alt=media&amp;token=e5c3f44c-e417-4e05-98a5-b3552e8e91b5" alt=""><figcaption></figcaption></figure>

For "stand up - shoot - hide" we can use only one animation - "shoot\_sit\_up", but if we want to different type of attacks based on obstacles, like "step left while sit - shoot - hide" and then "stand up right - shoot - hide" you can add "shoot\_sit\_left" and "shoot\_sit\_up\_right"

But for now we just using "shoot\_sit\_up".

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2F4U8Z77FlCWXtfx8ZfSJN%2Fimage.png?alt=media&amp;token=52a32c44-e975-4368-8b18-a23dab606fd5" alt=""><figcaption></figcaption></figure>

And let's create eyezone ID for our enemy, so when player will be inside eyezone with same ID - enemy with this eyezone ID will attack player.

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2FG3i7ixKyAEnFmDZfygfl%2Fimage.png?alt=media&amp;token=7f8bea7d-6b24-425d-80af-50efe5bea1ca" alt=""><figcaption></figcaption></figure>

Go to the ZONES/ folder and drag **hostile\_eyezone.tscn** on the scene. Place eyezone so player will be inside of it.

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2FnZ09ZZNS5oxplyEuOyjv%2Fimage.png?alt=media&amp;token=0d7b9ff9-f8cc-43cd-9693-9ee5d2ce1a98" alt=""><figcaption><p>Player spawn inside eyezone</p></figcaption></figure>

In inspector give same ID that you've create for enemy NPC. Its "test\_eyezone".

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2F49ImKZ0iJJ0MsY0zaoVg%2Fimage.png?alt=media&amp;token=bc7efe78-4d83-4443-a061-b6b4a5d261eb" alt=""><figcaption></figcaption></figure>

So now when we start playing, hostile npc will change skin to it's profile and start attack player while he inside this eyezone.

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2F6n0HcgUNr3Lp794kagRG%2Fimage.png?alt=media&amp;token=9bbe4866-5ffd-4da5-9ad6-fb75b4ef3a15" alt=""><figcaption><p>Start animation</p></figcaption></figure>

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2FPqZ2zpS9e6sglos33z4D%2Fimage.png?alt=media&amp;token=0bc42346-a8d6-428d-b66a-8125c1cef8b1" alt=""><figcaption><p>Attack with animation "shoot_sit_up"</p></figcaption></figure>

It can be any amount of AI using the same eyezone ID. They will randomly attack the player.

{% hint style="danger" %}
Please, do not duplicate NPC's and ENEMIES, cause there's bug. Always drag and drop prefabs on scene! All settings you can edit in many selected npcs at once!
{% endhint %}

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2FRYkqeLd6cesbpMIiiukl%2Fimage.png?alt=media&amp;token=7247cee1-044a-47a2-b596-3ed091f3807b" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2F4yG0IzHsUqAUkDVfjgFw%2Fimage.png?alt=media&amp;token=b51b46c4-4bfd-4a6e-b156-a8d37a45e03b" alt=""><figcaption><p>Multiple edited NPCs at once - all soldiers</p></figcaption></figure>
