Essentials Docs Wiki
Advertisement
Essentials Docs Wiki
For making an event do different things depending on the time or date, see Time-sensitive events.
For doing things with events via scripts rather than event commands, see Controlling events with scripts.

This page describes events, as well as Game Switches and Variables. As these things are fundamental parts of RPG Maker XP, this article won't fully explain them, and will only mention the aspects that are specific to Pokémon Essentials.

Event names

Every event has a name. There are certain pieces of text that can be put into the event's name, which will cause those events to have particular behaviours. Below is a list of those texts and behaviours.

Unless mentioned otherwise, all text is case-insensitive, and the texts can be just part of the event's name (e.g. an event can have the name "Dave Trainer(3) Size(2,2) Reflection").

Text Effect
Size(2,3) An event with this text in its name is treated as occupying multiple tiles at once (in this case, a rectangle 2 tiles wide and and 3 tiles tall). The event's rectangle is positioned such that its bottom left corner is where the event has been placed in the map.

A "large" event behaves as you would expect: no part of it can move onto a non-passable tile or another event (unless its "Through" setting is set), the player and other events cannot move into any part of the large event, and the player can interact with any part of it. If its event name contains "Trainer(3)" or "Counter(3)", it can detect whether the player moves into any of the tiles in front of any part of it.

If the event is given a graphic which is a tile from the tileset, its graphic will be a set of tiles equal to its size, with the chosen tile being the bottom left one of that set. For example, you can make an event depicting a rock of size (2,2) by using this text to make it that size, giving it a graphic of the bottom left tile of that rock from the tileset, and placing the event where the bottom left corner of the rock sits in the map. The the whole event will use the passability/terrain tag/other tile properties of just the selected tile; if the other tiles used by the event in its graphic have different tile properties, they will be ignored.

Item:SOMETHING The event should be an item ball. The SOMETHING is the ID of the item contained in that item ball. The Compiler will rewrite events named like this and turn them into proper item ball events with all appropriate commands; the name of the event will also be changed to "Item" (which has no special effect by itself).

The "Item" part is case-insensitive. This text must be the whole of the event's name.

HiddenItem:SOMETHING The event should be a hidden item ball. The SOMETHING is the ID of the item contained in that hidden item ball. The Compiler will rewrite events named like this and turn them into proper hidden item ball events with all appropriate commands; the name of the event will also be changed to "HiddenItem".

The "HiddenItem" part is case-insensitive. This text must be the whole of the event's name.

