Counter Attack Skills


By Fomar0153
Last Updated: 16 May 2012 (Version 1.0)
Download Link: http://pastebin.com/raw.php?i=nngAvumw

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: http://pastebin.com/raw.php?i=rk4LMF66

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:
$game_map.refresh
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

end

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

  end
end

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:

 a.custom_formula_fireball(a,b)

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

Script Editor:

class Game_Battler < Game_BattlerBase
  def custom_formula_fireball(a,b)

  end
end

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;
  end
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
    else
      return ([a.atk / 5, a.atk-b.def].max * (a.atk ** 0.5)).to_i
    end
  end
end

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:

a.basef(a,b,true)

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)
end

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.

A guide to Note-tagging

So you’re getting into scripting, maybe you just released a script and naturally you’re a bit peeved because the first person to reply did nothing but complain about the lack of note tagging, maybe the second reply agreed with him… Right so now you’re a double murderer but want to learn how to incorporate note tagging in your future scripts. Then this tutorial is for you.

First let me begin by saying note tagging is NOT REQUIRED NOR EVER WILL BE for a script. It does not improve a script, it does not in any way make a script better. It only makes a script easier to use for people of no scripting ability or those with a weak disposition about editing a script. In some ways it’s a bad thing because it encourages a plug and play attitude and keeps people from doing minor amounts of scripting (which can lead to a better understanding of scripts). But clearly if you’re reading this then you want to make your scripts more “user friendly.” So let’s have a look at the potential classes you can use note tagging in:


C
lick to see full size.

Hopefully you will be able to find in the database and editor where you put the notetags. Notetags usually look like:

<notetag x>

I don’t know who came up with the format but it effectively mimics html tags, notetags don’t have to look like that but it’s what people are used to. If you do something different then any “user friendliness” you add to your script will be quickly be diluted with queries and uncertainty about the notetagging.

Right let’s now get into the code, hypothetical scenario you have a script where by one of your characters has a chance to not consume an item when using it and you want each item to have a different chance to avoid been consumed. You’ve decided your notetag will be:

<con x>

A quick look at the diagram I’ve provided you should lead you to: RPG::Item. Different people implement notetags in slightly different ways, for example Yanfly built an entire architecture around pre-loading notetags but I’ll just show you the way I do notetags and if you’re interested in other ways of notetagging you can also go look at how other scripters implement it.

So we’ve got our class, RPG::Item let’s go into them the script then:

class RPG::Item

end

We now need to add the new method you’ll call from somewhere in your script.

class RPG::Item
  def conserve_chance
  end

end

In all the classes with notes the note is stored in a variable called @note. Anyway this is what our final code looks like:

class RPG::Item
  def conserve_chance
    if @note =~ /<con (.*)>/i
      return $1.to_i
    else
      return 0 # the default if no notetag is present
    end
  end

end

Let’s just examine it a bit closer. =~ basically is checking for a match with the notetag. The two / are to do with regex which unless you want to look into more closely then what I go through here should see you through setting up any note tag. As for .* the . accepts any character except line breaks and the * means you can enter as many as you like. Finally the i after the second / just tells it to ignore case meaning <con x>, <CON x>, <Con x>, <CoN x> would all be accepted as a match.

$1 effectively holds whatever was placed in the notetag, by default it will be a string, if you need it to be an integer then add .to_i onto it like in the example.

I think that concludes the main chunk of the tutorial but there are two more things I want to go through getting an array from notetagging and inheritence with notetagging.

Lets jump into getting an array from notetagging, $1 contains the string from the notetag so we could have people enter the array like: <array 1,2,3,9,4> for example. There is a highly useful function in ruby called split and what it does it break up a string and return an array, best part of all if we can tell it how to break the string up. Right below are two examples one for an array of string and one for an array of integers.

class RPG::Item
  def conserve_chance
    if @note =~ /<con (.*)>/i
      return $1.split(",")
    else
      return []
    end
  end

end

 

class RPG::Item
  def conserve_chance
    if @note =~ /<con (.*)>/i
      ints = []
      for x in $1.split(",")
        ints.push(x.to_i)
      end
      return ints
    else
      return []
    end
  end

end

 

Right then that just leaves me to go through inheritance and notetags. If I may draw your attention to subset of the diagram above:

What the arrows represent is inheritance (I know that in UML they should be clear arrowheads but I don’t care). Inheritance is where the classes inherit all the variables and methods from the other class. The variable note exists in the RPG::BaseItem class and them all the other classes in the diagram inherit it. What this means is that if you need the same method in more than one of these classes you can put it in a class which the classes you need the method in inherit. So for example if I want to add something to both Weapons and Armours then I can put the method in EquipItem.

