- 10,673
- Posts
- 16
- Years
- Seen Sep 29, 2024
Beginner's Guide
All you're going to need to know for beginning a Pokémon fan game.Table of contents
1. What is RMXP?
2. Which Starter Kit should I use?
3. How to import a starter kit
4. How to change graphics in your project
5. A quick introduction to mapping
6. A quick introduction to Eventing
7. A quick introduction to Scripting
8. Final notes
Hey there guys, I'm Abnegation, the developer of Forever Lost, a fan game that has been in the works for over two years now. I am here today, to teach you all I can about what you need to know for the basics of RMXP and how to start a fan game! So let's get started shall we?
[a id]A[/a id]What is RMXP?
RMXP is a program which allows you to make RPG's. It has all you need to make a decent role playing game in 2D graphics. It is developed by Enterbrain and uses the Ruby programming language to run its games. What you need to know mainly though, is that it allows you to edit and make your own maps, add your own tiles and graphics and make events in your game with ease. When making a Pokémon fan game, little Ruby (also known as RGSS) knowledge is required, but it certainly is useful to know some. But this will come later in the guide. It is also notable that RMXP uses images which are double their size, but I will teach you about this later on also.
You can purchase RMXP here. However, how you acquire the program is up to you. I'm simply here to teach you what you need to know to get started. But let's take a quick look at what RMXP looks like shall we?
Map Editor
The map editor is at the forefront of RMXP and is the most easily noticed part when you open it up. An example of the map editor is below.
Click for larger size
![[PokeCommunity.com] Where to begin a Pokémon fan game in RMXP [PokeCommunity.com] Where to begin a Pokémon fan game in RMXP](https://i56.tinypic.com/117u39x.png)
The map editor is the most noticeable part of RMXP. This is where you will spend a lot of your time when making a program. For those of you who have gotten RMXP and opened it up before looking at this tutorial, you may notice that it has different images and does not look Pokémonish at all. Well don't worry, further down in this tutorial I will teach you what to do to get the Pokémon starter kit like the one in the screenshot above. The one I am using here is called Pokémon Essentials, which was made by Poccil with help from Flameguru. This starter kit replicates how the games work, at least some of the older generations, and it is all you need to get started. However there are more than just this starter kit, and I will show you your options a little later. However this is the most complete.
Event Editor
Next you will see the event editor. This is a little pop up box which will have lots of options for you to choose from. This is where you will make all your events which will happen in the game. Look below to see what it looks like.
Click for larger size
![[PokeCommunity.com] Where to begin a Pokémon fan game in RMXP [PokeCommunity.com] Where to begin a Pokémon fan game in RMXP](https://i52.tinypic.com/i424qs.png)
Eventing is basically all the things that happen in the game, such as dialogue, sign posts, overworlds walking, pokemon battles and so on. You can also call scripts from here as some things are not able to be done through events and this is where you would call a script, an example would be when you boot up your PC to look through your boxes or at your mail. That is where an event would call a script (don't worry, stuff like that will already be made for you in the starter kit, which will also show you how to do it).
Script Editor
The script editor is where all the scripts created to make the game's engine are. RMXP already comes with a stock engine (or starter kit). This is going to be the most complex coding area you will come across in RMXP. This is where the Ruby/RGSS scripting comes in. Now, the coding can be quite difficult for some, and it is probably best to get to grips with how RMXP works before you attempt to learn it, however, the more research and practice you do the better. Below you will find screenshots from scripts made for Pokémon Essentials.
Click for larger size
![[PokeCommunity.com] Where to begin a Pokémon fan game in RMXP [PokeCommunity.com] Where to begin a Pokémon fan game in RMXP](https://i55.tinypic.com/2qmm8mf.png)
Scripts make up the frame of your game. This is where you will be able to create your own custom menus, windows and features for your game. You will also be able to edit the way the game works from here. An example of some things you could do as a beginner would be to change the screen resolution, and reposition some things around the game. The good thing about starter kits is that most of the work is done for you in that area, and all you need to do is change images, event and change some scripts. But it depends on how much you wish to do of course. The more you wish to change in the engine, the more scripting knowledge you will need.
Database
This is the area where you will load in your tilesets and choose what autotiles you will use for each tileset, I will explain autotiles in a moment. This is where you can also work with attack animations and view common events.
Click for larger size
![[PokeCommunity.com] Where to begin a Pokémon fan game in RMXP [PokeCommunity.com] Where to begin a Pokémon fan game in RMXP](https://i53.tinypic.com/20r1zq1.png)
I will be speaking about the database a little further on under the tilesets section. However, to give you a brief introduction, this is where you will set the movement permissions for your tiles, decide on which tiles have wild pokemon in them, decide which tiles require HM's such as Surf to be traveled on, where you will also decide on what autotiles each tileset and so on. Autotiles are just that, they are tiles which automatically map for you when you choose their path. Examples would be water and paths. But these are also used to use tile animations, again, an example would be water.
This is a quick over view to the different functions of RMXP, next I will go through the drop down menus and what they do also.
Drop Down Menus
These are the options at the top of RMXP, some of them are fairly straight forward, so I will go through the important options and what they do.
File
![[PokeCommunity.com] Where to begin a Pokémon fan game in RMXP [PokeCommunity.com] Where to begin a Pokémon fan game in RMXP](https://i55.tinypic.com/2eauq6h.png)
New Project: When you choose this it will create a new project in your RMXP folder which should be in your Documents folder on Windows. Unless you moved it.
Open Project: This will go to your group of projects in your Documents folder. However you can move your project folders if you wish to, and you can browse to find them yourself.
Close Project: When chosen your project will be closed, but RMXP will not be exited. Be sure to save any progress you have made, it should give you the option, but just to be sure, press ctrl + S a lot when working in RMXP.
Save Project: This allows you to save anything you have done on your project in the current session.
Compress Game Data: This will compress your game data into a distributable file. You should do this when you are ready to release a demo or release.
Edit
![[PokeCommunity.com] Where to begin a Pokémon fan game in RMXP [PokeCommunity.com] Where to begin a Pokémon fan game in RMXP](https://i53.tinypic.com/23hrsde.png)
Well rather than go through all these, I'm just going to tell you what they relate to, I think we all know what these buttons do. Mostly you would use these when mapping, but you can also use them with events if you wish to copy and paste the same event for example. At any rate, these will come naturally to you when you start mapping and eventing which I will explain to you later in this tutorial.
View
![[PokeCommunity.com] Where to begin a Pokémon fan game in RMXP [PokeCommunity.com] Where to begin a Pokémon fan game in RMXP](https://i53.tinypic.com/2cnyudz.png)
Current Layer and Below: This will only show what tiles are on the current layer, and the layer below it. I will be teaching you about layers a little later on. But there are 3 mapping layers in RMXP, because some tiles need to overlap others, and so would go on the layer above. There is also one eventing layer which is on top. But as I say, we'll worry about that later.
All Layers: This will make all tiles on all layers on your map visible.
Dim Other Layers: This makes the layers that you have not selected dimmer so you can concentrate what you are putting on the current layer.
Mode
![[PokeCommunity.com] Where to begin a Pokémon fan game in RMXP [PokeCommunity.com] Where to begin a Pokémon fan game in RMXP](https://i54.tinypic.com/2r5vlmr.png)
Layer 1: This is the layer you would put things such as your short grass on, the very base of your map.
Layer 2: Here you would put things like rocks, tall grass, trees and so on.
Layer 3: Usually you would put things such as buildings and lamp posts on.
Layer 4: This is where you would add you events, but because events go on the fourth layer, it doesn't mean they run above all the tiles, they work with how you set up the tile movement permissions and so on, which again, I will explain later on.
Draw
![[PokeCommunity.com] Where to begin a Pokémon fan game in RMXP [PokeCommunity.com] Where to begin a Pokémon fan game in RMXP](https://i54.tinypic.com/2z6dmqt.png)
The following options relate to mapping.
Pencil: The pencil allows you to put down a tile one by one. Each tile is one block, and the pencil fills up one block.
Rectangle: The rectangle allows you to drag a group of tiles or one tile across many blocks. This is handy when you're making a lot of grass in one area, or working with groups of trees.
Ellipse: This makes a group of tiles in an oval or circular shape, it serves the same purpose as the rectangle but in a different shape.
Flood Fill: This is like a paint bucket in Paint, Photoshop, Gimp and so on. It will fill an area with the same tile, this is useful when laying down short grass on the first layer for example.
Select: This is again, like the selection tool in image editing software. This will allow you to select a group of tiles and allow you to copy, cut or delete them, from where you may paste them else where (if copied or cut).
Scale
![[PokeCommunity.com] Where to begin a Pokémon fan game in RMXP [PokeCommunity.com] Where to begin a Pokémon fan game in RMXP](https://i51.tinypic.com/25f7hw9.png)
1: 1 This scales tiles to their normal size in the map editor, but this does not change anything in game, nor do the proceeding options.
1: 2 This halves the size of the tiles for mapping (which I have currently done in the screenshot above).
1: 4 This will scale your tiles to a quarter of their original size
Note - In RMXP, all images have to be scaled up to double their size to work. I will teach you to do this later. But don't worry, I will also show you how to make them their original size in game, later in this tutorial.
Tools
![[PokeCommunity.com] Where to begin a Pokémon fan game in RMXP [PokeCommunity.com] Where to begin a Pokémon fan game in RMXP](https://i52.tinypic.com/1ev2xc.png)
Database: This is a quick link to the database which was explained earlier in the tutorial.
Materialbase: From here you can load in graphics from folders. This should be done for images if they aren't appearing for you at times. Or if you change the file name of your tilesets for example, and wish to load the newly named file for your created tileset in the database.
Script Editor: This is a quick link to the Script Editor which I explained earlier also.
Sound Test: This allows you to test your sound files found in the audio folder of your project folder.
Options: This allows you to change the transparent colour on your tileset on the left, which is a matter of personal preference, in the lower screenshot you will see how I've change the transparent colour to a bright blue. You can also activate a grid for you mapping if you wish to use one.
Game
![[PokeCommunity.com] Where to begin a Pokémon fan game in RMXP [PokeCommunity.com] Where to begin a Pokémon fan game in RMXP](https://i56.tinypic.com/f53dj9.png)
Play Test: This is where you can test your game in debug mode. It skips the intro and goes straight to the New Game/Continue menu.
Change Title: This is where you can change the title of your game.
Change RTP: This is your Run Time Package. If you choose to select them, you will get some stock images from RMXP in some of your folders. For example, if you choose Standard on your first selection, you will get some extra "fogs" in your fog folder. I will explain what those are later in the tutorial.
Help
![[PokeCommunity.com] Where to begin a Pokémon fan game in RMXP [PokeCommunity.com] Where to begin a Pokémon fan game in RMXP](https://i53.tinypic.com/7313x0.png)
This is pretty straight forward. If you ever get stuck, refer to the manual in the help menu. It has a lot of useful information for using RMXP.
[a id]B[/a id]
Which starter kit should I use?
The various Pokémon starter kits out there
There aren't too many choices for RMXP starter kits, however there is only one starter kit which is close to being finished really. Below will be links to their threads and my personal comments underneath.
Pokemon Essentials: Starter Kit for RPG Maker XP
Created by Poccil with help from Flameguru, now run by Maruno
This is the most complete version of any starter kit for RMXP. There are some bugs, and it's quite old so it doesn't have very updated graphics or scripts that you would normally see in generation four or five. But it is my recommendation, as it is the closest thing we have to a complete kit. Might I also recommend checking out this thread if you wish to use the starter kit: (broken link removed) Members within the community are working on improving the kit.
Cng's Pokemon HGSS Kit
Created by Crazyninjaguy
This is a promising kit, however it is still in its early development stages. This is a more updated starter kit, based on HGSS. However it lacks a lot of what the Essentials engine has. However, if you wish to use a more stripped down engine, and think you could handle doing some coding yourself, this might be a good choice. It is still being worked on, so if you're patient, you'll see further releases.
Pokemon Essentials DS
Edited version of Pokémon Essentials led by Venom12
This is a dual screen version of Pokémon Essentials, which boasts some features from the DS era. However it is also still in its development era and has some bug issues which yet have to be ironed out.
My personal recommendation is to go with Pokémon Essentials right now. It is being edited by members of the community and is now a much stronger kit than it was this time last year. It is frequently being worked on, and if you don't mind updating a lot of graphics to make your game look a little more modern, then it should be good for you.
[a id]C[/a id]
How to import and use a starter kit
My example will be using Pokémon Essentials, I will show you how to get started with your new kit. And let me add a note that I changed the layout of my computer so it looks a little different from the last screenshots :]Once you have your kit downloaded paste your new starter kit into your project folder. By default it is put in your RPGXP folder in Documents. But you may choose to put this folder where it best suits you. Below I have downloaded a starter kit and I will show you what I have so far.
![[PokeCommunity.com] Where to begin a Pokémon fan game in RMXP [PokeCommunity.com] Where to begin a Pokémon fan game in RMXP](https://i56.tinypic.com/3586muu.png)
When your starter kit is in here, it means that you now have access to it through RMXP and can start using it!
Next all you need to do is open it up. So go to RMXP, go to Open, and locate the starter kit folder, in there you should find a file, so go ahead and open it. Congrats, you have got your first starter kit up and running. From here, you should use it as a base for your own game. Look below for a screenshot to see what kind of file you should be opening.
![[PokeCommunity.com] Where to begin a Pokémon fan game in RMXP [PokeCommunity.com] Where to begin a Pokémon fan game in RMXP](https://i51.tinypic.com/23ve45f.png)
[a id]D[/a id]
How to change/update graphics in your project
Changing up the stock images to your own ones.What you will need
An image editing software (Photoshop, Gimp, these will work best, or Paint etc.)
The image you will be replacing the old one with
Your starter kit
Next up is the section where I'll be showing you guys how I change graphics in RMXP. There is more than one way to do this. But I will show what I think is the easiest way. I need to teach you a few things here which will also prop up in another area. The first thing I need to teach you is how to make images in RMXP size. This is important.
!IMPORTANT
RMXP uses images which are double their normal size. You will be working with pixel art, so you need to make sure that the images don't go all "fuzzy" when up sizing. I will be showing you with Photoshop, but this should be the same in most programs, if not, only slightly different.
First of all, open up your image in your image editing software, and go to Image > Image Size. From here you will be changing the option which says "Pixels", to "percentage". You need to make the percentage for both height and width 200. This will double the size of the image. However, you need to also choose "Nearest Neighbor" from the drop down menu on this screen, it will be the lowest drop down menu. Paint should scale pixel art without making them fuzzy so don't worry. Below is a screenshot of my setting in photoshop.
![[PokeCommunity.com] Where to begin a Pokémon fan game in RMXP [PokeCommunity.com] Where to begin a Pokémon fan game in RMXP](https://i52.tinypic.com/152jk0i.png)
Once you have done this, you are ready to replace and insert your image. You will find all the current images in the starter kit within the graphics folder. The one I am replacing is the enemy HP box as an example. This particular image is in Graphics > Pictures and is named "singleEnemyBox.png". Be sure that the image you are replacing the old one with carries the same file name. Here is a screenshot of my example.
![[PokeCommunity.com] Where to begin a Pokémon fan game in RMXP [PokeCommunity.com] Where to begin a Pokémon fan game in RMXP](https://i52.tinypic.com/2q1uzix.png)
And it's as simple as that, you have now replaced a graphic and inserted a new image. However you may need to reposition some sprites to comply with your new image through scripting or through the Editor (I will show you this a little later also).
[a id]E[/a id]
A quick introduction to mapping
I have already spoken about how the different tools for mapping work earlier in this tutorial. So from here I am going to show you what these tools look like when you put them into practice. Just promise me you guys wont slaughter me for the quick map.![[PokeCommunity.com] Where to begin a Pokémon fan game in RMXP [PokeCommunity.com] Where to begin a Pokémon fan game in RMXP](https://i55.tinypic.com/zx33ms.gif)
1st image: I began by using the paint bucket tool to put down the grass on the first layer. This is usually the way you would start doing your maps, by putting the floor tile on the first layer.
2nd image: I then used the marquee tool to add trees by putting the bottom of the trees on the second layer and the tops of the trees on the third layer, but this depends on your type of tree and how they relate to the map you are working on.
3rd image: In the third image I decided to use the pencil tool to place the buildings on the third layer. This is when the pencil tool can come in handy. But remember that you can select more than one tile at once and place them down.
4th image: Here I combined the above techniques and used them to finish the map.
Tips to get good at mapping: What you need to do when making a map is to plan out what you are going to do first. You could do this on paper or even a quick mock up in paint. But try and making an interesting and detailed design which is not too open or too square. The thing I always advise to people is to look at maps made by either GameFreak (sometimes these can be too square for games without 3D however) or maps made my mappers and game developers that they admire. Let them inspire you, but do not try and replicate.
[a id]F[/a id]
A quick introduction to eventing
As stated before, eventing is making all the little events that happen in your game such as dialog, people walking, battles, making images appear on a map and so on. I am not going to go through every aspect of eventing as I do not want any heads exploding, however I shall run you through some important aspects and frequently asked questions. This is something that will take practice and experimentation. ![[PokeCommunity.com] Where to begin a Pokémon fan game in RMXP [PokeCommunity.com] Where to begin a Pokémon fan game in RMXP](https://i40.tinypic.com/24vt9w1.png)
![[PokeCommunity.com] Where to begin a Pokémon fan game in RMXP [PokeCommunity.com] Where to begin a Pokémon fan game in RMXP](https://www.gdunlimited.net/media/uploads/tutorials/everything-you-need-to-know-about-the-even-editor/layout.jpg)
Options: Settings for character animation, passage etc.
1. Move Animation - Options
Turns on the walking etc. animation when an event is moving.
2. Stop Animation - Options
Turns on the stepping etc. animation when an event has stopped moving. If this box was checked on the following event, thief03's walk down animation would keep playing.
3. Direction Fix - Options
Makes it impossible to change a character's direction. This can be used, for example, if a character was stepping backwards.
4. Through - Options
Makes it possible to step through an impassible tile or character.
5. Always on Top - Options
Makes the display priority higher than any other tile or character.
Trigger: Conditions to set off an event and start running its contents/commands.
6. Action Button - Trigger
Runs the commands when the player and event are touching, and the confirm button, the C button, is pressed.
7. Player Touch - Trigger
Runs the Event Commands when the player touches the event, via the directional buttons.
8. Event Touch - Trigger
Runs the Event Commands when the event touches the player.
9. Autorun - Trigger
Runs the Event Commands when the event appears. This is not used as often as Parallel Process because it can cause the game to stop running because it is constantly running the event commands, so it must be used correctly.
10. Parallel Process - Trigger
Runs the Event Commands cyclically while the event has appeared. Parallel handling is a special setting that allows events to run alongside other events.
11. Graphic
This is where you set the events graphic. Whether the player can pass through the event is determined by graphic type as follows:
None: Passable
Tile: Used the tilset's default passage settings.
Character: Impassable
As a rule, two events may not overlap in the same position. When two events overlap, one must be set to [Through]
Autonomous Movement: Settings for an events autonomous movement. Not controlled by any other event, this setting makes the event move freely without prompting.
12. Type - Autonomous Movement
Type of autonomous movement.
The options here all move according to the speed and frequency you set.
The options are the following:
Fixed: Do not move from the position in which it was placed.
Random: Moves passable tiles around freely, and in random directions.
Approach: Move towards the players current position.
Custom: Moves along a specialized route.
13. Speed - Autonomous Movement
The speed of a moving event. The players default speed is 4: fast.
14. Freq - Autonomous Movement
Frequency of autonomous movement. The higher the frequency, the short the move cycle. To make an event move without stopping, you would set this to 6:Highest.
Conditions: Specifies in what condition an event will spawn on the map in-game. Events will spawn as long as all conditions specified here are being met. If no conditions are set, events will spawn unconditionally. If there are multiple event pages meeting conditions, the contents will run in order from lower to higher numbered page.
15. Self Switch - Conditions
Sets as a condition the specified self switch as being on. Self switches are special switches attached to individual events. This means if you want to make an even do something different, you do not have to use ordinary switches. If the self switch box was turned on for this event, when the event is loaded in the game, it will have loaded the second page, or the page without the self switch turned on, because the self switch must first be turned on. You can use a total of 4 self switches within one event. They are named: A, B, C and D.
16. Or above - Conditions
This is option is associated with the option above it, which is described below.
This option sets as a condition the specified condition being at or above a given value.
17. Variable - Conditions
Sets as a condition the specified variable being at or above a given value.
18. Switch - Conditions
Sets as a condition the specified switch being ON. The switch remains as being ON or OFF during the game. If you use both switch conditions, then both of the specified switches must be turned on for the event, or page(Depending on how many you have) to spawn or appear.
19. List of Event Commands
Event commands to be run for this event. Right click for a pop-up menu to appear, there you can select all the commands for the even. These will be explained in another tutorial.
20. New Event Page
Creates a new consecutively numbered page after the selected page. If you have more than one page, usually you set a condition on the second one, as described above.
21. Copy Event Page
Copies the contents of the selected page to clipboard.
22. Paste Event Page
Pastes the contents of the clipboard into a new page.
23. Delete Event Page
Deletes the selected page.
24. Clear Event Page
Clears the selected pages contents.
25. 2
This is the tab of a second page, it is numbered 2.
26. Name
The event name. Used only in the Editor for convenience. When using commands like Set Move Route, this is useful because you can see which event to select.
And that clears up the event page. But there is more to it than just this, there are the actual commands to worry about but these things are fairly straight forward. However, if you do have questions on them please do feel free to ask in the thread. There are a lot of buttons and such for events that you may worry about and be confused by.
[a id]G[/a id]
A quick introduction to scripting
I need to heavily credit RMXP Unlimited for this part of the tutorial but here are the basics that you will need to know for scripting.
Spoiler:
1. What is Ruby?
*From RubyCentral:
2. History of Ruby
*From RubyCentral:
An Object-Oriented language -- Known as OO -- is a language in which everything you manipulate is known as an "Object".
(Notes: A "language" is the collection of syntax, terms, rules and structure that is used to create a program. C++, Java and Ruby are all different "languages".)
Every OO languages have at least one similarity, which is that they are OO languages; the basic structure in which they operate is the same. An OO language concist of the following main components/functions:
-Class
-Methods
-Messages
-Arguments
-Variables/Constants
Explanation of the diagram:
- A class contains variables and methods definitions.
- A method contains variables definitions and code.
- A message may contains arguments.
- An object is an instance of a class.
- An object communicate via Messages and Arguments.
Example of Object Instances:
Let's see a class as a car factory, and an object as the cars themselves. The car factory contains all the necessary "functions" to built a car, and each car is viewed as differents instance of the same thing. Those car "instances" are then different objects, and can be modified without affecting the other car objects. When the car company need another car, they can simply ask their factory to built a new one; once a factory (a class) is built, it saves time as you don't have to manually re-do each car (object).
Example of Communication & Object Properties:
When you want to access a properties of an object, you need to send a message to it, so it will be able to give you an answer -- And when you want to change an object properties, you need to send a message too, so it can be modified. In RPG Maker XP, an hero have many properties; such as "Name", "HP" and "Level". When you open the main menu in your game, you can see those properties (Level, Name and HP) on the screen. In the background, what RPG Maker XP did is to send a message to the Hero object asking for information about its properties.
A method actually defines what messages an object will be able to receive, and what will happen when it receives it. In this sense, an object is linked to it's creator (the class) as each time a message is send or sent from and to the object, the relevant method in that class is executed.
Back to our Hero example: This means that the class defining an Hero in RPG Maker XP has a method for every message you can send to its objects instances. Meaning that you will found a method called "name" in there; this method will define what will happen when that message is sent/received.
4. What is RGSS?
RGSS means "Ruby Game Scripting System". RGSS uses Ruby as it's language, so if you know Ruby, you also know RGSS. The difference between Ruby and RGSS that are important to you to know is that RGSS should be seen as a "Scripting" language that uses already maded components. In Ruby only, if you want to show a picture on screen, you cannot just use the same syntax you used in RPG Maker XP RGSS, you would have to code all that function from the ground up.
Example of RGSS code to show a picture (More infos on that later on.):
image = Sprite.new
image.bitmap = RPG::Cache.picture(name of picture)So, basically, you need 2 lines to show a picture on screen; because you are using a class named "Sprite" already programmed inside RPG Maker XP (Not available in the Script Editor.) And you are also using a module "RPG" also not found in the Script Editor. This all makes your works easier and faster to code your game.
But since RGSS uses Ruby, and that RPG Maker XP uses Ruby (Version 1.8.1), you can code a full new "Sprite" class and use it, or even add functions in it.
So, all this means that RGSS is fairly less complicated than Ruby, because the low-level operation are handled by RPG maker XP, you don't have to code them.
(Note: low-level operation means the thing you would need to code to show a picture, talk to the machine (to Windows) to read a file, display a file, etc.)
5. The RPG Maker XP Script Editor
RPG Maker XP comes with a Script Editor built-in to allow you to edit/add what we call "Scripts". Those scripts are actually RGSS code (Using the Ruby Syntax and power) that allow you to add or modify features in RPG Maker XP. When you open the Script Editor, you can see that many "Script" are already in there; those are the default scripts that make a default game run; as the Heros we talked earlier in section 3. The way Enterbrain classified the scripts is by "Class". Every class is in its own page (Although you can mix many class in the same page.)
To open the script editor, you can press F11, use the Tool Menu and choose "Script Editor" or use the toolbar icon.
What I mean by "Real class name" is that the name you give to a page (The "Page Name" section, to the bottom left of the window) has nothing to do with the class name, it's just the name of the script. It can be anything, it doesn't have to be the class name, since as I said earlier, you can add many different class in the same page.
Color Code:
The following color code is used when editing your scripts, take note that this color convention is almost the same as for Ruby Programming. (Some color tag were discarded...)
Blue:
Blue represent the code syntax, as def, class, end, when, if, case, etc.
Red:
Red represent numbers in your code. As 1, 2, 3 and 5.
Light Blue:
The lighter blue represents operators and operands in your code. As =, ||, + and *.
Green
The color green represent your comments. Comments are ignored from your code, it's like your note about what you are doing and what the code does.
Purple
Purple represent text (string) elements in your code, along side with the directory symbol of Ruby.
Script Editor Features:
The script editor of RPG Maker XP come with some basic features, as Search, Replace and Go To Line. Here's a list of those options.
Code View Features:
(Right-Click in the Code View window to see all the features)
-> The basic Cut/Copy/Paste/Undo from Windows are available.
-> Find (Control+F)
-> Replace (Control + H)
-> Go To Line (Control + G)
-> Zoom IN/OUT with Control+Mouse Wheel
Page List Features:
(Right-Click in the Page list View window to see all the features)
-> The basic Copy/Paste/Cut from Windows are available
-> Add a page (Insert)
-> Delete a page (Delete)
-> Find (Control + F)
There are also some small options in the "Page Name" section, to the bottom left of the window, that allow you to set the text alignment and use unicode characters; this is probably there because RPG Maker XP is a japanese product.
6. Vocabulary and Syntax
Now comes the time to dig up some code, very basic one, in order to show the primary syntaxes and terms you will uses in almost all your scripts. Let's begin by a simple program that upon execution, will simply print on screen the word "I am therefore I'm coded.". (I'm sorry to break the rule of the "Hello World" convention, but we needed a change !
class Say_Something
def initialize
print "I am therefore I'm coded"
end
end
Create a new page with the script editor, and copy/paste that code in it. Remember, you can name the page whatever you desire, but it is recommended to name it wisely. (Choose a name that represent the script functions. In this case, you could call it Say Something...)
Now, if we want to test that out, we need to create an event on your map that will execute that class. In this event, choose a "Call Script" command (the last option on the last page), and write this in it:
Say_Something.newAnd test play your game, go talk to that event, and a window will pop-up saying "I am therefore I'm coded.".
So here's the explanation for this (line by line):
1 class Say_Something
2
3 def initialize
4 print "I am therefore I'm coded"
5 end
6
7 endLine 1: We defined a new class named "Say_Something".
Line 3: We defined a new method named "Initialize".
Line 4: We added the code to be executed when the method "initialize" is called.
Line 5: We close our method "initialize" with the "END" keyword.
Line 7: We close our class "Say_Something" with the "END" keyword.
The method "initialize" is a default method that is executed when you use the .new syntax, as you did in your event's Call Script. So, when you said in your call script the sentence "Say_Something.new" you told RPG Maker XP to create an instance of Say_Something with the message "new"; which executed the "initialize" method.
You also saw that everything that is "defined" most be closed, with the END keyword. This applies to a lot of things in Ruby, and this is why it's a good idea to always indent your code. (See example of indentation below).
As you can see, we could called each syntaxed that need to be closed as "segments" of code. You can clearly see when each should start and end if your code is well indented.
But we said earlier that everything was an object, and we did not seem to see any "object" while doing our "Say Something" example. Fact is you actually did an object, but it died. You could have written the following in your call script, and everything would have worked fine:
my_object = Say_Something.newThis would have the same effect, here we see that we created a new object named "my_object" that should be of class "Say_Something". Of course, since our class does nothing except displaying a message, it's kind of useless to specify an object name.
Let's tweak our "Say_Something" class so we can use objects in a better way, and you will also be introduced to "Arguments". Replace the code in "Say_Something" by the following code:
class Say_Something
attr_accessor :greeting
attr_accessor :name
def initialize(greeting, name)
@greeting=greeting
@name=name
end
def say
print @greeting + " " + @name
end
endThen, in your event, edit the Call Script you previously did (right-click and choose Edit or press the spacebar.) And replace it's content by this one:
(I made extra line break to better classify the structure of what we do.)
message1=Say_Something.new("Hello", "Alex")
message2=Say_Something.new("Hello", "Peter")
print message1.name
print message2.name
message1.say
message2.say Now go test play your game, go talk to that event, you will see 4 pop-up window displaying in turns the element you asked for. The first window will display the name given to the object "message1", the second window will do the same for "message2". Then, 2 other window will pop-up executing the message "say" that we told. "say" is a method in our class "Say_Something".
This means that you just created 2 objects, "message1" and "message2", which are now 2 instances of "Say_Something", that can be modified without altering the other.
Let's explain that code, line by line, once again:
01 class Say_Something
02
03 attr_accessor :greeting
04 attr_accessor :name
05
06 def initialize(greeting, name)
07 @greeting=greeting
08 @name=name
09 end
10
11 def say
12 print @greeting + " " + @name
13 end
14
15 end Line 1: We defined a new class named "Say_Something".
Line 3: We defined an ATTR value, which stand for Attribute. Ruby is powerful in the sense that we can simply use the ATTR_ACCESSOR syntax to define a new attribute that will be readable and writable for every objects instance created by "Say_Something". So our first ATTR is named "greeting".
Line 4: We defined another ATTR named "name".
Line 6: We defined a new method named "initialize". As we said earlier, the initialize method is the method that is executed first when an object is created by the class. So we added the "Argument Receiver" that this method will be able to receive. In our case, those "argument" (or attribute) are "greeting" and "name". We put those argument receiver between paranthesis aside the method name. Take note that those "Argument Receiver" are "recipients"; by that I mean that the name you used between the paranthesis are variable names; which you have to use later on for it to have a purpose.
Line 7: Here we defined a new "Instance Variable" that will hold the data sent within "greeting". An instance variable always begins with an @ and is useable in every method of the same class, and most be defined in a method. By doing this, we told RPG Maker XP to take the recipient "greeting" and put it inside of "@greeting" to allow us to use it in another method.
Line 8: We do the same as on line 7, but with the "name" attribute.
Line 9: We close our method "initialize" with the END keyword.
Line 11: We defined a new method called "say".
Line 12: We coded what should happen when an object receives a message "say". In our case, we print the content of "@greeting", plus an empty space, plus the content of "@name".
Line 13: We close our method "say" with the END keyword.
Line 15: We close our class "Say_Something" with the END keyword.
Now let's explain the code of the Call Script, line by line, once again:
1 message1=Say_Something.new("Hello", "Alex")
2 message2=Say_Something.new("Hello", "Peter")
3
4 print message1.name
5 print message2.name
6
7 message1.say
8 message2.say Line 1: We create a new object called "message1" that will be an instance of "Say_Something". Which means that everything we can do with that object is defined in our class "Say_Something". Since we added "Argument Receiver" in our "initialize" method in "Say_Something", we need to send those argument, or RPG Maker XP will close asking for them. To send an argument to a class, it work the same way as for setting them, you list them in between parentheses aside the class name.
Line 2: We do the same to create another object named "message2".
Line 4: We use the Ruby command "print" to display the name stored in our object "message1". As you can see, it's simple, you can access objects attributes (properties) by using the name you defined in the ATTR of your class.
Line 5: We do the same for "message2".
Line 7: We now send a message to our object "message1", that message is "say". You can called that a "command" to, if you wish. So, you told "message1" to execute it's function "say"; then "message1" searched in it's class "Say_Something" to see if that command is defined... And it was, so our object returned the actions defined in the class; which is to print something on screen.
Line 8: We do the same for "message2".
*From RubyCentral:
Ruby is a an exciting new, pure, object oriented programming language. While few people in the West have heard of Ruby yet, it has taken off like wildfire in Japan---already overtaking the Python language in popularity.
What makes Ruby so popular? Ruby weaves the best features of the best programming languages into a seamless, concise whole. Ruby is:
Powerful -- Ruby combines the pure object-oriented power of the classic OO language Smalltalk with the expressiveness and convenience of a scripting language such as Perl. Ruby programs are compact, yet very readable and maintainable; you can get a lot done in a few lines, without being cryptic.
Simple -- The syntax and semantics are intuitive and very clean. There aren't any "special cases" you have to remember. For instance, integers, classes, and nil are all objects, just like everything else. Once you learn the basics, it's easy to guess how to do new things---and guess correctly.
Transparent -- Ruby frees you from the drudgery of spoon-feeding the compiler. More than any other language we've worked with, Ruby stays out of your way, so you can concentrate on solving the problem at hand.
Available -- Ruby is open source and freely available for both development and deployment. Unlike some other new languages, Ruby does not restrict you to a single platform or vendor. You can run Ruby under Unix or Linux, Microsoft Windows, or specialized systems such as BeOS and others.
Most of all, Ruby puts the fun back into programming. When was the last time you had fun writing a program---a program that worked the first time; a program that you could read next week, next month, or next year and still understand exactly what it does? We find Ruby to be a breath of fresh air in the dense, often hectic world of programming. In fact, we see nothing but smiles after we present Ruby to programmers.
[...]
Ruby is a genuine object-oriented language. Everything you manipulate is an object, and the results of those manipulations are themselves objects
[...]
Like Perl, Ruby is good at text processing. Like Smalltalk, everything in Ruby is an object, and Ruby has blocks, iterators, meta-classes and other good stuff.
You can use Ruby to write servers, experiment with prototypes, and for everyday programming tasks. As a fully-integrated object-oriented language, Ruby scales well.
Ruby features:
Simple syntax,
Basic OO features (classes, methods, objects, and so on),
Special OO features (Mix-ins, singleton methods, renaming, ...),
Operator overloading,
Exception handling,
Iterators and closures,
Garbage collection,
Dynamic loading (depending on the architecture),
High transportability (runs on various Unices, Windows, DOS, OSX, OS/2, Amiga, and so on)
So, as you can see, Ruby is an Object Oriented Language; more details about what is an Object Oriented Language will follow. The fact that Ruby is open source allow you to freely download the tools to create Ruby programs from any website. CLICK HERE to see the available download on the official Ruby website. What makes Ruby so popular? Ruby weaves the best features of the best programming languages into a seamless, concise whole. Ruby is:
Powerful -- Ruby combines the pure object-oriented power of the classic OO language Smalltalk with the expressiveness and convenience of a scripting language such as Perl. Ruby programs are compact, yet very readable and maintainable; you can get a lot done in a few lines, without being cryptic.
Simple -- The syntax and semantics are intuitive and very clean. There aren't any "special cases" you have to remember. For instance, integers, classes, and nil are all objects, just like everything else. Once you learn the basics, it's easy to guess how to do new things---and guess correctly.
Transparent -- Ruby frees you from the drudgery of spoon-feeding the compiler. More than any other language we've worked with, Ruby stays out of your way, so you can concentrate on solving the problem at hand.
Available -- Ruby is open source and freely available for both development and deployment. Unlike some other new languages, Ruby does not restrict you to a single platform or vendor. You can run Ruby under Unix or Linux, Microsoft Windows, or specialized systems such as BeOS and others.
Most of all, Ruby puts the fun back into programming. When was the last time you had fun writing a program---a program that worked the first time; a program that you could read next week, next month, or next year and still understand exactly what it does? We find Ruby to be a breath of fresh air in the dense, often hectic world of programming. In fact, we see nothing but smiles after we present Ruby to programmers.
[...]
Ruby is a genuine object-oriented language. Everything you manipulate is an object, and the results of those manipulations are themselves objects
[...]
Like Perl, Ruby is good at text processing. Like Smalltalk, everything in Ruby is an object, and Ruby has blocks, iterators, meta-classes and other good stuff.
You can use Ruby to write servers, experiment with prototypes, and for everyday programming tasks. As a fully-integrated object-oriented language, Ruby scales well.
Ruby features:
Simple syntax,
Basic OO features (classes, methods, objects, and so on),
Special OO features (Mix-ins, singleton methods, renaming, ...),
Operator overloading,
Exception handling,
Iterators and closures,
Garbage collection,
Dynamic loading (depending on the architecture),
High transportability (runs on various Unices, Windows, DOS, OSX, OS/2, Amiga, and so on)
2. History of Ruby
*From RubyCentral:
Ruby was created by Yukihiro Matsumoto (who goes by the handle "matz")
Influenced by Perl, Matz wanted to use a jewel name for his new language, so he named Ruby after a colleague's birthstone.
Later, he realized that Ruby comes right after Perl in several situations. In birthstones, pearl is June, ruby is July. When measuring font sizes, pearl is 5pt, ruby is 5.5pt. He thought Ruby was a good name for a programming language newer (and hopefully better) than Perl.
[...]
The following are quotes from Matz Post on Ruby Talk:
"Well, Ruby was born on February 24, 1993. I was talking with my colleague about the possibility of an object-oriented scripting language. I knew Perl (Perl4, not Perl5), but I didn't like it really, because it had smell of toy language (it still has). the object-oriented scripting language seemed very promising."
"I knew Python then. But I didn't like it, because I didn't think it was a true object-oriented language---OO features appeared to be add-on to the language. As a language manic and OO fan for 15 years, I really wanted a genuine object-oriented, easy-to-use scripting language. I looked for, but couldn't find one."
"So, I decided to make it. It took several months to make the interpreter run. I put it the features I love to have in my language, such as iterators, exception handling, garbage collection."
"Then, I reorganized the features of Perl into a class library, and implemented them. I posted Ruby 0.95 to the Japanese domestic newsgroups in Dec. 1995."
"Since then, highly active mailing lists have been established and web pages formed."
3. What is "Object Orientated" or OO?Influenced by Perl, Matz wanted to use a jewel name for his new language, so he named Ruby after a colleague's birthstone.
Later, he realized that Ruby comes right after Perl in several situations. In birthstones, pearl is June, ruby is July. When measuring font sizes, pearl is 5pt, ruby is 5.5pt. He thought Ruby was a good name for a programming language newer (and hopefully better) than Perl.
[...]
The following are quotes from Matz Post on Ruby Talk:
"Well, Ruby was born on February 24, 1993. I was talking with my colleague about the possibility of an object-oriented scripting language. I knew Perl (Perl4, not Perl5), but I didn't like it really, because it had smell of toy language (it still has). the object-oriented scripting language seemed very promising."
"I knew Python then. But I didn't like it, because I didn't think it was a true object-oriented language---OO features appeared to be add-on to the language. As a language manic and OO fan for 15 years, I really wanted a genuine object-oriented, easy-to-use scripting language. I looked for, but couldn't find one."
"So, I decided to make it. It took several months to make the interpreter run. I put it the features I love to have in my language, such as iterators, exception handling, garbage collection."
"Then, I reorganized the features of Perl into a class library, and implemented them. I posted Ruby 0.95 to the Japanese domestic newsgroups in Dec. 1995."
"Since then, highly active mailing lists have been established and web pages formed."
An Object-Oriented language -- Known as OO -- is a language in which everything you manipulate is known as an "Object".
(Notes: A "language" is the collection of syntax, terms, rules and structure that is used to create a program. C++, Java and Ruby are all different "languages".)
Every OO languages have at least one similarity, which is that they are OO languages; the basic structure in which they operate is the same. An OO language concist of the following main components/functions:
-Class
-Methods
-Messages
-Arguments
-Variables/Constants
Explanation of the diagram:
- A class contains variables and methods definitions.
- A method contains variables definitions and code.
- A message may contains arguments.
- An object is an instance of a class.
- An object communicate via Messages and Arguments.
Example of Object Instances:
Let's see a class as a car factory, and an object as the cars themselves. The car factory contains all the necessary "functions" to built a car, and each car is viewed as differents instance of the same thing. Those car "instances" are then different objects, and can be modified without affecting the other car objects. When the car company need another car, they can simply ask their factory to built a new one; once a factory (a class) is built, it saves time as you don't have to manually re-do each car (object).
Example of Communication & Object Properties:
When you want to access a properties of an object, you need to send a message to it, so it will be able to give you an answer -- And when you want to change an object properties, you need to send a message too, so it can be modified. In RPG Maker XP, an hero have many properties; such as "Name", "HP" and "Level". When you open the main menu in your game, you can see those properties (Level, Name and HP) on the screen. In the background, what RPG Maker XP did is to send a message to the Hero object asking for information about its properties.
A method actually defines what messages an object will be able to receive, and what will happen when it receives it. In this sense, an object is linked to it's creator (the class) as each time a message is send or sent from and to the object, the relevant method in that class is executed.
Back to our Hero example: This means that the class defining an Hero in RPG Maker XP has a method for every message you can send to its objects instances. Meaning that you will found a method called "name" in there; this method will define what will happen when that message is sent/received.
4. What is RGSS?
RGSS means "Ruby Game Scripting System". RGSS uses Ruby as it's language, so if you know Ruby, you also know RGSS. The difference between Ruby and RGSS that are important to you to know is that RGSS should be seen as a "Scripting" language that uses already maded components. In Ruby only, if you want to show a picture on screen, you cannot just use the same syntax you used in RPG Maker XP RGSS, you would have to code all that function from the ground up.
Example of RGSS code to show a picture (More infos on that later on.):
image = Sprite.new
image.bitmap = RPG::Cache.picture(name of picture)So, basically, you need 2 lines to show a picture on screen; because you are using a class named "Sprite" already programmed inside RPG Maker XP (Not available in the Script Editor.) And you are also using a module "RPG" also not found in the Script Editor. This all makes your works easier and faster to code your game.
But since RGSS uses Ruby, and that RPG Maker XP uses Ruby (Version 1.8.1), you can code a full new "Sprite" class and use it, or even add functions in it.
So, all this means that RGSS is fairly less complicated than Ruby, because the low-level operation are handled by RPG maker XP, you don't have to code them.
(Note: low-level operation means the thing you would need to code to show a picture, talk to the machine (to Windows) to read a file, display a file, etc.)
5. The RPG Maker XP Script Editor
RPG Maker XP comes with a Script Editor built-in to allow you to edit/add what we call "Scripts". Those scripts are actually RGSS code (Using the Ruby Syntax and power) that allow you to add or modify features in RPG Maker XP. When you open the Script Editor, you can see that many "Script" are already in there; those are the default scripts that make a default game run; as the Heros we talked earlier in section 3. The way Enterbrain classified the scripts is by "Class". Every class is in its own page (Although you can mix many class in the same page.)
To open the script editor, you can press F11, use the Tool Menu and choose "Script Editor" or use the toolbar icon.
What I mean by "Real class name" is that the name you give to a page (The "Page Name" section, to the bottom left of the window) has nothing to do with the class name, it's just the name of the script. It can be anything, it doesn't have to be the class name, since as I said earlier, you can add many different class in the same page.
Color Code:
The following color code is used when editing your scripts, take note that this color convention is almost the same as for Ruby Programming. (Some color tag were discarded...)
Blue:
Blue represent the code syntax, as def, class, end, when, if, case, etc.
Red:
Red represent numbers in your code. As 1, 2, 3 and 5.
Light Blue:
The lighter blue represents operators and operands in your code. As =, ||, + and *.
Green
The color green represent your comments. Comments are ignored from your code, it's like your note about what you are doing and what the code does.
Purple
Purple represent text (string) elements in your code, along side with the directory symbol of Ruby.
Script Editor Features:
The script editor of RPG Maker XP come with some basic features, as Search, Replace and Go To Line. Here's a list of those options.
Code View Features:
(Right-Click in the Code View window to see all the features)
-> The basic Cut/Copy/Paste/Undo from Windows are available.
-> Find (Control+F)
-> Replace (Control + H)
-> Go To Line (Control + G)
-> Zoom IN/OUT with Control+Mouse Wheel
Page List Features:
(Right-Click in the Page list View window to see all the features)
-> The basic Copy/Paste/Cut from Windows are available
-> Add a page (Insert)
-> Delete a page (Delete)
-> Find (Control + F)
There are also some small options in the "Page Name" section, to the bottom left of the window, that allow you to set the text alignment and use unicode characters; this is probably there because RPG Maker XP is a japanese product.
6. Vocabulary and Syntax
Now comes the time to dig up some code, very basic one, in order to show the primary syntaxes and terms you will uses in almost all your scripts. Let's begin by a simple program that upon execution, will simply print on screen the word "I am therefore I'm coded.". (I'm sorry to break the rule of the "Hello World" convention, but we needed a change !
class Say_Something
def initialize
print "I am therefore I'm coded"
end
end
Create a new page with the script editor, and copy/paste that code in it. Remember, you can name the page whatever you desire, but it is recommended to name it wisely. (Choose a name that represent the script functions. In this case, you could call it Say Something...)
Now, if we want to test that out, we need to create an event on your map that will execute that class. In this event, choose a "Call Script" command (the last option on the last page), and write this in it:
Say_Something.newAnd test play your game, go talk to that event, and a window will pop-up saying "I am therefore I'm coded.".
So here's the explanation for this (line by line):
1 class Say_Something
2
3 def initialize
4 print "I am therefore I'm coded"
5 end
6
7 endLine 1: We defined a new class named "Say_Something".
Line 3: We defined a new method named "Initialize".
Line 4: We added the code to be executed when the method "initialize" is called.
Line 5: We close our method "initialize" with the "END" keyword.
Line 7: We close our class "Say_Something" with the "END" keyword.
The method "initialize" is a default method that is executed when you use the .new syntax, as you did in your event's Call Script. So, when you said in your call script the sentence "Say_Something.new" you told RPG Maker XP to create an instance of Say_Something with the message "new"; which executed the "initialize" method.
You also saw that everything that is "defined" most be closed, with the END keyword. This applies to a lot of things in Ruby, and this is why it's a good idea to always indent your code. (See example of indentation below).
As you can see, we could called each syntaxed that need to be closed as "segments" of code. You can clearly see when each should start and end if your code is well indented.
But we said earlier that everything was an object, and we did not seem to see any "object" while doing our "Say Something" example. Fact is you actually did an object, but it died. You could have written the following in your call script, and everything would have worked fine:
my_object = Say_Something.newThis would have the same effect, here we see that we created a new object named "my_object" that should be of class "Say_Something". Of course, since our class does nothing except displaying a message, it's kind of useless to specify an object name.
Let's tweak our "Say_Something" class so we can use objects in a better way, and you will also be introduced to "Arguments". Replace the code in "Say_Something" by the following code:
class Say_Something
attr_accessor :greeting
attr_accessor :name
def initialize(greeting, name)
@greeting=greeting
@name=name
end
def say
print @greeting + " " + @name
end
endThen, in your event, edit the Call Script you previously did (right-click and choose Edit or press the spacebar.) And replace it's content by this one:
(I made extra line break to better classify the structure of what we do.)
message1=Say_Something.new("Hello", "Alex")
message2=Say_Something.new("Hello", "Peter")
print message1.name
print message2.name
message1.say
message2.say Now go test play your game, go talk to that event, you will see 4 pop-up window displaying in turns the element you asked for. The first window will display the name given to the object "message1", the second window will do the same for "message2". Then, 2 other window will pop-up executing the message "say" that we told. "say" is a method in our class "Say_Something".
This means that you just created 2 objects, "message1" and "message2", which are now 2 instances of "Say_Something", that can be modified without altering the other.
Let's explain that code, line by line, once again:
01 class Say_Something
02
03 attr_accessor :greeting
04 attr_accessor :name
05
06 def initialize(greeting, name)
07 @greeting=greeting
08 @name=name
09 end
10
11 def say
12 print @greeting + " " + @name
13 end
14
15 end Line 1: We defined a new class named "Say_Something".
Line 3: We defined an ATTR value, which stand for Attribute. Ruby is powerful in the sense that we can simply use the ATTR_ACCESSOR syntax to define a new attribute that will be readable and writable for every objects instance created by "Say_Something". So our first ATTR is named "greeting".
Line 4: We defined another ATTR named "name".
Line 6: We defined a new method named "initialize". As we said earlier, the initialize method is the method that is executed first when an object is created by the class. So we added the "Argument Receiver" that this method will be able to receive. In our case, those "argument" (or attribute) are "greeting" and "name". We put those argument receiver between paranthesis aside the method name. Take note that those "Argument Receiver" are "recipients"; by that I mean that the name you used between the paranthesis are variable names; which you have to use later on for it to have a purpose.
Line 7: Here we defined a new "Instance Variable" that will hold the data sent within "greeting". An instance variable always begins with an @ and is useable in every method of the same class, and most be defined in a method. By doing this, we told RPG Maker XP to take the recipient "greeting" and put it inside of "@greeting" to allow us to use it in another method.
Line 8: We do the same as on line 7, but with the "name" attribute.
Line 9: We close our method "initialize" with the END keyword.
Line 11: We defined a new method called "say".
Line 12: We coded what should happen when an object receives a message "say". In our case, we print the content of "@greeting", plus an empty space, plus the content of "@name".
Line 13: We close our method "say" with the END keyword.
Line 15: We close our class "Say_Something" with the END keyword.
Now let's explain the code of the Call Script, line by line, once again:
1 message1=Say_Something.new("Hello", "Alex")
2 message2=Say_Something.new("Hello", "Peter")
3
4 print message1.name
5 print message2.name
6
7 message1.say
8 message2.say Line 1: We create a new object called "message1" that will be an instance of "Say_Something". Which means that everything we can do with that object is defined in our class "Say_Something". Since we added "Argument Receiver" in our "initialize" method in "Say_Something", we need to send those argument, or RPG Maker XP will close asking for them. To send an argument to a class, it work the same way as for setting them, you list them in between parentheses aside the class name.
Line 2: We do the same to create another object named "message2".
Line 4: We use the Ruby command "print" to display the name stored in our object "message1". As you can see, it's simple, you can access objects attributes (properties) by using the name you defined in the ATTR of your class.
Line 5: We do the same for "message2".
Line 7: We now send a message to our object "message1", that message is "say". You can called that a "command" to, if you wish. So, you told "message1" to execute it's function "say"; then "message1" searched in it's class "Say_Something" to see if that command is defined... And it was, so our object returned the actions defined in the class; which is to print something on screen.
Line 8: We do the same for "message2".
Next I will show you how to change some simple scripts to help you with some important things.
Changing screen resolution
If you want to change your screen size, then do the following, this will change the screen size to your chosen value.
![[PokeCommunity.com] Where to begin a Pokémon fan game in RMXP [PokeCommunity.com] Where to begin a Pokémon fan game in RMXP](https://i53.tinypic.com/2hqz02e.png)
Here is where you can adjust the screen resolution, make sure that you make it double the size of what you actually want it to be. The lines highlighted are all you need to change.
[a id]H[/a id]
Final comments and advice
Firstly, I'd like to give you beginners some advice that I have learned in my time in game development. Try everything, don't be too reliant on a "team" or other people, try and be able to do as many things yourself as you can. Learn new skills, and get really really good at at least one of them. The better you are at certain things, the more others will like to help you. Next, worry about how fun your game is going to be, don't get too caught up with aesthetics. And remember, that so long as you make your game in one style, and it is consistent, you're well on your way to making a good game.Well guys, that's it for now, I hope this will help all you beginners. If you want me to add anything, please let me know and I will do my best to add a section. I would like to thank RMXP Unlimited, and Poccil for some information added to this thread.
Good luck with your games, and feel free to ask any questions regarding the tutorial or what you would like to see.
Gav
Last edited by a moderator: