Archive for May 2012

Counter Attack Skills

By Fomar0153
Last Updated: 16 May 2012 (Version 1.0)
Download Link:

Allows you to set a skill to be used when countering, skills that target allies will work correctly, though single target skills with be used on the character countering.


Region Map Loader

By Fomar0153
Last Updated: 06 May 2012 (Version 1.0)
Download Link:

This script allows you to load sections of your map (defined by regions) from another map and control it with switches. My main use for this is that I wanted player actions to affect their home town.

Anyhow this is how to set it up. First you need to notetag the Map the format is:
<regionmap regiondid,mapid,switchid> and you can include additional region maps by separating them with a semi-colon e.g.
<regionmap 1,2,1;2,2,2>
mapid refers to the map you’re copying from.

Next you need to make your map:

A couple of points, this script doesn’t copy events so they will need to on this map, I have them show up using the same switch as the region map. Next you need to set up the regions for the script to use.

Remember to put the region where the shadows go as well. Next copy the map and make whatever changes you want to the areas (this can be done multiple times e.g. if you wanted a plot of land to have two potential outcomes). Then make your edits.

Then in game turn the switch on. If you do this when you are on the map you will need to call:
Anyway have fun!


Custom Formulae and Scripts

So I have been talked into following up my last tutorial with another one. This one will be expanding on the previous one by going in to building upon the default scripts. First I want to talk about why you would do this and then go through a few worked examples.

One reason you might want to extend the default scripts for a formula could be the case that what you want to achieve doesn’t fit in the custom formula box. This is pretty easy to accomplish. Next up, you want to build in a default formula. I know that you can just use the same formula in every skill but I personally consider that bad practice. What if you discover your formula doesn’t act as you intended later in the game, fancy re-databasing all the skills and items? Or you want to create states that do different things to the formulas. We’ll be covering all that in this tutorial.

Let’s start by quickly analysing the formula box itself; as I’m sure you are aware a refers to the the attacker or user and b refers to the defender or recipient, now a and b refer either to an instance of Game_Actor or Game_Enemy. A quick glance at this class diagram shows us that both inherit from Game_Battler (which in turn inherits from Game_BattlerBase).

Why was that important? Simple because we have to decide where we are going to place our new bits of code. Personally I would recommend one of three places:

  • Game_Battler
  • Game_BattlerBase
  • A new Module

A module might in many ways make the most sense but being as I’m aiming this tutorial at people with limited scripting experience I’d rather avoid modules. Also if the code is added in Game_Battler we can directly access more variables directly (which suits me). So if we go to Materials in the script editor and insert us a new section then we need to add the code to add to the class:

class Game_Battler < Game_BattlerBase


Right next lets get down to examples. First let’s go through how to use a formula that’s too big for the box. Next let’s add a new method:

class Game_Battler < Game_BattlerBase
  def custom_formula_fireball


If you don’t consider yourself to be a scripter then the easiest thing for you would probably be to enter the formula exactly how you would have in the custom formula box. Good news, we can do that. What we need to do is pass our new method the a,b from the custom formula. So this is what we’re upto:

Custom Formula Box:


Note: b.custom_formula_fireball(a,b) would be equally valid.

Script Editor:

class Game_Battler < Game_BattlerBase
  def custom_formula_fireball(a,b)


So all that leaves us to do it put the formula in the method. I’m going to use the gambler example from the previous tutorial:

class Game_Battler < Game_BattlerBase
  def custom_formula_fireball(a,b)
    c=1+rand(6);d=1+rand(6);if c==1 and d==1;10000;elsif c==d;c*400;else;(c+d)*100;end;

So that’s how to bypass the length limit on the custom formulae. If that’s all you’re interested in then you can stop here. I’ll be carrying onto covering adding a default formula and manipulating it.

I’m not going to cover anything to do with developing your formula I’m just going to show you how to implement it, here’s the formula I was using in my last game:

class Game_Battler < Game_BattlerBase
  def basef(a,b, magic = false)
    if magic
      return ([a.mat / 5, a.mat-b.mdf].max * (a.mat ** 0.5)).to_i
      return ([a.atk / 5, a.atk-b.def].max * (a.atk ** 0.5)).to_i

First thing I’m going to point out is that I also pass a boolean (true or false) to the method to define whether it’s a magic attack or a physical one. You could do the same if you wanted. Just an example on the custom formula box:


Anyway the main reason for doing this is so that if you find your formula doesn’t work well later in the game you’ll only have to change it once. You can also simplify formulas if you wanted by making more methods. So for example in my last ill-fated game I had a character who could heal but I didn’t want him to be a dedicated healer so I made all his heals inflict statuses (with the turns they lasted reflecting the power of the heals) and if a character was affected by one of these statuses they only received half-healing. So the method I made looked like this:

def sorcery_healing?
  return state?(51) || state?(52) || state?(53)

My healing skill custom formulae looked a little like this

b.sorcery_healing? ? 100 : 200

Any how that just about concludes everything I wanted to cover in this tutorial, I hope it helped you.