The RPG Maker Resource Kit

RMRK RPG Maker Creation => MV => MV Scripts Database => Topic started by: modern algebra on October 31, 2015, 02:13:31 AM

Title: [MV] Actor Sprite Options 1.0.1
Post by: modern algebra on October 31, 2015, 02:13:31 AM
Actor Sprite Options
Version: 1.0.1
Author: modern algebra
Date: 31 October 2015

Version History



Description


Set the step animation, move animation, and blend type for each actor individually. For instance, this will let you make a flying actor that still flaps his or her wings whenever the party is stationary.

Features


Instructions

Save the script in your plugins folder and import it through the Plugin Manager.

The plugin is set up by writing the following codes in an actor's notebox. To make it so that an actor is animating even when stationary, write:

      \step

To make it so that an actor is not animating even when moving, write:

      \immobile
 
 To change the blend type of an actor to something else, write:

      \blend[x]

Replace x with an integer, where the integers mean the following:
      0  : Normal
      1  : Additive
      2  : Multiply
      3  : Screen

Plugin


You can download the .js file from Pastebin: http://pastebin.com/Fh1n8SHL

Code: [Select]
//=============================================================================
//  Actor Sprite Options
//  Version: 1.0.1
//  Date: 31 October 2015
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/*:
 * @author Modern Algebra (rmrk.net)
 *
 * @plugindesc Set the step animation, move animation, and blend type for each actor individually
 *
 * @help With this plugin, you can set the blend type, walk animation, and step
 * animation for actors. If one of your actors is a flying creature like an
 * angel, for instance, this script lets you set it so that he or she is still
 * beating his or her wings while the player is stationary.
 *
 * The plugin is set up by writing the following codes in an actor's notebox.
 *
 * To make it so that an actor is animating even when stationary, write:
 * \step
 *
 * To make it so that an actor is not animating even when moving, write:
 * \immobile
 *
 * To change the blend type of an actor to something else, write:
 * \blend[x]
 *
 * Replace x with an integer, where the integers mean the following:
 * 0  : Normal
 * 1  : Additive
 * 2  : Multiply
 * 3  : Screen
 */
//=============================================================================

(function() {

// mafsoBlendMode - Lazy Instantiation, default of 0
Game_Actor.prototype.mafsoBlendMode = function() {
if (!this._mafsoBlendMode) {
var actor = this.actor();
if (actor) {
var rmatch = actor.note.match(/\\BLEND\s*\[\s*(\d+)\s*\]/i); // \blend[x]
this._mafsoBlendMode = rmatch ? +rmatch[1] : 0;
}
}
return this._mafsoBlendMode || 0;
}

// mafsoWalkAnime - Lazy Instantiation, default of true
Game_Actor.prototype.mafsoWalkAnime = function() {
if (!this._mafsoWalkAnime) {
var actor = this.actor();
if (actor) { this._mafsoWalkAnime = !(/\\IMMOBILE/i).test(actor.note); } // \immobile
}
return this._mafsoWalkAnime || true;
}

// mafsoStepAnime - Lazy Instantiation, default of false
Game_Actor.prototype.mafsoStepAnime = function() {
if (!this._mafsoStepAnime) {
var actor = this.actor();
if (actor) { this._mafsoStepAnime = (/\\STEP/i).test(actor.note); } // \step
}
return this._mafsoStepAnime || false;
}

// Set Sprite Options based on actor
Game_Character.prototype.mafsoSetActorSpriteOptions = function(actor) {
this.setBlendMode(actor.mafsoBlendMode());
this.setWalkAnime(actor.mafsoWalkAnime());
this.setStepAnime(actor.mafsoStepAnime());
};

// Refresh
var mafso_Game_Player_refresh =
Game_Player.prototype.refresh;
Game_Player.prototype.refresh = function() {
mafso_Game_Player_refresh.apply(this, arguments); // Call original method
var actor = $gameParty.leader();
// Set options based on lead actor
if (actor) { this.mafsoSetActorSpriteOptions(actor); }
};

// Game_Follower - Update
var _mafso_Game_Follower_update =
Game_Follower.prototype.update;
Game_Follower.prototype.update = function() {
_mafso_Game_Follower_update.apply(this, arguments); // Call original method
var actor = this.actor()
// Set options based on actor in this position
if (actor) { this.mafsoSetActorSpriteOptions(actor); }
};

})();

Credit



Support


Post in this thread if you have any comments or questions. It is perfectly fine to post here even if this topic has not been posted in for a very long time.

Please do not message me privately, as any concerns you have are likely shared by others and they will benefit from our correspondence being public. Additionally, I am often absent, and posting publicly will allow other members to assist you when I am unable to do so quickly.

Author's Notes


This is humiliating.

Terms of Use


You are welcome to use this script in any project of yours, whether it is commercial or non-commercial. There is no need to credit me, and please feel free to modify the plugin in whatever ways suit your project.

Basically, my plugin is your plugin, but please do not re-post this plugin or any modified version of it on another forum or website.
Title: Re: [MV] Actor Sprite Options
Post by: yuyu! on October 31, 2015, 05:31:56 AM
Heeeyy, neat idea! :D No need to be ashamed of your plugins, sir!
Title: Re: [MV] Actor Sprite Options
Post by: &&&&&&&&&&&&& on October 31, 2015, 06:00:38 AM
I love you thank you.
Title: Re: [MV] Actor Sprite Options 1.0.1
Post by: modern algebra on October 31, 2015, 04:56:26 PM
I updated this plugin to version 1.0.1. Save files made prior to adding this plugin should now be preserved.