This script allows you to create “enemy events”. Whenever an enemy appears in battle, the enemy’s event pages are added to the current troop’s event pages.
The purpose of this script is to allow you to create an enemy’s events once and then re-use it in multiple troops without having to duplicate event pages yourself.
Furthermore, not only can you re-use your event pages, but the pages are only added to the current battle if the enemy actually “appears”. This means that if the enemy was initially hidden (through appear halfway), the pages are not added until the enemy appears.
Script: download here
In the script editor, place this script below Materials and above Main
Creating Enemy Events
Enemy events are just regular troop events, except they will be added to the current battle if the enemy is present.
All of the event commands can be used as usual.
Assigning Enemy Events
Enemy events are created as troop events. To indicate which troop should be
assigned as an enemy’s event, note-tag an enemy with
<enemy event: ID>
Where ID is the ID of the troop whose event pages will be assigned to the
A special feature to this script is that you can actually reference the enemy
in your enemy events. Simply add the enemy to the troop, and then create your
event commands. When an enemy appears in battle, the indexes of all of its
event pages commands will be updated to point to the enemy’s current index.
For example, suppose you want to “change enemy state” for a slime at the
beginning of the battle. In your enemy event, you would add your slime to the
screen, and then create your command and point to the slime.
When you start a battle where the slime appears, the change state command will
correctly update itself to point to the slime.
Note that you can only reference the enemy that the pages are being assigned
to, so even if you add two slimes to the screen, that would not change how
the script behaves.
Merging Enemy Events
When a battle begins, all enemy event pages will be added to the current battle. For example, if your slime has two event pages, then those two event pages will be added to the current troop. If the battle has two slimes, then each slime will contribute its own event pages to the battle, resulting in four additional pages.