Enemy Events


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

Referencing Enemies

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.

You may also like...

37 Responses

  1. fynmorph says:

    The script doesn’t update the index of the enemy in the battle event conditions, or in the control variables (if you wanna give to a variable the value of the enemy’s HP, you can’t do that).

    So I edited the code, add that part and you should be able to do it:

    def add_enemy_event_page(index, page)

    #fyn edit
    c = page.condition
    c.enemy_index = index
    #end fyn edit

    page.list.each do |cmd|
    params = cmd.parameters
    case cmd.code

    #fyn edit
    when 122 # Control Variables
    params[5] = index if params[3] == 3 and params[4] == 4
    #end fyn edit

  2. fynmorph says:

    Enemy event pages allow you to specify indices to refer to the enemy

    # itself. Therefore, all commands that involve indexes will need to be
    # updated to the enemy's current index in the troop.

    how does it work? Do I have to do anything for that? Does it work with the conditions ? (the Enemy # has …% HP or less)

  3. Willy says:

    how does it work with events that target the entire troops?

    Does it work with several of the same enemy in the troop? I have troubles with that last case.

Leave a Reply

Your email address will not be published. Required fields are marked *