😈 Enemy: Create a basic enemy

There are many ways to create enemies using this plugin, but to be creative, you need to learn at least the basic way to create enemies first. In this long tutorial, you'll learn:

  • How to create an enemy
  • How to create a collision system for enemy (if enemy collides with x then y)
  • How to make an enemy AI behavior (detect, chase, melee attack)
  • How to make an enemy die

If you're lazy to read, watch this video instead


1 - Create an enemy


Let's create an event with notetag <hp: Slime>, assuming you have an enemy named "Slime" in the database. With just that step, you've assigned stats like ATK, DEF, HP, EXP, trailts, etc. from Slime enemy to this event. You should also see a HP bar on your event.




2 - Create a collision system for the enemy


Let's say you want enemy events to take X damage when they collide with any events with notetag <projectile>.


  1. Create a common event, I'll name it "Enemy collision". Trigger: None
  2. Add conditional branch
    checkCollide(this._eventId, '<projectile>')
  3. In True section, call command +/- Event HP, write value like 10 here, or write "- damage"
  4. (optional) Call command Pop Text Value and write 10 or "damage"



Back to your Slime event, add comment <passive: Enemy Collision>. This is the same as using "Call Common Event" in a Parallel event. The pros of the <passive> feature are that it'll call the common event regardless of your event's trigger, and it'll be called simultaneously with your event's other commands instead of following the order from top to bottom.



ALTERNATIVE TO PASSIVE


In Hendrix Action Engine plugin, go to Events Notetags. Assign notetag <enemy> to your common event Enemy Collision. Now, any events with notetag <enemy> will automatically call common event Enemy Collision in parallel.


Now, create a new event with notetag <projectile> and <dmg: 15>. If you move this Arrow to Slime, you'll see number 15 pop up and Slime's HP decreases by 15.


Why does it show 15 when you wrote "-damage"? Simple, "damage" will take value from the event that just collided with your Slime thanks to the smart checkCollide conditional branch. The event that just collided your Slime is the arrow.



3 - Create an enemy AI behavior


Let's make the Slime to detect for player, and if the player is nearby, it switches to a page where it'll chase the player, then attack.
 
In Slime's first page, make the trigger Parallel, then add conditional branches:
  • checkRange(this._eventId, 7, 'player')
    - Return true if player is within 7 tiles of this event (slime)
  • (optional)
    gotHit(this._eventId)
    - Return true if the slime just got hit by something and decreased HP


In page Self Switch B, this is where the Slime has detected the player, and it'll chase the player till it is very near. 

When Slime is nearby player by 1 tile, call command Create Dynamic Event with these notetags and destroy itself after 3 frames
  • <dmg: Enemy ATK> - "Enemy ATK" is a skill name in the database
  • <enemyHitbox>  - A notetag where if the player checkCollide for it will return true.

If Slime isn't nearby, keep Move Toward Player.


You need to create a skill in database called Enemy ATK and assign a formula here. For me, I'll write a.atk - b.def. Any event spawned/created by an enemy event that collides with the player, it'll use enemy ATK (Slime) - Player DEF.


3 - Create an enemy death

Create a new Self Switch page, add comment <death> or <whatever> to this page, then setup what you want to happen when the enemy is dead in here. The last command should always be a command to destroy the enemy event. Suggestions:
  • Destroy Event if your enemy is a clone, spawned from a template map
  • Destroy Regular Event if your enemy is original, created regularly just like any other events
  • Erase Event is a default RPG Maker command, but the con is that it doesn't destroy your event, your event is still on the map, just invisible



Death behavior is done, but you need to tell the engine when this will happen. Create a new common event or simply add the following changes to your Enemy Collision common event.

Add a conditional branch HP(this._eventId) <= 0, then call command Control Self Switch from Hendrix Action Engine. In the field "Comment to search for", write <death> or <whatever>, State True.

If you choose to create a brand new common event just for checking for death condition, make sure your Slime calls this common event by adding its name to <passive>.
<passive: Enemy Collision, Enemy Death Check>

ALTERNATIVE DEATH METHOD


Instead of creating a new Self Switch page in your Slime for death behavior, put all those behaviors in the death check condition instead. The pro of this method is it's quick, the con is you won't be able to make each event have unique death behavior anymore (unless you create a new common event for certain unique enemies, but if you're gonna do that, then rather don't do this method).

5 RPG Maker Action Combat Manual: 😈 Enemy: Create a basic enemy There are many ways to create enemies using this plugin, but to be creative, you need to learn at least the basic way to create enemies ...
<