In the first part of the tutorial I created a new project and made a cutscene in it. I decided to break the tutorial into multiple posts to make things easier to manage, for both the readers and me. I thought of breaking the post into multiple pages, which I know the WordPress software can do, but it looks like this doesn’t work at WordPress.com, at least for the free account. (Let me know if that’s possible.)
I’m itching to add some object interaction now, so I’ll start with that. Then I’ll change the opening image of the game, the music on that screen, and also add some music to the house scene.
Eric’s Mom put the sword and shield inside a chest in the music room. She chose that location because it has some free space and nobody in particular is using it. Let’s create this event.
The treasure chest dialogue allows choosing the image for the treasure chest and what will be in it. I chose Weapon and selected the Short Sword. I also want the chest to contain a shield, but it’s not possible to select more than one thing in this dialogue. That’s not a problem, it’s just a shortcut to creating an event, and that event can be edited.
You can double-click the Graphic box and choose an image for the chest that isn’t the default.
First the commands. You can press Space on any command to look more closely at the command page. Here’s what we have:
- Play sound effect (SE) for the chest, volume 80, pitch 100.
- Set Move Route: This animates the opening of the chest. The chest has four frames of animation: open, closed and two in-between frames. These correspond to the four directions an NPC can face: up, down, left, right. We’ve started with the closed frame so we play the two intermediate frames. Page 2 of the event has the opened chest graphic, and switching to it will finish our animation. I’ll discuss the direction fix below.
- Switch to page 2. We’ve seen this in the cutscene. You can take a look at page 2 and see how it’s set. Interestingly, we switch immediately to page 2, showing the last frame of the animation, but continue to perform the commands on this page.
- Change Weapons. This adds the weapon to the inventory.
- Show some text.
At the bottom left of the window are some options. One of them is the Direction Fix, which is checked. When a player interacts with an event such as an NPC, that NPC will turn towards the player character. We don’t want that to happen, because that will change the animation frame of the chest. Ticking this makes the event keep the frame that was chosen. When we animate the chest (command 2) we turn direction fix off so we can change the facing direction.
The last thing I want to discuss at this point is the Priority. This has three levels:
- Below Characters: characters can move over this event. The action button triggers this event (assuming Trigger is set to Action Button) if the player character is over it.
- Same as Characters: the event blocks characters. It’s an obstacle in the world. The action button triggers this event if the player is standing next to the event and facing it.
- Above Characters: characters can move under this event. This is similar to Below Characters but the event’s graphic is shown over the character.
It’s now clear what the event is doing, so let’s change it to do exactly what we want. Story-wise, Eric starts without weapons (he gave them to his mother to store) and when he finds them he will take them, and I want them to be automatically equipped.
First let’s add the shield. Click on the last command (the text one) and press Enter to add a command before it. Click Change Armor… on the first tab, and select Round Shield from the list. OK the dialogue and we now have both the sword and shield added by this event.
We need to fix this. But before we attempt to do that, let’s look at another related problem we have. Cancel the Change Equipment dialogue and the Event Commands dialogue, OK the event editing we did before, and playtest the game. After the cutscene, press ESC, go to Equipment, select Eric and you’ll see that he already has a Hand Ax and Wood Shield equipped. I wanted him to have nothing to start with. (And besides, it’s an Axe, not an Ax. That just won’t do!)
So close the game and let’s get started with changing out character to fit our needs. Let’s meet…
The database defines all the characters, classes, enemies, items and various other things that make the core of the game. It’s how the game systems are defined, so it’s useful to get to know it a little better.
Press F9 or choose Tools \ Database… or click the icon. (I leave finding the icon as an exercise to the reader. Hint: it’s just to the right of the 1/8 icon.)
Here’s the database. I switched to the Actors tab (the leftmost one) because I want to modify Eric a bit. I marked what I changed. I don’t want a weapon or shield in his starting equipment, and I changed his nickname to ‘The Noob’ and the description to ‘A knight just recently out of Knight School.’
The last thing I want to change is his class. There is no Knight class, so let’s create one. Apply the changes (to save them) and switch to the Classes tab (second from the left). For simplicity I will make the Knight class similar to the Paladin class but without magic, and using swords for weapons.
For now I’m not looking to delete any existing data, so I will add the Knight class to the existing ones, instead of replacing any of them.So click Change Maximum…, add one to the maximum (using the down arrow) and OK. Click on the Paladin, press Ctrl-C, click on slot 11 and press Ctrl-V. Now:
- Change the class name to Knight.
- Delete all the skills from Heal and down. This can be done for example by clicking on Heal, pressing Shift-End and then pressing Delete.
- Under Features, select Add Skill Type [Magic] and delete it.
- Under Features, double-click Equip Weapon [Spear] and change the Spear to Sword.
That’s good enough. Apply the changes, and let’s go back to Eric. Switch back to Actors and change Eric’s class to Knight. We’re good for now, so OK the dialogue and let’s go back to the chest.
(It’s also worth saving our work at this point. Pressing Ctrl-S will do that. As with anything we do on the computer, saving often is a good thing, just in case.)
Back to the chest, and temporary disabling the cutscene
Edit the chest event. After the Change Weapons and Change Armor commands add two new commands: Change Equipment weapon to long sword, and Change Equipment shield to round shield. (If you don’t remember how, go back to just before the database section above.)
Now I just want to change the text from “Short Sword was found!” to “There they are!” So edit the text command (click on it and press space) and enter that text. Also select Eric’s face.
Now we can run the game again to test the interaction with the chest, but I don’t really want to play that cutscene again. I do want to be able to access it, but only if I want to.
So edit the cutscene event, change its priority to Same as Characters and its trigger to Action Button. Now if I turn Eric towards the wall and press Enter the cutscene will play. That was the reason I wanted the event just above Eric. It allows me to play it from the right starting place but only when I want to.
Hopefully I’ll remember to switch the cutscene back on when I want to release the game, by switching the trigger back to Autorun.
Playtest the game and start it. You can take a look at Eric’s equipment and see that he doesn’t have a weapon and shield. Under Status you can see his nickname and description that we changed.
Move to the chest and press Enter to interact with it. He will now gain his sword and shield. Great, we have created our first interaction and we’re ready to take over the world.
Some game customisation
Before we go on to add more interactions, I feel it’s a good time to make the game start with something other than the default screen.
Go back to the database (F9) and select the System tab. At the bottom right there’s the title screen graphic. Click the ellipsis (three dots) and you’ll get the Title Graphic window, where you can look at all the available images. The title screen graphic is made of two parts: the one on the left is the background, and the one on the right is overlayed on it. I think that the combination of CrossedSwords and Heroes is nice.
OK the dialogue and let’s customise the music for the title screen. You can find this at the left of the System window. Click the ellipsis and you’ll be presented with a collection of background music (BGM). You can play it and choose one. I think that Theme 2 is nice. Remember to stop the playback before you exit the dialogue, because it won’t stop automatically. (Unless of course you want to continue listening to it. 🙂 )
I also want the map to have background music, so click the map on the left and press space or choose Map Properties from the right-click menu.
Now you can playtest and see the new title screen in action. Get into the game to hear the theme change.
More object interaction
Interaction with the chest is the only vital interaction on this map, but I want the game to be more interactive than this. I want the player to have some fun looking around, so I want more objects on the map to have interactions.
I decided that the bottom right room is Eric’s sister’s room. There’s a bookcase there, and I want it to be interactive, so create an event on its bottom tile, and set its priority to Same as Characters, so we could interact with it from neighbouring tiles.
Add a Control Self Switch to set switch A to ON. Add a New Event Page and set the Self Switch condition to A. Set the priority to Same as Characters. Enter the text command: “My sister’s adventure novels.”
Now the first time Eric interacts with the bookcase the player will get the long text, and subsequent times will show the short text. You can playtest this if you want.
I don’t like that Eric can interact with the bookcase from the side. It feels more natural to me that he’d only interact with it when he can look at the books.
So let’s edit the event and add a new command before the text (double-click the text command, or whatever other way): Add a Conditional Branch with the condition that the character is facing up. Unset ‘Set handling when conditions do not apply’, because we only want to specify what happens when the condition applies (when it doesn’t, nothing will happen).
OK the dialogue, select both the Text and Control Self Switch commands, cut and paste them into the Conditional Branch. Here’s what we end up with:
An event with a variable
Eric’s sister keeps 50 gold in a drawer near the bookcase. I want to let Eric take part or all of this money. I will offer the options of taking all of it, 10 coins or nothing. The player will be able to continue activating the event and so take more coins later.
Start by adding an event at that location, and set its priority to Same as Characters.
The number of coins will be kept in a variable. A variable is a place to store a number. We can then manipulate the number (for example add to it or subtract from it) and use it, for example by having a condition based on the value or displaying that value as part of some text.
To better understand what a variable in RPG Maker VX Ace looks like and what can be done with it, let’s first implement just the part where 10 coins are removed. We’ll add the rest of the event’s commands later.
Add the Control Variables… command, which is under Game Progression on the first commands tab (just above Control Self Switch, which you’re already familiar with).We’ll be subtracting 10 from variable 0001. The variable is shown at the top, the operation (Sub = subtract) below it, and what we want to subtract, which is the constant value 10 , below that.
Click the ellipsis at the top.
In this window we can select the variable to use. We’ll continue to use variable 0001, but name it ‘Sister’s gold’ so that we will always know what this variable refers to. OK the dialogue and you’ll see that the name shows up in the Control Variables window. OK that too, to enter the command in the event’s contents.
Now we have an event that reduces the value by 10 every time it’s run. Problem is, variables start with the value 0, and we want the value to start at 50.
There are various ways to deal with this. One would be to add the Control Variables command to the cutscene event, which will run when the game starts. We’re not auto-running it currently, so if we want to give our variable an initial value we could use another autorun event for that. Another option is to set the value in a script, but I’m trying to avoid scripts for now.
I don’t plan to use this value elsewhere. I might want in theory to check it later to learn about Eric’s character (is he honest or not) or have his sister confront him, but that won’t happen in this tutorial. So in this simple case I can set this value inside the event:
Add a Conditional Branch command as the first command in the event, choose Variable, and keep the default values.
Inside it add a Control Variables command like the one we used to subtract 10, but use operation Set (the default) and the constant value 50.
We still need to deal with what happens when the value drops back to 0, but first let’s add a little more meat to the event; not everything I want it to do, but enough to make it testable.
After the conditional branch (before the subtraction) add a text command with the text: “My sister keeps money in this drawer. There are \v gold coins in it.” (I put each sentence on a different line.) \v is replaced with the value of variable 1 (which we know as 0001) when the game runs. If you preview the text you’ll see it replaced with 0.
Now let’s add the money to Eric’s purse (of course he carries a purse, doesn’t every adventurer?).
Now it’s possible to playtest the event, and if you do that you’ll see that we can get to negative numbers and gain more and more gold. It’s better to stop at 0. So let’s check for that:
Add a Conditional Branch as a last command, with the condition that variable 0001 is equal to 0. (Just select ‘Variable’ and use the defaults.) Untick ‘Set handling when conditions do not apply’.
Inside the conditional branch add Control Self Switch to set switch A to ON. Also add a Control Variables setting variable 0001 to -1. This is just in case I want to later distinguish (for example if I want the sister to confront Eric) between the cases of all the money being taken and the player not having interacted with this event at all (the variable will be 0 in this case, because we didn’t get the opportunity to set it to 50). It may be better to just initialise it to 50 in an autorun event if I really care to use it in the future, but setting to -1 is a workable solution.
Now add a new page with the text: “My sister kept her money in this drawer.” Set the condition to Self Switch A is ON and set priority to Same as Characters.
Now you can test the event and see how to money left drops down, and your party’s money goes up. (You can see the party’s money by pressing Esc and looking at the bottom left.)
Let’s go to the original vision of letting the player choose what Eric will do. Select the Control Variables command that’s after the text command and press enter to add a command before it. Select the Show Choices command.
Select the ‘Control Variables: [0001:Sister’s gold] -= 10’ and ‘Change Gold: + 10’ lines, cut and paste them inside the second choice (‘When [Take 10 coins]’).
Now for ‘Take all the coins’ create a new Change Gold command. Choose Variable, and you’ll get the default, which is the variable we want. OK the dialogue. This will add all the gold coins to the party’s gold.
After that add Control Variables, setting ‘sister’s gold’ to 0 (you can just OK the dialogue, these are the defaults).
For the ‘Close the drawer’ option we’ll add the text ‘I’m not going to steal from my sister’ if we left 50 coins and ‘I’ve borrowed enough’ otherwise. Here’s the full contents of this event page:
I think that’s enough for now. Next time I’ll put some finishing touches on this floor and move to the next one. Maybe we’ll even get to meet an NPC.