MFGU PSDK : Making an Intro

📅July 9, 2019 👨‍💼


In the last tutorial we saw how to install the tools. In this tutorial we’ll see how to make a Pokémon Introduction. This way we’ll see the following basic commands :

  • Display a message
  • Display a picture
  • Display a choice
  • Ask the name of the player
  • Change the player appearance

The starting map

The starting map is the map where the starting Position of the player is set. It’s the loaded map when you start a new Game.
To create the starting map, open your project with RPG Maker XP, right click in the map list and select “New Map”.

Set the map name and let the default values, we don’t care since we’ll not be mapping anything in this map.

Creating a new map

Now right click in the middle of the map and click on “set starting point”.

We’ll check the starting point is correctly set. In the bottom right of the RPG Maker XP UI you should see “015: Intro (20×15)”. 015 is the map ID (15), 20×15 is the map size. We’ll note the map ID and check what PSDK says when we start a new Game.
Click on the play button, save and pay attention to the console.

The game telling the start map id

In this screenshot we see that the start map id is 15 like I configured it by setting the starting point in the Map 015. The value should correspond to the ID of the map you choose as starting map. It’s not necessary 15.

The starting event

Setting the event up

Now we’ve done that, well create the first event of the game.
Click somewhere in the map (in Event Layer) and press Enter. An event Window should appear, you’ll have to set the event like it’s done in the screenshot :

Starting event configurations

The event needs to be in “Autorun” trigger so it’ll start without letting the player move and we need to put [sprite=off] in the event name so PSDK we’ll not create a sprite for this event (we don’t need it to have a sprite).

If the configuration is correctly done, we shouldn’t be able to open the Menu (V by default).

The first message

We’ll make the “same” intro as in Diamond and Pearl. To make your first message, you need to double click in the List of Event Command and click on show text :

Making our first message

Once we’ve done that, we’ll save and check the result in game :

Our first message in game!

The message will display infinitely (Autorun events loop) but we have what we expected to get (the message correctly shows when we start a new game).

Now you can put the following message the same way we did before :

Second message

In game you’ll see the two message one after the other (looping since the event is an autorun event).

Showing images

Right after the professor said this three sentences, he’s being shown with the background. We’ll have to display the images but first, remember how it’s shown in the Original games.

There’s a fade-in. To do that since the screen is already black, we’ll add a little wait command (to let the message disappear), and freeze the graphics :

How to add wait command and graphics freeze command

We wait 4 frames. In events it means we’re waiting 8 in game frames (about 0.13 seconds in PSDK).

Now we can add the display image commands.

1st image : the background

The background is the easiest thing to display, we just need to add a show image command and select the file _intro_bg :

In the screenshot we see a “Number” field. This gives the image ID we’re modifying. The highest image ID is the image that is shown on top of the other images so we need to make sure the background is the first image and the prof the second image !

2nd image : the prof

The second image is a bit trickier because we have to set the position of it. We’ll be lazy and put the image in the center of the screen (160, 120 since PSDK is in 320×240 by default). To make sure the image is correctly centered we’ll choose the “Center” as “Origin”.

Second image settings

Now we can define the transition, it’ll be a 1.5 second transition (90 real frames). Since the event command doesn’t give time option we’ll use a script command (Graphics.transition(90)).

Writing a script command

Now we’ll test the ingame result and adjust thing if it’s not good enough.

The result

Now we can add the rest of the messages (until the first choice) :

How the event should look before the first message

Our first choice

In PSDK there’s two way to display choice, using a script command or using the RMXP command. Usually we use the script command when there’s more than 4 choices. There’s rules to follow when you want to display a choice :

  • If you use the RMXP command, the choice HAS TO BE right after the message WITHOUT anything else between the choice and the message.
  • If you use the script command, the script command needs to be right before the message. (Because otherwise RMXP shows the message and then execute the script.)

Since we’re displaying a looping choice (display the choice until the player says no thanks) we’ll have to use a LOOP command. Also, the choice is shown in top left instead of bottom right (default). PSDK has the switch 26 “Top right choice” (the text is wrong, sorry :/) that put the choice in top left when set to true !

