Enemy and eyezone
Last updated
Last updated
Go to the AI/ folder and drag ai_enemy.tscn on the scene or just turn on is_hostile parameter in our friendly NPC.
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".
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.
Next hover Attack Animations field and get tooltip about available animations.
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".
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.
Go to the ZONES/ folder and drag hostile_eyezone.tscn on the scene. Place eyezone so player will be inside of it.
In inspector give same ID that you've create for enemy NPC. Its "test_eyezone".
So now when we start playing, hostile npc will change skin to it's profile and start attack player while he inside this eyezone.
It can be any amount of AI using the same eyezone ID. They will randomly attack the player.
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!