Tuesday 12 July 2016

Yanfly's Ace Message System

One of Yanfly's scripts is called the Ace Message System. I originally got this script because it allows you to reference an Item's ID in a Show Text command, and have RPG Maker automatically insert both the Item's Icon and it's Name.

The reason this is important is because you might go and change the icon and/or name of an item at a later date, and if you do you definitely don't want to have to update every single event that refers to it manually.

Gotcha #1


If you install this script, you need to be aware of this section:


It's not made clear, but those numbers 21 and 22 are the IDs of your global variables. So if you're currently using variables 21 and 22 for other purposes, you need to change these numbers to be IDs of ones you aren't already using. Otherwise, you will get weird message window sizes that look broken.

Name Window


The Ace Message System also does a whole stack of other things as well. One of the best things is that it allows you to also display a Name Window above your message windows without having to make a custom script call. (I hate having to remember script calls.)

All you have to do is enter in \n<name> right into the Show Text command, much like any of the other commands to change font size or font colour, etc, and you'll get a name window displayed with the text you put between the angle brackets in it.



Gotcha #2

Call me lazy, but I really didn't want to have to go back over every single Show Text command I'd so far written, and repeatedly type in \n<name> at the start of every single one, nor have to do so for every future one. Nor have to do so again if I happened to change someone's name.

So I modified the script to automatically put a Name Window on every Message Window that contained a Face Graphic, and to use the name of the file as the character's name.

This means that NPCs with specific names need their own Face Graphic file (which is not a bad thing, since I have trouble remembering which Face Graphic is whose for the more important NPCs). It also means that even the most insignificant NPC needs some sort of name or descriptor, but this isn't such a big deal. Descriptors can be really useful for the player, and I just use Villager, or Girl, or Noble, etc, which means I can also group a bunch of Face Graphics together into the same file for those insignificant NPCs for ease of use.

I also scripted it so that it will use the name of the file up until any underscore character. This means I can have 16 servant NPCs in two files named Servant_1.png and Servant_2.png and still have the Name Window just displaying "Servant".

All that's required is to modify the start_name_window method at around line 885 to look like this:


Use Event Name

An alternative is to use Yanfly's original logic of \n<name>, but to modify it so you can specify an Event ID in place of just any string. E.g. \n<21> where 21 is Event 21.

The added line 803 below will take that tag and get the name of the Event that matches the given ID for the Name Window. If this tag is present in the Show Text command, this is what will be displayed in the Name Window rather than the name of the Face Graphic.



The rest of the lines in this method are variations that will change the position of the Name Window. I don't see myself ever doing that, so I didn't bother adding equivalent lines with the Event ID tag.

Gotcha #3

Getting an Event's name requires a bit of further tweaking. Even though the documentation clearly states that the Event object has a name property (and everything on Google indicates that it does for other people), the code I have in RPG Maker actually didn't. 

So I had to go and add this into Yanfly's script as well:

Note that I put this well before the Name Window class.

No comments:

Post a Comment