The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Scripts & Tutorials
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

Scripts & Tutorials This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.


Advertise here

Reply
Click here to go to the first staff post in this thread.  
Thread Tools
  #1    
Old July 29th, 2011, 03:43 PM
abnegation's Avatar
abnegation
adventure
Community Supporter
 
Join Date: Apr 2009
Age: 21

Advertise here

Beginner's Guide

All you're going to need to know for beginning a Pokémon fan game.

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?

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

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


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


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

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


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

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


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

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

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

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

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

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

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.

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: The Pokémon Essentials Wiki. 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.

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.



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.



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.


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.



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 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.



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 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.



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 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:
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.
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?

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.


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.

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 Maruno; April 11th, 2013 at 02:49 PM. Reason: Fixed a couple of image links
Reply With Quote
  #2    
Old July 29th, 2011, 04:35 PM
Crimson5M's Avatar
Crimson5M
what
Community Supporter
 
Join Date: Feb 2011
Location: Scotland
Age: 18
Gender: Male
Nature: Quiet
Awesome tutorial, Gav. This could be extremely helpful for new game developers.

EDIT: Excluding the OP, I got first post :3
__________________

Because it should've won HotY.
Pear
Frodo Baggins
Twitter
Youtube
CBC
Reply With Quote
  #3    
Old July 29th, 2011, 04:46 PM
wolf's Avatar
wolf
 
Join Date: Sep 2008
This should be useful if I ever try out game making, good job with it! By the way, be sure to make the text color black for dark theme users, so that it's not white text on white. ;)
__________________
pc battle server • skype: awolffromspace
Reply With Quote
  #4    
Old July 29th, 2011, 05:49 PM
luxuriate's Avatar
luxuriate
Original Trainer
 
Join Date: Jun 2011
Location: New Mexico
Gender: Male
Nature: Quiet
Very useful! However, editor in me has to note a few minor errors:

4. Through - Options
Makes it impossible to step through an impassible tile or character.

(Possible, you mean?)

6. Action Button - Trigger
Runs the Even Commands
(I have a sharp eye O_O )
__________________
POKéMON
BRASS - BRONZE - COPPER
~~~

Reply With Quote
  #5    
Old July 29th, 2011, 06:32 PM
Impo's Avatar
Impo
Vital Spirit
Community Supporter
 
Join Date: Feb 2010
Location: Earth
Gender: Male
Nature: Relaxed
Yay!
Wonderful tutorial, great for beginners!

And the links are working now ;D !
__________________


...Let's play a game...
3DS FC: 3411-1566-9347
Paired to Naya Rivera & ShiningRaichu
Reply With Quote
  #6    
Old July 29th, 2011, 11:54 PM
Rossay's Avatar
Rossay
Quack quack
 
Join Date: Oct 2010
Location: Scotland
Age: 22
Gender: Male
Nature: Careful
A very clear and well-written tutorial. You have done a great service in writing this as it will hopefully reduce the number of incredibly poorly designed / made fan games.
__________________
Pokemon X - Friend code: 1435-4688-7520
- DeviantArt -


Reply With Quote
  #7    
Old July 30th, 2011, 04:40 PM
FL's Avatar
FL
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Best beginner's tutorial that I ever see! This need to be pinned!
Some important thing to put is that a average fangame generally delay at least a half-year, this isn't a thing that can be done for the night to day.
__________________
Reply With Quote
  #8    
Old August 4th, 2011, 02:51 PM
Cilerba
the hearts of lonely people
Community Supporter
 
Join Date: Feb 2010
Location: Massachusetts
Age: 17
Gender: Male
Nature: Quiet
Very helpful tutorial. This will definitely help Beginner's.

Moved and stuck.
__________________
A MODEST PROPOSAL
http://www.pokecommunity.com/showthread.php?p=7766537
Reply With Quote
  #9    
Old August 4th, 2011, 02:56 PM
abnegation's Avatar
abnegation
adventure
Community Supporter
 
Join Date: Apr 2009
Age: 21
Awesome we got stickied you guys :D

