an RPG-Maker 2000 script by Fauchi
This script enables you to generate character graphics from templates ingame. You can use it to visualize changes in clothing, hairstyle, equipment, etc. It lets you mix and match templates to generate precisely the character graphics you need.
This script is based on DestinyPatcher 2.0 by Bananen-Joe, which introduces a scripting language to RPG-Maker 2000 called DestinyScript. Dynamic Charsets is compatible with every RPG_RT.exe that is compatible with DestinyScript. As far as I know, DestinyScript is only compatible with RPG_RT.exe files that were created with RPG-Maker 2000 v1.07.
You can find out if your RPG_RT.exe is compatible by opening it in DestinyPatcher 2.0. If your RPG_RT.exe is incompatible, you can try replacing it with the RPG_RT.exe that comes with this demo. Note that you should backup your own RPG_RT.exe beforehand in case anything goes wrong. You should also note that any patches you applied to your RPG_RT.exe will be overwritten when replacing it with the RPG_RT.exe from this demo.
Since this script is based on DestinyScript, you will need to patch your RPG_RT.exe with DestinyPatcher 2.0. You can find a link to DestinyPatcher in the Links section.
After you've installed DestinyPatcher, open your RPG_RT.exe with it.
This script uses the RPG-Maker variable #4021. Call that variable "DrawChar EventID". The variable ID was chosen to prevent conflicts with the variables you are already using in your project.
Copy the CommonEvent #2 ("Draw character") from the demo to any CommonEvent slot in your project.
Additionally, it is recommended to also copy CommonEvent #1 ("Reset DestinyVars") into any CommonEvent slot in your project. DestinyScript uses data types such as strings, Dwords and floats that are not reset when restarting your game via F12. This CommonEvent resets all variables upon restart. After the reset, RPG-Maker Switch #4001 will be turned ON. Name that switch "DestinyVars reset".
The charsets in RPG-Maker 2000 contain 8 characters per set. This script uses templates the size of 1 character (72x128):
If you use a template that is bigger than this, anything beyond 72x128 pixels will be ignored. If you use a template that is smaller than this, the game will crash as it tries to access non-existent parts of the image.
You will need a template for each layer that you want to draw. For example, if you want to draw clothes, the template will look like this:
If you want to draw hair, it will look like this:
A single charset in RPG-Maker 2000 can use up to 256 colors. Different charsets may use different color palettes, but each is limited to a total of 256 colors. This script draws different templates on a single charset. Therefore, each template needs to use the same color palette.
It is extremely important that all templates you draw on a charset use identical color palettes. This means all colors AND their order in the palette need to be the same. Otherwise, it will result in undesired color glitches.
The easiest way to achieve a shared color palette for all your templates is to save them as a "256 color bitmap" in Microsoft Paint. Your image will be saved using a standardized color palette that always contains the same colors in the same order. Note that if your original image uses colors that are not part of the standardized palette, your colors will be replaced with the most similar color in the palette. This means you will lose some color information.
If you know other ways to use a shared color palette for your templates, feel free to do so. Microsoft Paint is just the easiest option.
When all your templates use the same color palette, it is time to import them into RPG-Maker. Since we are dealing with single character graphics instead of entire charsets, the image dimensions won't allow importing the templates as charsets. Instead, they must be imported as Pictures.
Import your templates as Pictures and choose the same transparent color for each one. Choosing the same transparent color is important because that color will be moved to index 0 of the color palette. This is why you must import templates via RPG-Maker. Just copying them into the Picture folder won't work if your transparent color isn't already at index 0.
Once you have imported your templates, you are ready to go. Now you must specify which template you want to use for which layer. You can choose from the following list of layers:
a = "BodyStandard";
a = "HeadAlex";
a = "HairAlexBrown";
a = "ClothesAlex";
The DestinyScript is inserted via a "Comment" field into your event code. DestinyScripts always start with a '$' sign.
The specified filenames correspond to templates in the Picture folder. Note that you must leave out the file extension.
If the filename is invalid or the string is empty, the layer will not be drawn. You can use this to your advantage if you want to remove a layer.
If you want to reorganize your templates into subfolders of your Picture folder, you can do that. Just remember to include the name of the subfolder in the filename, e.g. write "Templates\BodyStandard" if your templates are stored in a subfolder called 'Templates'.
The ID of the event you want to draw to must be specified in variable #4021. When you draw a character, every event that uses the same slot of the same charset will be affected. Therefore, it is recommended to use an extra charset for each individual character you want to draw. You can leave that charset completely blank or make it look something like this:
Each time you draw on an event, the current charset slot will be erased and then all layers will be drawn. So if you want to modify a single layer, you will have to draw all layers again.
There are several ways to access EventIDs:
$ v = Event[THIS].Id;
After all the layers have been specified and you've stored an EventID in variable #4021, call the CommonEvent "Draw character".
Your event code should look similar to this:
<> Change Variable:  = 10001
<> Comment: $
: a = "BodyStandard";
: a = "HeadAlex";
: a = "HairAlexBrown";
: a = "ClothesAlex";
<> Call Event: Common Event "Draw character"
Dynamic Charsets is based on Bananen-Joe's DestinyPatcher which enables the manipulation of graphics, among many other things. The character graphic is accessible via an AuroraSheet, which is the DestinyPatcher's internal image format. AuroraSheets are used by charsets, facesets, pictures, etc., which makes it possible to copy images between them. This script uses PictureID 900 to load templates into the game which are then copied onto a charset.
When drawing a character, it's important to adhere to a specific drawing order. For example, if a character is wearing a backpack, the backpack needs to be displayed behind the character. This means when a character is facing down, the backpack must be drawn first and then the character is drawn on top of it. However, when a character is facing up, the character must be drawn first and the backpack must be drawn on top of it.
This makes it necessary to define a different layer order depending on the direction a character is facing. By default, this script uses the following layer orders:
|facing direction||layer order (bottom to top)|
|up||917, 916, 904, 906, 903, 902, 900, 901, 909, 910, 911, 912, 915, 908, 905, 913, 907, 914, 918, 919|
|right||916, 919, 918, 914, 900, 901, 902, 903, 909, 910, 911, 912, 915, 908, 906, 905, 904, 913, 907, 917|
|down||919, 918, 914, 900, 901, 902, 903, 909, 910, 911, 912, 915, 908, 906, 905, 904, 913, 907, 916, 917|
|left||917, 919, 918, 914, 900, 901, 902, 903, 909, 910, 911, 912, 915, 908, 906, 905, 904, 913, 907, 916|
You can find the definition of the different layer numbers in this list.
The layer orders are defined in the CommonEvent "Draw character". Each layer order is defined in a different string (facing up: #896, facing right: #897, facing down: #898, facing left: #899).
While drawing, these strings are parsed from left to right to find out which layer needs to be drawn in what order. If necessary, you can change the layer order. You can even add your own string IDs if you need more layers. Note: if a layer ID appears multiple times in the layer order, the layer will also be drawn multiple times.
Each template you want to draw on a charset must use exactly the same color palette. This means even the order of the colors in the palette must be identical. You can read an explanation for why this is necessary and how to achieve a shared color palette here.
If you want to use this script in your game, make sure to mention its author (Fauchi) and the name of the script (Dynamic Charsets) in the credits. You should also credit Bananen-Joe for developing the DestinyPatcher.
|1.1||May 12, 2020||
|1.0||May 2, 2020||