So hopefully this has helped you understand how to incorporate note tagging in your scripts, if you’re desperate to use notetagging when there are no notes you could always consider name tagging! But in all seriousness if you need any further help or clarification please don’t hesitate to leave a comment.

Jet has scolded me for performing the check every time the method is called so here’s an example of how to cache the notetag so that it only calculates it once per session.

class RPG::Item
  def conserve_chance
    if @conserve_chance.nil?
      if @note =~ /<con (.*)>/i
        @conserve_chance = $1.to_i
      else
        @conserve_chance = 0
      end
    end
    @conserve_chance
  end

end

Just a quick update on what I’m doing.

Very busy, not least because I’m playing Star Wars the Old Republic (Flames of the Crucible if anyone wants to join me). I’m currently programming a new version of some software that is used at work and unfortunately for you this means that I don’t generally feel like programming after spending several hours working on this application. The good news is that I can see the light at the end of the tunnel and normal scripting may resume soon (a couple of weeks?).

When I do the two scripts that are most in need of an update are my animated battlers and my stamina/atb scripts. Anyway until then, have fun!

A Monster Odyssey: Dev Log #3 – Niall The Monster Master

At last the character with the most complicated and extensive systems is complete, I guess I can ease up a bit and get around to updating some scripts. Anyway let’s have a look at my progress since the last update.

Progress Report:

  • Added different tiers and styles of attack. – Similar to Chrono Cross where you had three tiers of attack. I’ve expanded on it by having three styles, Power, Skill (multi-hitting) and Magic (which hits all enemies).
  • Finished implementing the anti-grind code (a raising level cap)
  • Completed coding the Monster Master class.
  • Created the Monsters that can join you in battle but still some work to be done on them.
Next let’s have a look at the Monster Master in action.
Note somehow the audio messed up. I’ve done an audio swap but I don’t know how long that takes, so until then I’d mute the video.

Credit to Holder for the Monster’s battlers.

I have updated Niall’s page with the information about his skills and resource.

So what we get to see here is a few battles and there are a few instances of the tiered attack system. Any how being as this update is meant to be about Niall let’s look at his skill system, resource and item restriction. I don’t know if I’ve mentioned the item restrictions before so I’ll just quickly summarise them, I’ve taken the idea from Phylomortis where each character had a restriction on item usage in battles. My reasoning is items can too easily turn a losing battle into a winning battle and I would rather careful planning and intelligent skill use turn the flow of battle. As such in battle each character will have a restriction placed on their item use. Some can have a positive effect on the items while at the same time restricting them.

Skill System

As a Monster Master Niall has the ability so summon one of his monsters to aid the party in battle. After a successful encounter against Monsters he has a chance to acquire a new monster. Niall has access to most of the skills his summoned monster has access to and if his Synchronisation is high enough then he has access to most of the skills that all his monsters have access to.

He can level his Monsters up which in turn allows them to learn more skills provided both Monster and Master with more skills to use in battle. Initially Niall can keep six monsters at any one time but this amount can be increased.

Resource

I wanted to keep Niall’s resource simple being as his complexity all comes from managing his monsters. Niall’s resource is called Synchro which represents how well he is synchronised with his monsters, using a skill his summoned monster has access to raises Synchro by 10% but using a skill the active monster doesn’t have access to lowers Synchro by 5%. Normally Niall only has access to his summoned Monster’s skills but when Synchro is 50% or more then he can access skills from all his monsters.

Item Restriction

Item x is Niall’s item restriction and is pretty straight forward, in each battle he is allowed to use x items. Initially this will be 1 but can be raised to 4 through equipping certain accessories.

How to make the most of custom formulae.

So earlier today in rpgmaker’s irc chat the conversation moved to the scripts someone desired for their game which included:

favorite foods – i can specify each actor’s favorite food and when the item is used on them, they heal extra hp or something

Anyhow I pretty quickly realised a script was not needed to implement this feature. RPG Maker Ace once again proves just how versatile it is because this feature can be implemented in a single input box. In particular this one:

That formula box alone has tremendous potential. I offered two solutions to the problem.

if b.id == 1; 500; else; 100; end;

b.id == 1 ? 500 : 100

Let us first look at exactly what they are doing. They both check a conditional statement, namely:

b.id == 1

For the formula box in general a refers to the attacker or user and b refers to the defender or recipient, who may or may not be the same.

Any way what we are checking is that the recipient’s id is equal to 1. Please note that this example is about an item which should be usable on party members only and therefore b is always going to be an actor (party member in English). So essentially we are checking that the person who the item is being used on is first in the database (Eric by default).

