FANDOM


This article describes events, as well as Global 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.

See also

Time-sensitive events

  • These use some of the time-related Global Switches listed below.

Special effects

  • Particle effects, lights and shadow-casting are all created by events.

Controlling events with scripts

  • This article explains how to manipulate an event using scripts (rather than event commands).

Event commands

RPG Maker XP includes a range of default commands for events, which perform various different effects. This section of the article describes those commands.

Some of those commands have been adapted from their original use to work with Pokémon Essentials. Modified commands are highlighted in green below. Commands that do nothing are highlighted in red.

Page 1

Command Effect
Show Text Shows text.
Show Choices Displays up to 4 choices. To show more than 4 choices, see the article Messages.
Input Number Lets the player set a Global Variable to a number of their choice. You choose how many digits the number has.
Change Text Options Changes the position of the speech text box (either top, middle or bottom), and shows/hides the window (but not the text itself). Applies to all speech boxes for the rest of the event.
Button Input Processing Waits for the player to press a key, and stores the key in a Global Variable.
Wait Pauses the game for a given length of time.
Comment Used to annotate events. Some comments are converted into other event commands when the game is compiled (e.g. into a trainer event).
Conditional Branch Creates an "if...else" branch in the event.
Loop Creates a never-ending loop in the event.
Break Loop Breaks out of the above loop.
Exit Event Processing Immediately stops processing the event's commands, even if there are commands after this one.
Erase Event Temporarily erases the current event, for as long as the current map remains loaded. Is exactly the same as the script command pbEraseThisEvent.
Call Common Event Calls a Common Event and begins processing it.
Label Set a bookmark in the event's commands, which can be jumped to.
Jump to Label Jumps to a label in the event's commands.
Control Switches Changes the ON/OFF status of a Global Switch.
Control Variables Changes the value of a Global Variable.
Control Self Switch Changes the ON/OFF status of one of the event's Self Switches.
Control Timer Begins an on-screen timer which counts down from the given time, or stops it and makes it disappear. If the timer reaches 0, it will still remain on-screen until this command stops it.
Change Gold Changes the player's money.
Change Items -
Change Weapons -
Change Armor -
Change Party Member -
Change Windowskin Changes the speech text frame. Much less convenient to use than the message command which does the same thing.
Change Battle BGM Sets the BGM to play for the next battle.
Change Battle End ME Sets the ME to play in battle for the next victory.
Change Save Access Allows or forbids the player to save the game (the option won't show up in the Pause menu).
Change Menu Access Allows or forbids the player to open the Pause menu.
Change Encounter Enables or disables wild Pokémon encounters.

Page 2

Command Effect
Transfer Player Moves the player to a different location on the same or a different map. Usually used alongside a few other event commands.
Set Event Location The same as "Transfer Player", but only for events and only for the current map.
Scroll Map Changes what part of the map the screen is centred on. Doesn't work well if the player (now off to one side of the screen) moves towards the centre of the screen.
Change Map Settings Set the map's panorama picture or fog. The battleback graphic does nothing.
Change Fog Color Tone Changes the colour of the fog.
Change Fog Opacity Changes the opacity of the fog.
Show Animation Plays an animation centred on either the player or an event.
Change Transparent Flag Makes the player visible or invisible.
Set Move Route Sets a move route for the player or an event.
Wait for Move's Completion Use after "Set Move Route" to make the entire move route play out first before proceeding with the next event command.
Prepare for Transition -
Execute Transition -
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.
Screen Flash Like "Change Screen Color Tone", but temporary.
Screen Shake Makes the screen shake.
Show Picture Displays a picture on-screen. The Professor's lecture contains a number of examples of this.
Move Picture Moves a displayed picture to a different place on-screen. It glides from its old to its new position over a definable period of time.
Rotate Picture Makes a displayed picture begin rotating.
Change Picture Color Tone Changes the colour of a displayed picture over a definable period of time.
Erase Picture Erases a displayed picture.
Set Weather Effects Causes weather to begin. This command only lists rain, storm and snow, so the sandstorm and sunny weathers need to be started using $game_screen.weather(4,9.0,20), where the highlighted number is the weather's number (4=sandstorm, 5=sunny).
Play BGM Plays a BGM.
Fade Out BGM Fades out the currently-playing BGM and then stops it.
Play BGS Plays a BGS.
Fade Out BGS Fades out the currently-playing BGM and then stops it.
Memorize BGM/BGS Remembers which BGM and BGS are currently playing.
Restore BGM/BGS Plays the remembered BGM and BGS.
Play ME Plays a ME.
Play SE Plays a SE.
Stop SE Stops the currently-playing SE.

Page 3

Command Effect
Battle Processing -
Shop Processing -
Name Input Processing -
Change HP -
Change SP -
Change State -
Recover All Fully heals all Pokémon in the player's party.
Change EXP -
Change Level -
Change Parameters -
Change Skills -
Change Equipment -
Change Actor Name -
Change Actor Class -
Change Actor Graphic -
Change Enemy HP -
Change Enemy SP -
Change Enemy State -
Enemy Recover All -
Enemy Appearance -
Enemy Transform -
Show Battle Animation -
Deal Damage -
Force Action -
Abort Battle -
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, Red scurried to a Pokémon Center."
Return to Title Screen Goes to the Continue/New Game screen.
Script Allows the user to enter their own scripts for the event to run.

Switches and Variables

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

Global Switches

The existing Global Switches are as follows:

Global 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?(pbGetTimeNow) Is ON during the day (i.e. between 6am and 8pm), and OFF otherwise (i.e. during the night).
15 s:PBDayNight.isNight?(pbGetTimeNow) Is ON during the night (i.e. between 8pm and 6am), and OFF otherwise (i.e. during the day).
16 s:PBDayNight.isMorning?(pbGetTimeNow) Is ON during the morning (i.e. between 6am and noon), and OFF otherwise.
17 s:PBDayNight.isAfternoon?(pbGetTimeNow) Is ON during the afternoon (i.e. between noon and 8pm), and OFF otherwise.
18 s:PBDayNight.isEvening?(pbGetTimeNow) 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 battles, 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 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.

Note: Switches that begin with "s:" are special. See Script Switches below.

Global Variables

The existing Global Variables are as follows:

Global 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.
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 number of the Apricorn given to convert, or the item number of the resulting Poké Ball.
9 Fossil being revived Used by the Fossil Reviver. Is the item number of the fossil being revived, or the species number 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 Global 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 (see 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 def in a script section, and then simply calling that def in the Switch name (this is what all the predefined Script Switches do).

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. They are an automatic way of seeing the state of certain parts of the game.

Technical Note: The script in these switches are evaluated by events when they are checking their preconditions on a map refresh. The actual value stored in script switched is never changed by this process, which means the values stored in these switches will likely not reflect the actual return value of the script. If you were to check them in the debug menu, for example, they will show the stored value (usually false) and not the return value of the script. Setting them to true in the debug menu will affect nothing. [This is a function of Pokemon Essentials and not RMXP itself.]

Start a Discussion Discussions about Events

  • making a event

    5 messages
    • i no I might be overlooking the event in the events already there but just cant see it
    • Have an event with the first event page being of an impassible object such as a rock or a door. Have the event activate on action button. ...

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.