There are many ways to create enemies using this plugin, but I'll show you my way, which is optimized for workload.
Goal: All enemy needs collision checking and HP bar
The idea: All enemy events will run the same common event in parallel to check collisions
We have a feature for that, let's open the Action Combat plugin parameter, find Events Notetags. Create a notetag called <enemy> and assign the common event ids that any event with this notetag will run in parallel.
Now, let's create our first enemy, putting <enemy> to its notetag box. We'll also add notetag <hp: x - y> to assign a HP amount to this enemy. 70 - 130 means a random amount between 70 - 130. You can also use a fixed number so this enemy always has like 70 HP, your call. If you want to use a database value, write <hp: enemy name from database>.
Now when you run the game, you should see your enemy has a HP bar on it automatically.
Remember the common event id you assigned to events with notetag <enemy> early on? Let's open that common event. To check collision, we need to create a conditional branch checkCollide.
Let's say you want enemy events to take 10 damages when they collide with any events with notetag <projectile>. We'll use checkCollide(this._eventId, '<projectile>'). If the collision is true, it'll decrease this event HP by 10 and also pop up the damage number 10.
Note: You don't need to enable a Switch for this common event, as this common event will automatically run when enemy event is on the map.
['<projectile>'] or just '<projectile>' both work. [ and ] should be used when you want to put more notetag |
That's basically it. What if you want each <projectile> event will deal different damage? Like you have 2 <projectile> events, one is fireball and one is snowflake. You want fireball to deal 10dmg and snowflake to deal 20dmg. Simply add notetag <dmg: x - y> to your fireball or snowflake event.
Now when any of your enemy event collide with an event with notetag <projectile>, they'll take different values of damage.
DEATH
To manage the death stage of enemies, we'll need to create another common event. Here's how it works:- Use a Conditional Branch: Check if the enemy's HP is less than or equal to zero with HP(this._eventId) <= 0.
- If True: Activate a Control Self Switch to the letter that manages the death stage. I've been inconsistent in the past, sometimes using 'C', other times 'D', which is disorganized.
- To solve this, I now use a plugin command Control Self Switch that comes along with Action Combat plugin and switch to any page marked with the comment <death>. That way I don't need to care about the letter, the plugin will handle it for me.