Here’s the commands once we’ve configured the choice :

Choice set in top left
Result in game

The first thing we’ll do is ensuring that the choice can stop the loop. To do that add a Break Loop command in the option “NO INFO NEEDED”.

Ensuring the loop can stop

We’ll not cover the “Adventure info” it’s up to you but I’ll cover the “Control Info” because it needs a specific script command to display that ^^

Showing the Inputs

In the CONTROL INFO choice you’ll put the following script

@vp = Viewport.create(:main, 1000)
@vp.oy = 32
@ctrls =
instance_variable_get( :@main_selector)&.visible = false
It should looks like this in the text box (otherwise the game will crash)

After the script command put a message to allow the player to take his time to read the thing and then add the following script command :

It should looks like this in the text box (otherwise the game will crash)

Here’s the CONTROL INFO choice with all its commands :

Note : [WAIT 120] tells the message to wait 120 frames before continuing (in this case letting the player skip)
The result in game

Just after the choice you’ll add the following of the professor intro :

The player appearance choice

In this choice we’ll need to display and animate the current choice of the player. To do that we’ll use a secondary event that works in parallel process when we’ll set the variable 26 (TMP1) to a value higher than 0 (1 = boy, 2 = girl).
Until the player press “A” we’ll wait 1 frame. If the player press right or left, we change the variable value to 1 or 2. This way the parallel process event will be able to animate the images.

1st step : Showing the image

We’ll hide the professor and then show the two possible appearance :

Commands that display the two players

After that we’ll set variable 26 (TMP1) to 1 (this will trigger the event that animates the male appearance).

2nd step : The input loop

To process this choice we’ll have to use a loop that will use various conditions to select the player appearance and validate the choice.

To define a key input condition you use the conditional branch :

In RMXP C is the validation key so we use “C” to say “A” which will mean “Enter” in the keyboard.

Here’s the resulting loop :

Note : the scripts commands help to let the message window on the screen and to automatically skip the message without user validation.

And the parallel process event :

Page 1 : Animate the male appearance
Page 2 : Animate the female appearance

3rd step : Setting the player appearance

In PSDK the player has a state system (running, surfing, wheeling etc…), because of that the appearance is not set like any other events (using the script command).

There’s various files for the player and they’re constructed like this : [base]_[gender]_[state].png
For example here’s the resulting files :

  • hero_m_walk.png : base = hero, gender is male, state is walking
  • hero_f_run.png : base = hero, gender is female, state is running

Now we’ll need to do two thing : defining the “gender” of the trainer and defining the character base of the trainer. We’ll need to define the gender first because it’s not the thing that will trigger the appearance change : $trainer.set_gender(playing_girl)
In this script command playing_girl should be true if we choose the girlish looking character. To define the value we can use the of the variable 26 TMP1 we used in the appearance choice : $trainer.set_gender(gv[26] == 2)

Once we did that we’ll use the set_appearance_set method of Game_Player to define the base. In PSDK we have two different appearance set for the player (hero_01_red for the male and hero_01_white for the female) so we’ll need a condition but you can do it better and use the same base for the two gender!

Here’s the complete script command :

$trainer.set_gender(gv[26] == 2)
  gv[26] == 2  ? 
  'hero_01_white' : 'hero_01_red'

Note : $game_player.update_appearance force the system to update the appearance of the player. (Otherwise it’ll be done when the state changes).

Ask the player name

This step is the easiest one of the whole tutorial but I think you’ll want to put a default name!

To put the default name you should use $ = "default_name", to ask the name you simply use the Name Input Processing command.

To detect the player gender you can use switch 1 (it tells if you’re playing a girlish character).

Here’s how it should look like :

Once everything is done in the intro, we can setup some system (like the FollowMe or the Berries) and teleport to the player’s house. Well just erase the image and teleport to the player’s house :

In the next tutorial

The next tutorial will be about defining the Zones and MapLinking the maps.

Pokemon SDK wiki