3: Create your Enemy

INTRODUCTION:

Having a good enemy is important in RPGs. This is the main challenge we'll set up in this case. Plus, any RPG has loot, when you will kill the Enemy, it will drop the thing your NPC is asking for!

A) ENEMY CREATION

Place an ASSET that will be used as your Enemy.

Tip: Don't forget to reset your Library search Filters if you used them before for the NPC research.

B) CHANGE ITS BEHAVIOUR

We want our Enemy to chase and attack us when detecting us in its range. So we need to put on him a Behaviour that does so, which is the Melee Enemy Behaviour.

  • Select the Enemy you just placed to open its Properties in the Properties panel.

  • Change its Behaviour to "Melee Enemy".

Tip: Don't hesitate to use ASSETs with other default Behaviours to create your own and unique game environment.

C) SET UP THE MELEE ENEMY BEHAVIOUR

As the Melee Enemy is working great and as we want by default (chasing the Avatar and attacking it), we won't touch it for now.

Advanced Tip: You can tweak your Melee Enemy if you want so by looking at the Melee Enemy tutorial.

D) SET UP THE LOOT

We want the Enemy to drop something when being killed by the Player.

To do so, we will do it very simple:

  • Add a Drop Component onto your Enemy

  • Click on Edit Logic to all the parameters displayed

  • Set the Drop Amount as your Quest needs it (recommended: 1)

  • Set Type of Drop on "Behaviour"

  • In Asset to Spawn select the ASSET that will be used as the kill reward and which is the thing the NPC is asking for

  • Add a Tag so it is identifiable

  • Set the Physics on "No Collision"

  • Add it a Collect Sound if you want to

Tip: We are not forced to put a Collect Message in this case, as the Quest (that we will set up later) will automatically detect the OBJECTs being collected thanks to the combination of Collectible Component with the Tag we've defined.

E) KILL THE WOLF!

Press play and kill the Enemy, you notice now it is droping something when you kill it! Plus, as it is a Collectible, you can walk on it to collect it. A little "message" is displayed on the bottom right of your screen with the ASSET name and the amount collected.

It starts to take shape!

Tip: If you want to customize the kill reward, then use a PRESET instead of the "Behaviour" Type of Drop, it allows you to do deeper things, such as putting another name, an indicator which displays a little arrow on the object, etc.

E) YOUR ENEMY IS PREPARED!

Duplicate your Enemy as much as you need. If your NPC asks for 5 Bones, then put 5 Enemies.

Tip: You can notice however that it is possible to kill all the Enemies before the Quest has been started. An optional step is available at the very end of ◑ Your first RPG Experience Tutorial.

👏 Well done! You've finished the 3rd step of ◑ Your first RPG Experience Tutorial ! You can go now to the 4th step of the Tutorial: 4: Create your Quest !

Last updated