Anyway, thanks for the comments above, I'd like to point out that I've rectified the errors that were noticed. But I have something to add, I realised I had forgotten to explain how to add tilesets and their autotiles. So this image will help, it'll be added to the tutorial post also.

Spoiler:
__________________
Taking time off from being a Super Moderator on this forum.
I may be back in due course, until then I will be inactive.
Now you're aware.
Reply With Quote
  #10    
Old August 14th, 2011, 08:39 PM
KingCharizard's Avatar
KingCharizard
C++ Developer Extraordinaire
 
Join Date: Dec 2009
Location: Pennsylvania
Age: 26
Gender: Male
Nature: Bold
Wow, A Very detailed guide.. very impressive and this should help out many beginners..
__________________
My personal website. UPDATED 8/29/2013
Reply With Quote
  #11    
Old June 3rd, 2012, 10:35 PM
BrakeNeck's Avatar
BrakeNeck
 
Join Date: Jun 2012
Location: Council Bluffs, Iowa
Age: 23
Gender: Male
Nature: Jolly
Thank you, so very much for this thread.
I have recently become interested in creating my own Pokemon "game" and this has finally giving a means to my end.

So, seriously, from the depths of my creative heart. Thank you.
Reply With Quote
  #12    
Old June 24th, 2012, 10:59 PM
Flashpoint's Avatar
Flashpoint
→ P e r s i s t e n c e
Community Supporter Tier 5
 
Join Date: Jan 2008
Location: SRU Headquarters
Age: 21
Gender: Male
Nature: Relaxed
Send a message via Windows Live Messenger to Flashpoint Send a message via Skype™ to Flashpoint
This is a magnificent tutorial and it works wonders for begginers.

However... The information I'm gonna share with you will save you a bunch of time. When you export the tileset and open it in photoshop and then place your transparent tile onto the tilesheet. Once you click save you will get 3 save file types, if your photoshop is messed up. (I reset my settings holding ctrl+alt+shift and it was still the same). In order to import the tileset sucessfully, load the tileset onto paint and then place your transparent tile on the tilesheet. Once you're done, save as .PNG and import it into your game.

Some of you may of known this, but I hope this helps those of you who struggle in this process. Enjoy!
__________________
Success is not final, failure is not fatal: it is the courage to continue that counts.
Winston Churchill
Pokémon Auburn/Slate in the making!

Reply With Quote
  #13    
Old August 17th, 2012, 11:26 AM
Tajun's Avatar
Tajun
Master of Aqua
 
Join Date: Aug 2012
Location: My house.
Age: 12
Gender: Male
Nature: Brave
This is so helpful.... Now I can't wait till I get my own CPU.
__________________
Blah, Blah....
Reply With Quote
  #14    
Old August 19th, 2012, 07:33 AM
FL's Avatar
FL
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
A tip for beginner's: Don't mix Gen 2/3/4 tilesets and overworlds! They have a different proportions and perspectives.

This topic needs a little update in starter kit section.
__________________
Reply With Quote
  #15    
Old September 15th, 2012, 03:46 PM
TheAgentBrandon's Avatar
TheAgentBrandon
Togepi
 
Join Date: Apr 2012
Location: The Middle of Nowhere
Gender: Male
Nature: Timid
So today I tried out mapping and I learned how to actually do it. But since I was using Pokemon Essentials I was gonna use it as the base of my game. So I chose where my character was gonna spawn and I started my game and I got an error. I ended up making 5 maps today am I going to end up losing all my progress?
Reply With Quote
  #16    
Old September 22nd, 2012, 02:52 AM
superdialga's Avatar
superdialga
Unhatched Egg
 
Join Date: Sep 2012
Gender: Male
Very helpful tutorial.Best for beginner
Reply With Quote
  #17    
Old September 23rd, 2012, 09:13 AM
Crimson Flare's Avatar
Crimson Flare
Unhatched Egg
 
Join Date: Sep 2012
Gender: Female
This was very helpful, without it I would've spent the next few days in rmxp in limbo. But I do have a question: Does anyone know how to change the game intro?
__________________

