Live2D is a technology that allows 2D images to be smoothly animated.
It has recently become popular in games and with VTubers.
Get the Sample Game Project File
The TyranoScript engine and the Live2D plugin can be used free of charge.
This plugin uses the Live2D Cubism SDK. If you use this plugin to create a game, you must agree to the Live2D Proprietary License.
https://www.live2d.jp/terms/live2d-proprietary-software-license-agreement/
This agreement is presented when you download Cubism Core for Web during the installation process.
Also, if you plan to release a game using this plugin, you must agree to the SDK Release License.
Check the Live2D SDK Release License
As of October 2020, individuals, students, circles, and small businesses with recent sales of less than 10 million yen can release their works for free.
Moreover, the Live2D model included in this plugin can be used in accordance with Live2D’s official guidelines.
[Guidelines]
https://docs.live2d.com/cubism-editor-manual/sample-model/
Get the Latest live2d_tyrano_plugin_v410 Plugin (2024/2/13)
Get live2d_tyrano_plugin_v401 Plugin (2021/1/24)
live2d/driver
live2d
folder into your Tyrano project at:data/others/plugin
first.ks
file, add:
[plugin name="live2d"]
make.ks
file, add:
[live2d_restore ]
make.ks
is required in order to restore the Live2D model on load.)
Place your Live2D model data inside the folder: data/others/plugin/live2d/model.
The name of the directory is the model ID.
In the image above, the model ID is “Haru”.
Now, you can display the Live2D model simply by writing the following tags:
[live2d_new name="haru" model_id="Haru" ]
; Display the Live2D model
[live2d_show name="haru" y=-0.8 x=0 scale=2.5 ]
That’s all it takes to display the model. Simple, isn’t it?
You can control Live2D animations at any desired timing.
To play an animation, use the [live2d_motion] tag.
Check the model data in a text editor to find the available motion names.
For example, if the model ID is “Haru”,
open the file Haru.model3.json
in a text editor.
Inside the file, you will find sections linking to motion files.
Specify the Name in the [live2d_motion] tag to control motion playback.
In this example, motion names include “Idle”, “Idle2”, “TapBody”, and “Test”.
Note that “Idle” refers to the default standing motion.
So, to play the “TapBody” motion, use:
[live2d_motion name="haru" mtn="TapBody" ]
This will play the TapBody motion.
Also, “TapBody” may include multiple motions in an array.
By default, the first motion is played, but you can specify another one using:
[live2d_motion name="haru" mtn="TapBody" no=2 ]
Setting no=2 will play the second motion in the TapBody array (index starts at 0).
You can also change facial expressions using the [live2d_expression] tag.
Specify a name that is linked under the Expression section in the JSON file.
[live2d_expression name="haru" expression="f07"]
[live2d_mod name="haru" idle="Test" ]
You can animate the character’s mouth while they are speaking.
Note that the model must support lip-sync.
First, when using [live2d_new], enable the lip-sync feature and specify the character’s display name using lip="text"
and jname="Haru"
.
[live2d_new name="haru" model_id="Haru" lip=text jname="Haru"]
Then, if the name specified in the dialogue matches the jname, the mouth will animate while speaking.
You can also adjust the mouth movement speed and other parameters, so be sure to experiment.
[live2d_new name="haru" model_id="Haru" lip=true jname="Haru"]
#Haru
Haru is talking now.[p]
Am I speaking clearly?[p]
■Lip-sync with voice audio
It is also possible to sync mouth movements to voice audio.
This feature is supported from Live2D plugin version 401 and TyranoScript version V506 and later.
When defining the model, set lip="sound"
.
Optionally, you can specify which audio buffer (buf) to respond to using the lip_se
parameter.
[live2d_new name="haru" model_id="Haru" lip="sound" lip_se="1" jname="Haru"]
In this example, the model will respond to sounds played with [playse buf=1 storage="voice.mp3"]
.
⚠️ Important: Without restrictions, the model may respond to all sounds, including background music (BGM).
To prevent BGM from triggering lip-sync, write it like this:
[playbgm storage="music.mp3" html5="true"]
When html5="true"
is set, the sound will be ignored by the lip-sync system. This also applies to sound effects:
[playse storage="door.mp3" html5="true"]
With this setup, sounds will not trigger lip-sync.
When the game screen is enlarged beyond its default size,
sometimes the Live2D model appears in front of the message window.
As a solution:
1. Set the game screen size to be larger.
Or
2. Edit tyrano.css.
Open the file tyrano/tyrano.css in an editor and delete the line that contains 'position: absolute;'.
.tyrano_base{
-moz-user-select: none;
-webkit-user-select: none;
-khtml-user-select: none;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
}
However, note that with method ②, screen centering and camera functions will no longer work. Please be aware of this limitation.
Loads a Live2D model.
The model is not displayed on screen immediately after executing [live2d_new].
To display it, use [live2d_show] afterwards.
Parameter | Required | Description |
---|---|---|
name | × | Specifies the model name. If omitted, the value of model_id will be used as the name. |
model_id | × | Specifies the model ID. The folder name placed under the "model" directory is the model ID. All related files (e.g., ○○.model3.json) must have the same name. |
idle | × | Specifies the name of the idle motion. The default is "Idle". If multiple motions are set, they play randomly. |
scale | × | Specifies the scale of the model when displayed. For example, setting it to 1.5 scales the model to 1.5 times its size. Default is 1. |
x | × | Specifies the horizontal position. Note that the center of the screen is 0, which differs from other TyranoScript coordinates. |
y | × | Specifies the vertical position. The center of the screen is 0, so this differs from other TyranoScript positioning. |
lip | × | Specifies whether the character's mouth should move when speaking. Set to "text" to sync with dialogue text, or "sound" to sync with voice. Note: this reacts to all playing audio. To prevent syncing with BGM, set html5="true" in [playbgm]. Only works with models that support lip-sync. |
lip_time | × | Sets the speed of mouth movement. Default is 100. Lower values make the mouth move faster. |
lip_se | × | If using lip="sound", specify the sound effect buffer (buf) to react to. Default is 0. |
lip_sound_level | × | If using sound for lip-sync, this sets the max waveform level that maps to full mouth movement. Default is 4000. Adjust this value for best results. |
breath | × | Set to true or false. Default is true. When true, an idle breathing motion is applied. Set to false to disable. |
jname | × | Specifies the character's display name. Required for mouth movement. The mouth moves only when the displayed speaker name matches this value via #○○. |
[live2d_new name="haru" model_id="Haru" ]
[live2d_show name="haru" y=-0.8 x=-0.3 scale=2.5 ]
Displays the Live2D model on the game screen.
The model must be preloaded using the [live2d_new] tag before it can be shown.
Parameter | Required | Description |
---|---|---|
name | × | Specifies the model name. |
idle | × | Changes the idle motion. If multiple motions are set, they will loop randomly. |
scale | × | Specifies the model's scale when displayed. For example, setting 1.5 scales the model to 1.5 times its size. Default is 1. |
x | × | Sets the horizontal position of the model. Note that the center of the screen is 0, which differs from other TyranoScript positioning. |
y | × | Sets the vertical position of the model. As with X, 0 is the center of the screen, so be aware it differs from typical TyranoScript coordinates. |
[live2d_new name="haru" model_id="Haru" ]
[live2d_show name="haru" y=-0.8 x=-0.3 scale=2.5 ]
Changes parameters of the Live2D model.
Parameter | Required | Description |
---|---|---|
name | × | Specifies the model name. |
idle | × | Changes the idle motion. |
scale | × | Specifies the scale of the model. For example, setting 1.5 enlarges the model to 1.5 times its size. Default is 1. |
x | × | Sets the horizontal position of the model. Note that the center of the screen is 0, which differs from other TyranoScript coordinates. |
y | × | Sets the vertical position of the model. As with X, 0 is the center of the screen, so be aware it differs from typical TyranoScript settings. |
[live2d_new name="haru" model_id="Haru" ]
[live2d_show name="haru" y=-0.8 x=-0.3 scale=2.5 ]
[live2d_mod name="haru" scale=1 ]
Completely deletes all Live2D models.
To use the models again, you will need to redefine them using [live2d_new].
Live2D models use a lot of memory, so it's not recommended to define many of them at once.
Use [live2d_delete_all] at appropriate intervals to clear memory and ensure stable performance.
This tag is especially useful in games that use many Live2D models.
Parameter | Required | Description |
---|---|---|
No parameters available. |
[live2d_delete_all]
Hides the Live2D model from the screen.
To display it again, simply use [live2d_show].
Parameter | Required | Description |
---|---|---|
name | × | Specify the name of the model to hide. |
[live2d_new name="haru" model_id="Haru" ]
[live2d_show name="haru" y=-0.8 x=-0.3 scale=2.5 ]
[live2d_hide name="haru" ]
[live2d_show name="haru" ]
Plays a motion animation on the Live2D model.
Parameter | Required | Description |
---|---|---|
name | × | Specify the name of the model. |
mtn | × | Specifies the motion to play. |
no | × | Specify the group index. Use this when multiple motion files are assigned to the same motion name. Default is 0. |
force | × | Set to true or false. If true, the new motion will forcibly override the currently playing motion. Default is true. |
[live2d_new name="haru" model_id="Haru" ]
[live2d_show name="haru" y=-0.8 x=-0.3 scale=2.5 ]
[live2d_motion name="haru" mtn="Test" no=0 ]
Changes the facial expression (Expression) of the Live2D model.
Parameter | Required | Description |
---|---|---|
name | × | Specify the name of the model. |
expression | × | Specify the expression to apply. |
[live2d_new name="haru" model_id="Haru" ]
[live2d_show name="haru" y=-0.8 x=-0.3 scale=2.5 ]
[live2d_expression name="haru" expression="f03" ]
Fades in the Live2D display layer.
To ensure smooth visual presentation, first hide the layer using [live2d_fadeout],
then fully initialize the Live2D model using [live2d_new],
and finally call [live2d_fadein] to reveal the model.
Parameter | Required | Description |
---|---|---|
time | × | Duration of the fade-in, in milliseconds. Default is 1000ms. |
wait | × | Whether to wait for the fade-in to complete. Default is true. |
[live2d_fadein time=2000 ]
Fades out the Live2D display layer.
Note: The model will remain hidden until you explicitly call [live2d_fadein] again.
Parameter | Required | Description |
---|---|---|
time | × | Specify the duration of the fade-out in milliseconds. Default is 1000ms. |
wait | × | Specify whether to wait until the fade-out is complete. Default is true. |
[live2d_fadeout time=2000 ]