HiddenItem An event with this text in its name can be detected by the Itemfinder. Also, the event cannot be interacted with while standing on it. Note the lack of a space between the two words.
Trainer An event with this text in its name will be reset by the Debug mode function "Reset Map's Trainers" (i.e. the event's Self Switches A and B will be turned off). Also, if using trainer comments to create a trainer event, and the event's name doesn't already contain this text, the event's name will be changed to "Trainer(3)". This text has no other effect.
Trainer(3) An event with this text in its name has a "line of sight", which is a set of tiles in front of it that it can "see". If the player walks into this line of sight, the event will be triggered as though it was interacted with. The event must be able to walk in a straight line up to the player (onto the tile next to the player that is between them) in order to be triggered; if there is an impassible tile/event between them, it will not be triggered. An event using this functionality must also have the "Event Touch" trigger.

The number in the brackets is how far in front of itself the event can see (in tiles). It can be any number greater than 0.

This text is named because it is usually NPC trainers who behave like this. However, this text can be used for non-trainer events as well.

Counter(3) An event with this text in its name has a "line of sight", which is a set of tiles in front of it that it can "see". If the player walks into this line of sight, the event will be triggered as though it was interacted with. The event must be looking in the direction of the player in order to be triggered; unlike the "Trainer(3)" text, this text does not require the event to be able to walk up to the player in order to trigger. An event using this functionality must also have the "Event Touch" trigger.

The number in the brackets is how far in front of itself the event can see (in tiles). It can be any number greater than 0.

This text is named because it is usually used for events standing behind desks or counters that need to detect when the player tries to walk past (e.g. a guard in a gatehouse at the end of a Cycling Road, who will prevent the player from proceeding if they don't have a Bicycle).

BerryPlant This event can have a berry planted in it. Specifically, this text ensures that the event shows an appropriate berry tree graphic and a patch of watered (or dried out) soil beneath it. The script command pbBerryPlant, run by interacting with the event, is responsible for the actual planting and subsequent interactions with the plant (i.e. to water it and to pick the berries once fully grown).
Light The event will display a graphic from the Graphics/Pictures folder above it. This graphic is "LE.png" by default, but you can name the event "Light(otherlight)", where the text in brackets is the name of the graphic to use. The graphic is centered on the middle of the tile the event is in (assuming the graphic is 64x64 pixels in size).
OutdoorLight The event will display a graphic from the Graphics/Pictures folder above it. This graphic is "LE.png" by default, but you can name the event "OutdoorLight(otherlight)", where the text in brackets is the name of the graphic to use. The graphic is centered on the middle of the tile the event is in (assuming the graphic is 64x64 pixels in size).

The opacity of the graphic depends on the time of day. It is fully transparent during the day, is semi-transparent in the morning and evening, and is fully visible at night.

Reflection This event will have a reflection (usually seen in still water). Having a reflection is opt-in, and by default only the player has a reflection. If the event is on/just north of still water, or can move to that position, it should use this text to ensure it shows a reflection in the water.

This text can have a number in brackets after it, e.g. "Reflection(2)". If so, the reflection will be shifted south by a distance of half this number of tiles, and the shadow will be colored a solid blue rather than be semi-transparent. This effect is for events that are standing on a bridge over still water; the same effect is applied to the player's shadow if the player is on a bridge. The number is how many layers of cliffs the bridge is above the water.

CutTree This event can be destroyed by using Cut on it. If standing in front of this event, Cut will be shown as an option in the Ready menu, and Cut can be used from the party screen. It also ensures that the correct sound effect is played when the event is destroyed (because Rock Smash uses the same code but plays a different sound effect).

This text used to be just "Tree" and this had to be the whole of the event's name. As it can now be just part of the event's name, this text was renamed to ensure it wouldn't appear in an event's name by accident. The Compiler will check for events named just "Tree" and will rename them to "CutTree".

SmashRock This event can be destroyed by using Rock Smash on it. If standing in front of this event, Rock Smash will be shown as an option in the Ready menu, and Rock Smash can be used from the party screen. It also ensures that the correct sound effect is played when the event is destroyed (because Cut uses the same code but plays a different sound effect).

This text used to be just "Rock" and this had to be the whole of the event's name. As it can now be just part of the event's name, this text was renamed to ensure it wouldn't appear in an event's name by accident. The Compiler will check for events named just "Rock" and will rename them to "SmashRock".

StrengthBoulder This event can be moved by using Strength and walking into it. Interacting with an event that has this text in its name will prompt the player to use Strength if they haven't already used it on this map.

This text used to be just "Boulder" and this had to be the whole of the event's name. As it can now be just part of the event's name, this text was renamed to ensure it wouldn't appear in an event's name by accident. The Compiler will check for events named just "Boulder" and will rename them to "StrengthBoulder".

HeadbuttTree This event can be knocked by using Headbutt on it, potentially triggering a wild encounter. If standing in front of this event, Headbutt will be shown as an option in the Ready menu, and Headbutt can be used from the party screen.
Update An event with this text in its name will always update itself, even if it is off-screen and ordinarily wouldn't be updated.
RegularTone An event with this text in its name will not be shaded according to the time of day. It can be used for events depicting lit windows of buildings and so forth. Note the lack of a space between the two words.

Event commands

RPG Maker XP includes a range of default commands for events, which perform various different effects. Most of them work as expected; commands are only listed below if there is anything special to say about them.

Page 1

Command Effect
Show Text Shows text. The page Messages lists all the text formatting options available.
Change Gold Changes the player's money, which is stored in $Trainer.money.
Change Items Does nothing.
Change Weapons Does nothing.
Change Armor Does nothing.
Change Party Member Does nothing.
Change Windowskin Changes the speech text frame. However, it is much more convenient to use the message command that does the same thing.
Change Save Access Sets whether the "Save" option appears in the Pause menu.
Change Menu Access Sets whether the player is able to open the Pause menu.

Page 2

Command Effect
Change Map Settings Set the map's panorama picture or fog. The battleback graphic does nothing.
Prepare for Transition Does nothing.
Execute Transition Does nothing.
Change Screen Color Tone Changes the tone of the screen, until the player transfers to a different map. The changed tone remains even if you walk between connected maps. The time it takes to change to the new tone is also definable.
Set Weather Effects Causes weather to begin. This command only lists rain, storm and snow (and none), so the other kinds of weather such as sandstorm and sun need to be started with a Script event command instead. The possible weather-starting scripts are:
  • $game_screen.weather(:None, 0, 20)
  • $game_screen.weather(:Rain, 9, 20)
  • $game_screen.weather(:HeavyRain, 9, 20)
  • $game_screen.weather(:Storm, 9, 20)
  • $game_screen.weather(:Snow, 9, 20)
  • $game_screen.weather(:Blizzard, 9, 20)
  • $game_screen.weather(:Sandstorm, 9, 20)
  • $game_screen.weather(:Sun, 9, 20)
  • $game_screen.weather(:Fog, 9, 20)

9 is the power of the weather. If the overworld weather corresponds to an in-battle weather, then it will apply regardless of the power of the overworld weather (i.e. even a power 1 Snow weather will cause hail in battle, even though it looks very feeble in the overworld).

The value of the duration (20 here) does not matter. If it is 0, the weather will start immediately. If it is greater than 0, it will fade in over the course of a few seconds.

Page 3

Command Effect
Battle Processing Does nothing.
Shop Processing Does nothing.
Name Input Processing Does nothing.
Change HP Does nothing.
Change SP Does nothing.
Change State Does nothing.
Recover All Fully heals all Pokémon in the player's party.
Change EXP Does nothing.
Change Level Does nothing.
Change Parameters Does nothing.
Change Skills Does nothing.
Change Equipment Does nothing.
Change Actor Name Does nothing.
Change Actor Class Does nothing.
Change Actor Graphic Does nothing.
Change Enemy HP Does nothing.
Change Enemy SP Does nothing.
Change Enemy State Does nothing.
Enemy Recover All Does nothing.
Enemy Appearance Does nothing.
Enemy Transform Does nothing.
Show Battle Animation Does nothing.
Deal Damage Does nothing.
Force Action Does nothing.
Abort Battle Does nothing.
Call Menu Screen Opens the Pause menu.
Call Save Screen Prompts the player to save the game.
Game Over Makes the player black out with a message unique to using this event command: "After the unfortunate defeat, you scurry back home/to a Pokémon Center."
Return to Title Screen Goes to the Continue/New Game screen.

Switches and Variables

A number of things in Essentials use Game Switches and Variables. Below are tables that describe what each one is used for.

Game Switches

The existing Game Switches are listed in the table below. Ones highlighted in blue are Script Switches; see below for more information about those.

Game Switch Name What it does
1 Starting over Set to ON when the player blacks out, and allows special things to happen after this. Should be turned OFF again afterwards.
2 Seen Pokérus in Poké Center Set to ON once Pokérus has been identified in the Poké Center, and prevents the explanation of what it is from showing again.
3 Choosing starter Used to determine whether the player is in the middle of choosing a starter.
4 Defeated Gym 1 Used to determine whether the player has defeated the first Gym Leader.
5 Defeated Gym 2 Used to determine whether the player has defeated the second Gym Leader.
6 Defeated Gym 3 Used to determine whether the player has defeated the third Gym Leader.
7 Defeated Gym 4 Used to determine whether the player has defeated the fourth Gym Leader.
8 Defeated Gym 5 Used to determine whether the player has defeated the fifth Gym Leader.
9 Defeated Gym 6 Used to determine whether the player has defeated the sixth Gym Leader.
10 Defeated Gym 7 Used to determine whether the player has defeated the seventh Gym Leader.
11 Defeated Gym 8 Used to determine whether the player has defeated the eighth Gym Leader.
12 Defeated Elite Four Used to determine whether the player has defeated the Elite Four.
13 Fossil revival in progress Used to determine whether the Fossil Reviver is currently busy reviving a fossil which the player has given him. Typically turned OFF again in the door event that leads out of the Fossil Reviver's lab.
14 s:PBDayNight.isDay? Is ON during the day (i.e. between 5am and 8pm), and OFF otherwise (i.e. during the night).
15 s:PBDayNight.isNight? Is ON during the night (i.e. between 8pm and 5am), and OFF otherwise (i.e. during the day).
16 s:PBDayNight.isMorning? Is ON during the morning (i.e. between 5am and 10am), and OFF otherwise.
17 s:PBDayNight.isAfternoon? Is ON during the afternoon (i.e. between 2pm and 5pm), and OFF otherwise.
18 s:PBDayNight.isEvening? Is ON during the evening (i.e. between 5pm and 8pm), and OFF otherwise.
19 s:pbIsWeekday(-1,2,4,6) Is ON if the current day is Tuesday, Thursday or Saturday, and OFF otherwise.
20 s:!pbIsWeekday(-1,2,4,6) The opposite of Switch 19. Is ON if the current day is Monday, Wednesday, Friday or Sunday, and OFF otherwise.
21 s:tsOn?("A") Is ON if the event's temporary switch A is ON, and OFF if the event's temporary switch A is OFF.
22 s:tsOff?("A") Is ON if the event's temporary switch A is OFF, and OFF if the event's temporary switch A is ON.
23 s:cooledDown?(86400) Is ON if 24 hours (86400 seconds) have passed since the event's variable was set (to the current time then), and if the event's Self Switch A is ON.
24 s:cooledDownDays?(1) Is ON if the current day is different to the day on which the event's variable was set (to the current time then), and if the event's Self Switch A is ON.
25 s:pbInSafari? Is ON if the player is currently in the Safari Zone, and OFF if they are not.
26 s:pbBugContestUndecided? Is ON during a Bug Catching Contest.
27 s:pbBugContestDecided? Is ON after a Bug Catching Contest has finished. It is used to begin the judging and to show other Contest participants standing around afterwards.
28 s:pbInChallenge? Is ON if the player is currently participating in a Battle Frontier challenge.
29 Has National Dex Used to determine whether the player has the National Dex. This Switch does not cause the player to have the National Dex, though.
30 s:pbNextMysteryGiftID>0 Is ON if there is a downloaded Mystery Gift which has not yet been collected, and OFF if there are none.
31 Shiny wild Pokémon While this Switch is ON, all wild Pokémon encountered will be shiny.
32 Fateful encounters While this Switch is ON, all Pokémon created will be fateful encounters.
33 No money lost in battle While this Switch is ON, the player will not lose any money if they lose a wild battle or a trainer battle. They can still gain money from winning trainer battles/using Pay Day, though.
34 No Mega Evolution While this Switch is ON, no Pokémon can Mega Evolve in battle, not even if they normally could.
35-50 ----RESERVED----- These switches are not currently used, but are marked as reserved in case they need to be used by Essentials in future.
51 onwards various Other switches used specifically in the Essentials example maps, which can be overwritten as required.

Remember that an event's page conditions can check up to 2 different Switches. For example, you can have an event page that depends on both Switch 14 and Switch 19, and that page will only be usable during the daytime of Tuesdays, Thursdays and Saturdays.

Game Variables

The existing Game Variables are as follows:

Game Variable Name What it does
1 Temp Pokemon Choice Used to temporarily store information. The name is just a guide as to what kind of information that is. Is also the default place where the outcome of a battle is stored.
2 Temp Move Choice Used to temporarily store information. The name is just a guide as to what kind of information that is.
3 Temp Pokemon Name Used to temporarily store information. The name is just a guide as to what kind of information that is.
4 Temp Move Name Used to temporarily store information. The name is just a guide as to what kind of information that is.
5 Temp Text Entry Used to temporarily store information. The name is just a guide as to what kind of information that is.
6 Poké Center healing ball count Used while healing in the Poké Center. Is the number of balls to display on the healing machine (i.e. the number of Pokémon in the player's party).
7 Starter choice Used for remembering which starter Pokémon the player chose. Typically 1=Grass starter, 2=Fire starter, 3=Water starter.
8 Apricorn being converted Used by the Apricorn Converter. Is the item ID of the Apricorn given to convert, or the item ID of the resulting Poké Ball.
9 Fossil being revived Used by the Fossil Reviver. Is the item ID of the fossil item being revived, or the species ID of the resulting Pokémon.
10 Elevator current floor Used by elevator maps. Is the current floor the elevator is at. It should be set as part of any door event which leads into the elevator.
11 Elevator new floor Used by elevator maps. Is the floor the player wants to go to. It should be set by the event representing the elevator's controls.
12 Rival name Stores the rival's name.
13 E4 defeated count The number of times the Elite Four have been beaten. This number is added to each time the Hall of Fame is entered.
14-25 -----RESERVED----- These variables are not currently used, but are marked as reserved in case they need to be used by Essentials in future.

Script Switches

Some predefined Game Switches have a line of code as a name. These Switches will be ON while their code is TRUE, and OFF while it is FALSE. These Switch names begin with "s:", followed by the code. Half of the predefined Switches are Script Switches (the ones highlighted in blue above).

As a Switch name is only a single line which cannot be very long, you cannot have complicated calculations in them. However, you can work around that by writing a method in a script section, and then simply calling that method in the Switch name (this is what all the predefined Script Switches do). Try to keep it simple.

Script Switches are useful for a number of things, including time-sensitive events and checking certain conditions (e.g. whether the player is in a Safari Zone). The reason they are useful is because they can be ON or OFF depending on various factors and calculations, but you do not have to worry about setting them manually. They are an automatic way of seeing the state of certain parts of the game.

Technical Note: It is possible to manually store a boolean value in a Game Switch which is a Script Switch. However, that stored value is ignored because, whenever the value of that Game Switch is checked (i.e. by events when they are checking their pages' conditions upon a map refresh), its code is evaluated and the result of that is what is returned. Since there are plenty of unused Game Switches you can use, there is no point in trying to manually store values in a Script Switch.

Tips

  • The "Size(x,y)" event name text can be used for a variety of things to help reduce the number of events used. For example:
    • A line of bookshelves can use a single wide event for their interactions, rather than a separate event for each bookshelf tile that can be interacted with.
    • A single event can cover the whole width of a path, which can trigger when the player steps on it to, say, start a cutscene or call pbBridgeOn or play/stop ambient audio.
    • New kinds of event-pushing puzzles (e.g. Strength boulders) can be invented, using events of various sizes.
    • If you are compelled to use events as a fourth tile layer, you can use one large event rather than a separate event for each tile being placed.
Advertisement