- Joined
- Jan 5, 2016
- Messages
- 757
- Reaction score
- 630
- First Language
- French
- Primarily Uses
Animated busts.
Hi everyone!
This small plugin was made to handle animated busts, but can be generalized to make picture based animations.
Features:
- Create picture based animations and synchronize them to the message window, for easy speaking animations.
- Any number of frames supported.
- Customizable frame rate.
- For out of message use: set the number of times the animation runs before pausing, or the time in between animation loops.
- Text codes to set, start, synchronize and pause animations directly from within the message window.
The video above, created by @Rhino explains all the features. You can also find all the possible actions within the help file of the plugin.
Simply download the plugin, name it whatever, save as a .js file and import it in your project. There are no parameters to set.
Spoiler'd below: the help file of the plugin.
Code:
* ===================================================================
* Animation setup:
* ===================================================================
* First, setup the pictures using the event commands.
* Then use the following script call:
* $gameScreen.picture(pictureId).setAnim([array],interval);
* Replace array by the file names without the extension, surrounded by "" and
* separated by ",".
* Ex: ["mouth_closed","mouth_1","mouth_2","mouth_3"]
* These will be, in order, the pictures displayed for the animations.
* The first picture will be used when the animation is paused.
*
* Then replace interval by a number, this will be the number of frames
* between image changes.
* Ex: 5
*
* Ex: $gameScreen.picture(2).setAnim(["mouth_closed","mouth_1","mouth_2","mouth_3"],5)
* This will cause the picture to loop between the frames you set in the array
* until told to stop.
*
* ===================================================================
* Freezing an animation
* ===================================================================
* You can tell a picture to stop looping by using:
* $gameScreen.picture(pictureId).freeze();
* It will set the picture to the first image in the list and stop it from looping.
* Notice: when synching the animation to a message, it will freeze and unfreeze the
* animation automatically when the message pauses. So you have to remove the animation
* if you don't want it synching with a message, not freeze it.
* This command is for out of message use.
*
* You can tell a picture to begin looping again by using:
* $gameScreen.picture(pictureId).unfreeze();
* This will make the picture start looping again, starting at the first frame.
* Again, same disclaimer as for the freeze command: intended for out of message use.
*
* ===================================================================
* Synchronizing an animation with a message box
* ===================================================================
* In order to synch up a picture looping animation to a message window use:
* $gameMessage.setAnim(pictureId)
*
* Ex: $gameMessage.setAnim(2)
* This will cause the picture to synch up its looping animation with the message
* window: it will loop while text is writing, stop for pauses and between windows.
* Using fast forward will make it skip the animation altogether.
*
* If you want a picture to no longer synch up with the message window, use:
* $gameMessage.removeAnim(pictureId)
*
* Ex: $gameMessage.removeAnim(2)
*
* ===================================================================
* Frozen or message end picture outside of animation loop
* ===================================================================
* By default the plugin will use the first image in the array as the frozen or
* message end picture. If you would like to define a frozen picture outside of
* the loop you can use the following command:
* $gameScreen.picture(pictureId).setFrozenBmp(filename);
*
* Ex: $gameScreen.picture(2).setFrozenBmp("mouth_closed")
*
* If you would like to remove a frozen picture and start using the first picture
* of the loop again, use the following command:
*
* $gameScreen.picture(pictureId).removeFrozenBmp()
*
* Ex: $gameScreen.picture(2).removeFrozenBmp()
* ===================================================================
* Wait time in between animation loops:
* ===================================================================
* If you want to pause the picture in between loops, use the following:
* $gameScreen.picture(pictureId).setLoopInterval(number)
*
* Ex: $gameScreen.picture(2).setLoopInterval(60)
* This will make the picture wait 60 frames before each animation loop.
*
* If you want to remove the wait between loops, use:
* $gameScreen.picture(pictureId).removeLoopInterval();
*
* Ex: $gameScreen.picture(2).removeLoopInterval();
*
* Both of these commands are intended for out of message use.
*
* ===================================================================
* Run animation loop only X times:
* ===================================================================
* If you'd like the animation loop to only run on certain amount of
* times, use:
* $gameScreen.picture(pictureId).setLoopTimes(number)
*
* Ex: $gameScreen.picture(2).setLoopTimes(5)
* This will cause the picture to loop 5 times and them freeze itself,
* until the loop times are removed or set again.
*
* If you want to remiove the limitation, use:
* $gameScreen.picture(pictureId).removeLoopTimes();
*
* Ex: $gameScreen.picture(2).removeLoopTimes();
*
* Both of these commands are intended for out of message use.
*
* ===================================================================
* Text codes:
* ===================================================================
* This will also add several escape codes to use with message boxes:
* \fa[pictureId] this will freeze the target picture animation. Again, if the animation
* is synched it won't have any effect.
*
* \ufa[pictureId] this will unfreeze the target picture animation. Just as above,
* if the animation is synched it won't have any effect.
*
* \da[pictureId] this will desynchronise the target picture animation with the
* message window and automatically freeze it. Unfreeze it after if you'd rather
* it kept running.
*
* \sa[pictureId] this will synchronize the target picture animation with the
* message window.
*
* \ca[variableId] this will create an animation, you must have a picture already shown.
* First you must setup a variable using the control variable: script command
* the following way:
* Control variables: script: [id,[spriteArray],interval,frozenBmp*,loopInterval*,loopTimes*].
* Replace id by the picture id you want to animate.
* Replace sprite array by the array of sprite names.
* Replace interval by a number.
* frozenBmp can be omitted, if it is present it will set the new animation to use
* the file name you replace frozenBmp by as its frozen frame.
* loopInterval can be omitted but you must provide a frozenBmp to be able to use it
* it will set a wait time between loops, replace it with a number.
* loopTimes can be omitted but you must provide a frozenBmp and a loopInterval to
* be able to use it. Replace it with a number, this will be the number of times the
* animation will repeat.
*
* Ex: Control variables: script:[1,["mouth_closed","mouth_1","mouth_2","mouth_3"],5,"mouth_frozen"];
* Then in the message use \ca[variableId], replacing variableId by the id of the
* variable you just used.
* So if you used variable 1, use \ca[1].
* This will start the animation on target picture (1 here) using the sprites in the array,
* and the interval there too, when the message reaches that point.
* It will also synchronize it automatically.
Terms of use:
They are detailed in the plugin file for reference, pasted here:
Code:
// Free for commercial and non commercial use, credits required: any of
// Astfgl/Astfgl (Pierre MATEO)/ Pierre MATEO.
// Edits and reposts allowed, as long as it is kept under the same terms of use.
// Do not remove this header, do not claim as your own.
Download: here on pastebin.
Additional ressources:
@Rhino was kind enough to draw mouth animations for all the standard RTP Sci Fi actors busts. You can find them showcased on the youtube video above.
You can download the ressources on her google drive here. Be sure to credit her if using those animations!
If you don't want to watch the video, here is a gif sample:
Credits:
- Sample pictures and mouth animations created by Rhino.
- Youtube video created by Rhino.
- Plugin created by myself.
- Original request thread, by Rhino, here.