HACKS I SUPPORT:

Pokemon Nova Luna




Creator of the The Pokemon Fanon Wikia!
Reply With Quote
  #18    
Old September 24th, 2012, 06:10 AM
Pharetra's Avatar
Pharetra
MOM GET THE CAMERA
 
Join Date: Jun 2011
Age: 18
Gender: Male
Quote:
Originally Posted by Crimson Flare View Post
This was very helpful, without it I would've spent the next few days in rmxp in limbo. But I do have a question: Does anyone know how to change the game intro?
What do you mean by Game Intro? The scene in which Professor Oak asks your name and gender?
__________________
Reply With Quote
  #19    
Old October 6th, 2012, 03:06 PM
FL's Avatar
FL
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
You also need to put in some place of this topic that RMXP=RPG Maker XP.
__________________
Reply With Quote
  #20    
Old October 25th, 2012, 08:43 AM
Tiggerwoodz
Unhatched Egg
 
Join Date: Sep 2010
Gender: Male
Hey, i'm extremely new to all this and this is perhaps the best tutorial i've come across. I downloaded VX Ace before i even saw this tutorial. Is this going to give me extreme trouble as far as putting the tilesets in?
__________________
Fight as hard as you can 'til you faint!- Bruno
Willow is my middle name. Willow is flexible and not easily broken. I'm not giving up yet- Pryce
Pokemon: Mittsu Legends *coming soon*
Reply With Quote
  #21    
Old November 1st, 2012, 02:20 PM
Cilerba
the hearts of lonely people
Community Supporter
 
Join Date: Feb 2010
Location: Massachusetts
Age: 17
Gender: Male
Nature: Quiet
Quote:
Originally Posted by Tiggerwoodz View Post
Hey, i'm extremely new to all this and this is perhaps the best tutorial i've come across. I downloaded VX Ace before i even saw this tutorial. Is this going to give me extreme trouble as far as putting the tilesets in?
If you really want to make a Pokémon fan game, you're better off with RPG Maker XP as there's already a fully working starter kit for it. With VX Ace, you'd have to wait for somebody to make one or make one yourself.
__________________
A MODEST PROPOSAL
http://www.pokecommunity.com/showthread.php?p=7766537
Reply With Quote
  #22    
Old December 17th, 2012, 11:03 AM
Elite Four Lucian's Avatar
Elite Four Lucian
Elite Four - Psychic User
 
Join Date: Jun 2007
Location: Sinnoh Region
Age: 26
Gender: Male
Nature: Brave
Can you go a little more in-depth on mapping?
__________________
The "Elite Four Lucian" & "Elite Four Kai" MINIcon was Created by me! It is the first of it's kind. If you would like one made, PM me and I will make you one.


Wanting to Trade: An Elgato Game Capture HD for an Black or Red 3DS + Pokemon X or Y. Let me know if you are interested.
Reply With Quote
  #23    
Old April 11th, 2013, 02:20 AM
Elephantomsk
Unhatched Egg
 
Join Date: Apr 2013
Gender: Male
I'm not sure if anyone else is having this problem. But, there are a lot of broken images, and they kind of confuse me since I can't actually see what he's trying to explain in the images.
Reply With Quote
  #24    
Old April 11th, 2013, 03:27 AM
lythuyhai
Unhatched Egg
 
Join Date: Apr 2013
Gender: Male
Okay , i can do that , thanks so much
Reply With Quote
  #25    
Old April 15th, 2013, 11:56 AM
abnegation's Avatar
abnegation
adventure
Community Supporter
 
Join Date: Apr 2009
Age: 21
Quote:
Originally Posted by Elephantomsk View Post
I'm not sure if anyone else is having this problem. But, there are a lot of broken images, and they kind of confuse me since I can't actually see what he's trying to explain in the images.
They all seem to be there for me. Your Internet may be a little slow perhaps, if not, try pressing ctrl + F5 if you use a Windows machine.

Anyone else having this issue?
Reply With Quote
Reply
Quick Reply

Sponsored Links


Advertise here
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 02:35 PM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.