Game Development Reference
In-Depth Information
Chapter 14
Basic Scripting Exercises in RMVXA
We have now finished our game. All that is left is to cover a few things that I didn't cover in earlier chapters. While
an in-depth look into Ruby scripting within RPG Maker VX Ace (RMVXA) is outside of the scope of this topic, in this
chapter, it would still be a good idea to cover the basics. Chapter 15 will cover other miscellanea that I did not feel fit
within the overall narrative of our game and the topic so far.
What Is Ruby?
Ruby is an object-oriented programming language that was created by Yukihiro Matsumoto in 1993. It is used within
RMVXA in the form of the RGSS (Ruby Game Scripting System) and serves as the driving force behind this game-
development engine. It is praised by programmers worldwide for its ease of use. The best part of all is that Ruby is
open source (and thus costs the grand total of nothing to get; it can be downloaded freely). Learning how to use Ruby
will help you greatly whenever you decide to start customizing your games with scripts.
What Is Object-Oriented Programming?
In a sentence: it is programming that uses code organized into objects as the building blocks for a desired result.
We've been seeing examples of how Ruby (and, thus, object-oriented programming) works, in the few scripting
exercises we tackled for our game. Here's what we've actually touched upon already.
$ represents a global variable. That is, a value denoted with $ can be used anywhere within a
project (e.g., our game).
@ denotes an instanced variable (also known as an object variable). Instanced variables are
used within classes (such as Game_Interpreter ).
$game_actors[n] (where n is the actor ID) is an array that contains several defining aspects of
Actors in RMVXA, such as name, level, and nickname. You can reference any of the variables
listed under the header Public Instance Variables in the Game_Actor class by using the format
$game_actors[n].x (where x is the variable name).
An array is an ordered collection of objects.
You can call methods defined within the Script Editor in the damage formula box for items
and skills.
As you can see, there are quite a few things we already know. During the course of this chapter, we'll be tackling
other simple things that we can do with only the most basic of Ruby experience. The first exercise will be changing
how critical hits are calculated, so that they are influenced by the Luck stat of the attacker and the defender.
 
Search WWH ::




Custom Search