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>.
- Create a common event, I'll name it "Enemy collision". Trigger: None
-
Add conditional branch
checkCollide(this._eventId, '<projectile>')
- In True section, call command +/- Event HP, write value like 10 here, or write "- damage"
- (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
Now, create a new event with notetag
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
-
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.
<dmg: Enemy ATK>- "Enemy ATK" is a skill name in the database<enemyHitbox>- A notetag where if the playercheckCollidefor it will return true.
3 - Create an enemy death
Destroy Eventif your enemy is a clone, spawned from a template mapDestroy Regular Eventif your enemy is original, created regularly just like any other eventsErase Eventis 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.