Now let’s look at the rest of those lines.

if b.id == 1; 500; else; 100; end;

If you’ve done any programming before you will recognise this as a standard if statement. If you’re confused about the presence of the semi-colons then let me quickly explain that they are like a way of inserting a new line. Were we not restricted to a single line then we could have written it like this:

if b.id == 1

500

else

100

end

So what this means is when the character id equals 1, heal 500HP otherwise heal 100HP. The other version achieves the same result but might be a little less clear if you are not overly familiar with ruby.

b.id == 1 ? 500 : 100

It still has the conditional, it is still checking if the item is being used on Eric but the rest of the code you could say has been condensed. This effectively boils down to:

condition ? true : false

The last thing two things I want to say before moving on are firstly that for more complicated situations you are probably better going the if statement route and the last thing is that while the formula box is pretty powerful you need to be aware that it is capped at a certain length (let’s be grateful that we use a & b and not attacker & defender) and if there is an error in your formula the skill will just miss repeatedly rather than crash the game.

Right so that concludes the explanation section of this tutorial. I personally find having a lot of examples to work from quite helpful so this next section is going to be a problem and solution section and hopefully one of them will be close enough to what you hope to achieve that you can adapt it.


Scenario: Half your party are demi-humans or robots and require different healing items than the rest of your party.

There are some quite creative solutions to this problem but for the sake of this tutorial I want to keep is simple. So the solution I offer just checks the ids again.

b.id==1 or b.id==3 or b.id==4 ? 500 : 0

A couple of things I would like to draw your attention to. I have omitted the spaces on both sides of == because when we’re space conscious they are wasted characters. The other feature is the ors they act like you’d expect but be careful when using and because it has a bit more to it.


Scenario: One character’s favourite food is peanut butter sandwiches but another character is allergic to peanuts.

So the way I’m going to implement it is that Eric gets a bonus 100 health when he eat the sandwich but Natalie is afflicted by poison when she eats one.

if b.id==1;200;elsif b.id==2;b.add_state(2);0;else;100;end;

So it was a bit more complicated this time so I went the route of the if statement, elsif is a way of checking another condition if the first one wasn’t met. So let’s just talk it through, if Eric gain 200HP, if Natalie add status number 2 (poison) otherwise restore 100HP.


Scenario: You have a thunder skill which doors more damage when outside, which you control with a switch

This is just a switch example.

$game_switches[x] ? 500 + a.mat * 4 – b.mdf * 2 :  200 + a.mat * 4 – b.mdf * 2

I’ve also included in it an example of how to include the default formula so you can see how to incorporate it.


Scenario: I have a skill whose power I want to control through a variable

Easy enough. Here’s how to do 10 times the value of the variable.

$game_variables[x] * 10


Scenario: I have a gamber and I want him to use dice skills e.g. he rolls two six sided dice, the skill does 100 times the combined number of the faces. It does double if he rolls a double and 10000 if he rolls snake eyes.

This one has a lot in it so we’ll look at it closely. We’ll use the if method and then use the rand(x) method which returns a number from 0 to x-1 meaning we will add 1 to it to simulate dice. We will also need to create some local variables, I will use c & d (DO NOT USE 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;

It’s not perfect, I would quite like to know what he rolled rather than just seeing the damage. Don’t worry the solution to this new problem will be shown in the next tutorial.


Scenario: We want a skill like White Wind (a final fantasy move which restores someone’s current health).

An easier one for once, we want the target’s (b) hp

b.hp

Other parameters you can use:

hp,mp,tp,mhp (Maximum Hit Points), mmp *Maximum Magic Points), atk,def,mat (Magic ATtack power),mdf,agi,luk


Scenario: What about demi?

Demi was a move which took a quarter of your current health.

b.hp / 4


Scenario: I want a skill which uses someone else’s stat e.g. my princess is bossing her guard around.

This is easier than you think, as long as it’s a particular character.

$game_actors[1].atk * 4 – b.def * 2

Eric attack!


Scenario: I want a skill to add an effect on the user e.g. exhaustion.

Not too hard.

a.add_state(2); a.atk * 4 – b.def * 2

Could also have it damage the user etc


Scenario: I want a skill which does more damage with a certain weapon equipped.

Little bit more complicated.

a.weapons.include?($data_weapons[1]) ? 1000 : 200

Since when did Hand Axes become so strong?


Scenario: I want a skill to do x

Leave a comment and I will try my best to direct you.

It has been brought to my attention that v[x] achieves the same result as $game_variables[x]

