*This feature requires TyranoScript V470_rc4 or later.
In the past, when creating variations in character expressions, you needed a separate image file for each variation.
However, with the **character parts layering feature** in TyranoScript, you can combine multiple image layers to express various facial and costume patterns.
For example, if you have 3 clothing styles, 5 facial expressions, and 5 hairstyles, you'd need 75 image files to express all combinations the old way.
With this new feature, you can combine only the necessary parts at runtime, meaning you only need 13 image files.
This significantly reduces your game’s storage size and improves performance. Be sure to make use of it!
; Register the character
[chara_new name="yuko" storage="chara/yuko/hair_back/long.png" jname="Yuko" ]
; Eye variation parts
[chara_layer name="yuko" part="eye" id="1" storage="chara/yuko/eye/normal_eyes_black1.png" zindex=20 ]
[chara_layer name="yuko" part="eye" id="2" storage="chara/yuko/eye/deformed_eyes1.png" ]
; Change eye variation part
[chara_part name="yuko" eye="2" ]
; Change eye and mouth variation parts
[chara_part name="yuko" eye="2" mouse="3" ]
;Create character
[chara_new name="yuko" storage="chara/yuko/hair_back/long.png" jname="Yuko" ]
;Body parts
[chara_layer name="yuko" part="body_back" id="breza" storage="chara/yuko/body_back/breza1.png" zindex=9 ]
[chara_layer name="yuko" part="body_front" id="breza" storage="chara/yuko/body_front/breza1.png" zindex=10 ]
;Eye parts
[chara_layer name="yuko" part="eye" id="1" storage="chara/yuko/eye/black1.png" zindex=20 ]
[chara_layer name="yuko" part="eye" id="2" storage="chara/yuko/eye/default1.png" ]
;Hairstyle parts
[chara_layer name="yuko" part="hair_front" id="Natural" storage="chara/yuko/hair_front/natural.png" zindex=40 ]
[chara_layer name="yuko" part="hair_front" id="Wavy" storage="chara/yuko/hair_front/colored.png" ]
;Head parts
[chara_layer name="yuko" part="head" id="1" storage="chara/yuko/head/normal1.png" zindex=11]
[chara_layer name="yuko" part="head" id="2" storage="chara/yuko/head/blue1.png" ]
;Facial expression parts
[chara_layer name="yuko" part="face" id="1" storage="chara/yuko/face_front/normal.png" zindex=20 ]
[chara_layer name="yuko" part="face" id="2" storage="chara/yuko/face_front/surprise.png"]
;Accessory parts
[chara_layer name="yuko" part="megane" id="0" storage="none" zindex=30 ]
[chara_layer name="yuko" part="megane" id="1" storage="chara/yuko/accessory_front/glasses.png"]
;Display character
[chara_show name="yuko"]
When you run the script, the character will be displayed.
How is it so far? Let's move on to switching character parts.
;Change hairstyle and expression
[chara_part name="yuko" hair_front="colored" face="2" ]
The switch is done.
Easy, right?
Even when using the character part switching feature, all character-related functions such as animation and emphasis effects are still available.
Let's go over a few important things next.
When defining character parts using the [chara_layer] tag, we used the zindex parameter.
[chara_layer name="yuko" part="eye" id="1" storage="black1.png" zindex=20 ]
This determines which parts appear in front when overlapping. Higher numbers appear in front.
You only need to define zindex the first time you register a part. It will be used for all parts with the same name.
The first registered part using [chara_layer] becomes the default.
;Eye parts
[chara_layer name="yuko" part="eye" id="1" storage="black1.png" zindex=20 ]
[chara_layer name="yuko" part="eye" id="2" storage="normal1.png" ]
In this case, the first id="1" is the default.
Default parts are shown when [chara_show] is used.
Why does this matter? Because after using [chara_hide] to remove a character, when you show it again, previous part states are remembered.
You could reset manually using [chara_part], but it’s a bit tedious.
That's where the [chara_part_reset] tag comes in—it resets to the default parts easily.
A very useful feature is that you can reset only specific parts. Take a look:
[chara_part_reset name="yuko" part="face" ]
This resets only the face part to default. You can also specify multiple parts by separating them with commas:
[chara_part_reset name="yuko" part="face,mouse,eye" ]
*If part is not specified, all parts will be reset to their default values.
Sometimes you may want a part like accessories to be hidden initially and shown later using part switching.
You can achieve this as follows:
;Accessory parts
[chara_layer name="yuko" part="megane" id="on" storage="none" zindex=30 ]
[chara_layer name="yuko" part="megane" id="off" storage="glasses.png"]
The first [chara_layer] is the default, and it uses storage="none".
This lets you define an invisible part initially. Then later:
[chara_part name="yuko" megane="あり" ]
The accessory part is now added!
For more details, check the tag reference.