A Monster Odyssey: Dev Log #2 – The Battle System

Welcome to another exciting instalment of my development log. Before I start getting into the characters and their systems I thought I would briefly look at the battle system I will be using. I’m going to carry on as though you’ve watched the video so you should probably watch it. As I said yesterday it is heavily inspired by Chrono Cross, I should probably have renamed MP to ST for the video but apparently I forgot. The way the battle system works is that every action costs a certain amount of ST and it recovers over time (or it will) and everyone else recovers 1.0 ST when you complete your action. There are a few bugs to finish ironing out, in fact inbetween the video uploading and me posting this I fixed a bug where if you had negative ST and were attacked you would recover all the way back to 0. No comments about the over powered nature of Sorcery, it will have a resource called Multiplier and Deluge will eventually require a highish Multiplier. The only current visual changes I have planned are shifting the character selection to the battlers and doing something to the battle log, though I’m not sure what.

Also the popups script shown in the video is Victor Saint’s script, I’m not fond of programming graphical scripts and his popups are just fantastic. So I’m using his script, no point in re-inventing the wheel.

I don’t usually mention what the other RPG Maker people are up to, I kind of figure you already know but I have to mention Kread-EX because Kread-EX has made a script virtually identical to one I had planned, Runic Enchantment. I was planning to make something similar as an add-on to my Individual Equipment script but now I don’t have to because Kread-EX has made a compatibility patch between the two scripts. Great work Kread-EX! Meaning you can individually Rune up each piece of equipment!

A Monster Odyssey: Dev Log #1

So it’s Spring and it’s time to get to work on my RPG. It’s called A Monster Odyssey and I’ve made a page with a bit of back story and a few other things. Although there are nine playable characters (not counting monsters) you will never be able to get all nine in any one play through, one of my goals with each of the characters is to make them each play differently and develop differently. Hopefully I’m up to the challenge. Anyway for this first entry I thought I’d go through the games that I know consciously have influenced me with this game.

Final Fantasy XIII-2
This is one of the games I’m currently playing and I can’t believe I held off buying it now. It improves on XIII in all the ways that mattered to me. The main thing I’m taking from this is the monster fighting with the party mechanic.

Chrono Cross
The other game I’m really playing right now. I’m almost certainly going to be stealing a big chunk of it’s battle system. Part of my reason for having so many characters is this game, my personal opinion is that the ideal number of party members is two times the battle party size (take one if the main character can’t be removed from it). My battle party size is three plus one monster (I might decide to allow two monsters later on but currently I’m against it), so naturally I’ve thrown my own opinion out. Like Chrono Cross you will never ever have to recruit the random female that turns up out of nowhere (looking at you Kid).

A Blurred Line
Who isn’t influenced by this? While my story telling is no where near Lys’s level I hope to capture the same feeling of choices and uniqueness of each character. I do get the benefit from being able to use scripts to seamless systems rather than clunky event systems though.

Phylomortis: Avante Garde
Again this is more to do with unique character skill systems but I should warn you that I will be borrowing RPG Advocate’s stance on in battle item usage and approach. This was the game that convinced that it was worth upgrading to XP for the ability to script.

Master of the Wind and Kinetic Cipher
Put together purely because I would be saying the exact same thing for both of them, these two games have influenced all my ideas about dungeon design for years I can only hope to produce dungeons half as good.

Anyway now I’ve looked at my influences for this project I think I will look at why I’m pretending to myself that this game will ever see the light of day. I’ve never managed to stick with a game long enough in the past to even produce a demo (not as bad as it sounds, I’ve only tried a few times, certainly no more than 5 times where I got past the scripting). I think my problem has been that I’m very laid back and I’ve always let games slide until I just stop working on them. I’m going to try and stick to a schedule this time, my goal is a demo by the end of Spring, Tuesday the 19th of June. I’d like to think it’s realistic. However I think the main reason I stand a chance is that I’m a lot more mature since I last worked on a project. Anyway see you next update.

Skill Charges


By Fomar0153
Last Updated: 15 March 2012 (Version 1.0)
Download Link: http://pastebin.com/raw.php?i=ukLFX1Zh

This script can implement two new features. The first is skill charges, each time you learn a skill you gain a charge in it and you’re allowed to use that skill only as many times as you have charges per battle. The second feature is that each time you learn a skill after initially learning it the skill gets more powerful. Using both features together allows for your skills to get weaker each time you use a charge.

Also here endeth the daily scripts. RPG Maker VX Ace is out and I want to get on with RPG Making, I will still be releasing scripts, just not daily.