//============================================================================= // アクターの状態によって顔画像を変えるプラグイン // FTKR_FacialImageDifference2.js // プラグインNo : 61 // 作成者 : フトコロ // 作成日 : 2017/12/16 // 最終更新日 : 2017/12/16 // バージョン : v2.0.1 //============================================================================= var Imported = Imported || {}; Imported.FTKR_FID = true; var FTKR = FTKR || {}; FTKR.FID = FTKR.FID || {}; //============================================================================= /*: @plugindesc v2.0.1 A plugin that changes the face image depending on the actor's state @author Futokoro @url https://github.com/munokura/futokoro-MV-plugins @license MIT License @help English Help Translator: munokura This is an unofficial English translation of the plugin help, created to support global RPG Maker users. Feedback is welcome to improve translation quality (see: https://github.com/munokura/futokoro-MV-plugins ). Original plugin by Futokoro. Please check the URL below for the latest version of the plugin. URL https://github.com/futokoro/RPGMaker ----- ----------------------------------------------------------------------------- Overview ----------------------------------------------------------------------------- By implementing this plugin, you can change the actor's facial image during battle based on various actor states. ----------------------------------------------------------------------------- Setup Instructions ----------------------------------------------------------------------------- 1. Add this plugin to the "Plugin Manager." 2. When using with other plugins, This plugin must be placed below the following plugins: FTKR_CustomSimpleActorStatus FTKR_ExSvMotion FTKR_FVActorAnimation.js ----------------------------------------------------------------------------- About Actor Facial Images ----------------------------------------------------------------------------- When using this plugin, actor facial images must meet the following specifications: Facial image size: 144 x 144 Arrange facial images in up to six columns horizontally and three rows vertically in one file. Face images are numbered as follows: 0 for the top left, 1 for the next right, and 6 for the next down. You can set up to 18 different face images per image file. Save the file in the img/face/ folder. Use the plugin parameters to specify which face image to use for each state. Please note that if there is no image for the specified number, the field will be left blank. ----------------------------------------------------------------------------- Basic Specifications ----------------------------------------------------------------------------- When using this plugin alone, the face image displayed on the battle screen changes depending on the actor's state. The default plugin state specifies image 0 for all actor states. Set the plugin parameter value as needed. Face images on all screens other than battle use image 0. ----------------------------------------------------------------------------- When used in conjunction with FTKR_CustomSimpleActorStatus ----------------------------------------------------------------------------- The face image displayed changes depending on the FTKR_CustomSimpleActorStatus setting. The valid states are the same as the basic specifications. The same applies to the following extension plugins. FTKR_CSS_DetailedStatus FTKR_CSS_SkillStatus ----------------------------------------------------------------------------- When used in conjunction with FTKR_CSS_BattleStatus ----------------------------------------------------------------------------- Changes the face image depending on the actor's state during battle. You can also change the face image during an actor's action. ---------------------------------------------------------------------------- When used in conjunction with FTKR_ExSvMotion ----------------------------------------------------------------------------- Changes the face image displayed according to the FTKR_ExSvMotion settings. If you have changed the motions for each state in the FTKR_ExSvMotion settings, the face image will also change to the same motion number. You can also set the face image number to use when recovering and for custom motions. When using a different image motion, the face image file set in the actor's Note field will be used. Add the following tag to the actor's Note field. Save the image file, filename.png, in img/face/. ----------------------------------------------------------------------------- License for this plugin ----------------------------------------------------------------------------- This plugin is released under the MIT License. Copyright (c) 2017 Futokoro http://opensource.org/licenses/mit-license.php Plugin source https://github.com/futokoro/RPGMaker/blob/master/README.md ----------------------------------------------------------------------------- Change History ----------------------------------------------------------------------------- v2.0.1 - 2017/12/16: Bug fixes 1. Revised to allow use with FTKR_SvMotion.js. 2. Fixed a bug where the face image would not revert to the default after battle. v2.0.0 - December 16, 2017: First version created (derived from FTKR_FacialImageDifference v1.1.7) 1. Removed animation and damage popup functionality. 2. Changed facial image sprites to be referenced from FTKR_FVActorAnimation.js. ----------------------------------------------------------------------------- @param --画像番号変更-- @text --Image number change-- @param Walk Face Index @desc Set the face image number when moving forward @default 0 @param Wait Face Index @desc Set the face image number when in standby mode @default 0 @param Chant Face Index @desc Set the face image number when chanting @default 0 @param Guard Face Index @desc Set the face image number when defending @default 0 @param Damage Face Index @desc Set the face image number when damaged @default 0 @param Evade Face Index @desc Set the face image number when avoiding @default 0 @param Thrust Face Index @desc Set the face image number when thrusting @default 0 @param Swing Face Index @desc Set the face image number when making a payment @default 0 @param Missile Face Index @desc Set the face image number when using a projectile @default 0 @param Skill Face Index @desc Set the face image number when using defense @default 0 @param Spell Face Index @desc Set the face image number when using magic @default 0 @param Item Face Index @desc Set the face image number when using the item @default 0 @param Escape Face Index @desc Set the face image number when escaping @default 0 @param Victory Face Index @desc Set the face image number when winning a battle @default 0 @param Dying Face Index @desc Set the face image number when near death @default 0 @param Abnormal Face Index @desc Set the face image number when the status is abnormal @default 0 @param Sleep Face Index @desc Set the face image number when sleeping @default 0 @param Dead Face Index @desc Set the face image number when Collapse @default 0 @param --FTKR_ExSvMotionの設定-- @text --FTKR_ExSvMotion settings-- @param Recovery Face Index @desc Set the face image number when HP is recovered @default 0 @param Custom1 Face Index @desc Set the face image number for Custom1 @default 0 @param Custom2 Face Index @desc Set the face image number for Custom2 @default 0 @param Custom3 Face Index @desc Set the face image number for Custom3 @default 0 @param Custom4 Face Index @desc Set the face image number for Custom4 @default 0 @param Custom5 Face Index @desc Set the face image number for Custom5 @default 0 @param Custom6 Face Index @desc Set the face image number for Custom6 @default 0 @param Custom7 Face Index @desc Set the face image number for Custom7 @default 0 @param Custom8 Face Index @desc Set the face image number for Custom8 @default 0 */ /*:ja @plugindesc v2.0.1 アクターの状態によって顔画像を変えるプラグイン @author Futokoro @url https://github.com/munokura/futokoro-MV-plugins @license MIT License @help ----------------------------------------------------------------------------- 概要 ----------------------------------------------------------------------------- 本プラグインを実装することで、戦闘中のアクターの顔画像を、 アクターのさまざまな状態によって変更します。 ----------------------------------------------------------------------------- 設定方法 ----------------------------------------------------------------------------- 1.「プラグインマネージャー(プラグイン管理)」に、本プラグインを追加して ください。 2. 他プラグインと組み合わせる場合 当プラグインは以下のプラグインよりも下にしてください。 FTKR_CustomSimpleActorStatus FTKR_ExSvMotion FTKR_FVActorAnimation.js ----------------------------------------------------------------------------- アクターの顔画像について ----------------------------------------------------------------------------- 本プラグインを使用する場合、アクターの顔画像は以下の規格のものを 使用してください。 一つの顔画像サイズ:144 * 144 一つのファイルには、顔画像を横に6列、縦に3行まで配置してください。 顔画像の番号は、左上を 0番、一つ右を 1番、一つ下を 6番と数えます。 一つの画像ファイルで最大18種類の顔画像を設定できます。 ファイルは、img/face/ フォルダに保存してください。 どの状態で何番の顔画像を使用するかは、プラグインパラメータで 設定してください。 なお、指定された番号の箇所に画像がない場合は、空欄で表示されますので 注意してください。 ----------------------------------------------------------------------------- 基本仕様 ----------------------------------------------------------------------------- 本プラグインを単独で使用する場合、アクターの状態によって 戦闘画面で表示する顔画像が変わります。 デフォルトのプラグインの状態では、すべてのアクターの状態に対して 0番の画像を指定しています。 必要に応じて、プラグインパラメータに値を設定してください。 なお、戦闘以外の画面での顔画像は、すべて 0番を使用します。 ----------------------------------------------------------------------------- FTKR_CustomSimpleActorStatus と併用する場合 ----------------------------------------------------------------------------- FTKR_CustomSimpleActorStatusの設定によって表示する顔画像を変更します。 有効な状態は、基本仕様と同じです。 以下の拡張プラグインについても同様です。 FTKR_CSS_DetailedStatus FTKR_CSS_SkillStatus ----------------------------------------------------------------------------- FTKR_CSS_BattleStatus と併用する場合 ----------------------------------------------------------------------------- バトル中のアクターの状態によって、顔画像を変更します。 アクターのアクション時にも、顔画像を変更することができます。 ----------------------------------------------------------------------------- FTKR_ExSvMotion と併用する場合 ----------------------------------------------------------------------------- FTKR_ExSvMotionの設定によって表示する顔画像を変更します。 FTKR_ExSvMotionの設定で、各状態のモーションを変更していた場合は、 その設定に合わせて、顔画像も同じモーションの番号に変更します。 また、回復時、およびカスタムモーション時に使用するの顔画像番号を 設定できます。 別画像モーション時には、アクターのメモ欄で設定した顔画像ファイルを 使用します。 アクターのメモ欄に以下のタグを追記してください。 画像ファイル filename.png は img/face/ に保存してください。 ----------------------------------------------------------------------------- 本プラグインのライセンスについて(License) ----------------------------------------------------------------------------- 本プラグインはMITライセンスのもとで公開しています。 This plugin is released under the MIT License. Copyright (c) 2017 Futokoro http://opensource.org/licenses/mit-license.php プラグイン公開元 https://github.com/futokoro/RPGMaker/blob/master/README.md ----------------------------------------------------------------------------- 変更来歴 ----------------------------------------------------------------------------- v2.0.1 - 2017/12/16 : 不具合修正 1. FTKR_SvMotion.jsと併用できるように見直し。 2. 戦闘終了後に顔画像がデフォルトに戻らない不具合修正。 v2.0.0 - 2017/12/16 : 初版作成(FTKR_FacialImageDifference v1.1.7から派生) 1. アニメーションおよびダメージポップアップ機能を削除。 2. 顔画像のスプライトをFTKR_FVActorAnimation.jsから参照する方式に変更。 ----------------------------------------------------------------------------- @param --画像番号変更-- @text --画像番号変更-- @param Walk Face Index @desc 前進時の顔画像番号を設定します @default 0 @param Wait Face Index @desc 待機時の顔画像番号を設定します @default 0 @param Chant Face Index @desc 詠唱時の顔画像番号を設定します @default 0 @param Guard Face Index @desc 防御時の顔画像番号を設定します @default 0 @param Damage Face Index @desc ダメージ時の顔画像番号を設定します @default 0 @param Evade Face Index @desc 回避時の顔画像番号を設定します @default 0 @param Thrust Face Index @desc 突き時の顔画像番号を設定します @default 0 @param Swing Face Index @desc 払い時の顔画像番号を設定します @default 0 @param Missile Face Index @desc 飛び道具時の顔画像番号を設定します @default 0 @param Skill Face Index @desc 防御使用時の顔画像番号を設定します @default 0 @param Spell Face Index @desc 魔法使用時の顔画像番号を設定します @default 0 @param Item Face Index @desc アイテム使用時の顔画像番号を設定します @default 0 @param Escape Face Index @desc 逃走時の顔画像番号を設定します @default 0 @param Victory Face Index @desc 戦闘勝利時の顔画像番号を設定します @default 0 @param Dying Face Index @desc 瀕死時の顔画像番号を設定します @default 0 @param Abnormal Face Index @desc 状態異常時の顔画像番号を設定します @default 0 @param Sleep Face Index @desc 睡眠時の顔画像番号を設定します @default 0 @param Dead Face Index @desc 戦闘不能時の顔画像番号を設定します @default 0 @param --FTKR_ExSvMotionの設定-- @text --FTKR_ExSvMotionの設定-- @param Recovery Face Index @desc HP回復時の顔画像番号を設定します @default 0 @param Custom1 Face Index @desc Custom1の時の顔画像番号を設定します @default 0 @param Custom2 Face Index @desc Custom2の時の顔画像番号を設定します @default 0 @param Custom3 Face Index @desc Custom3の時の顔画像番号を設定します @default 0 @param Custom4 Face Index @desc Custom4の時の顔画像番号を設定します @default 0 @param Custom5 Face Index @desc Custom5の時の顔画像番号を設定します @default 0 @param Custom6 Face Index @desc Custom6の時の顔画像番号を設定します @default 0 @param Custom7 Face Index @desc Custom7の時の顔画像番号を設定します @default 0 @param Custom8 Face Index @desc Custom8の時の顔画像番号を設定します @default 0 */ //============================================================================= (function () { //============================================================================= // プラグイン パラメータ //============================================================================= var parameters = PluginManager.parameters('FTKR_FacialImageDifference2'); //オリジナルステータス設定オブジェクト FTKR.FID.faces = { wait: Number(parameters['Wait Face Index'] || 0), walk: Number(parameters['Walk Face Index'] || 0), chant: Number(parameters['Chant Face Index'] || 0), guard: Number(parameters['Guard Face Index'] || 0), damage: Number(parameters['Damage Face Index'] || 0), evade: Number(parameters['Evade Face Index'] || 0), thrust: Number(parameters['Thrust Face Index'] || 0), swing: Number(parameters['Swing Face Index'] || 0), missile: Number(parameters['Missile Face Index'] || 0), skill: Number(parameters['Skill Face Index'] || 0), spell: Number(parameters['Spell Face Index'] || 0), item: Number(parameters['Item Face Index'] || 0), escape: Number(parameters['Escape Face Index'] || 0), victory: Number(parameters['Victory Face Index'] || 0), dying: Number(parameters['Dying Face Index'] || 0), abnormal: Number(parameters['Abnormal Face Index'] || 0), sleep: Number(parameters['Sleep Face Index'] || 0), dead: Number(parameters['Dead Face Index'] || 0), recovery: Number(parameters['recovery Face Index'] || 0), custom1: Number(parameters['Custom1 Face Index'] || 0), custom2: Number(parameters['Custom2 Face Index'] || 0), custom3: Number(parameters['Custom3 Face Index'] || 0), custom4: Number(parameters['Custom4 Face Index'] || 0), custom5: Number(parameters['Custom5 Face Index'] || 0), custom6: Number(parameters['Custom6 Face Index'] || 0), custom7: Number(parameters['Custom7 Face Index'] || 0), custom8: Number(parameters['Custom8 Face Index'] || 0), }; //objのメモ欄から の値を読み取って配列で返す var readObjectMeta = function (obj, metacodes) { if (!obj) return false; var match = {}; metacodes.some(function (metacode) { var metaReg = new RegExp('<' + metacode + ':[ ]*(.+)>', 'i'); match = metaReg.exec(obj.note); return match; }); return match ? match[1] : ''; }; //============================================================================= // バトラーに顔画像の設定を追加 //============================================================================= var _FID_Game_Battler_initMembers = Game_Battler.prototype.initMembers; Game_Battler.prototype.initMembers = function () { _FID_Game_Battler_initMembers.call(this); this._faceType = null; this._faceIndex = 0; }; Game_Battler.prototype.clearFace = function () { this._faceIndex = 0; }; var _FID_Game_Battler_requestMotion = Game_Battler.prototype.requestMotion; Game_Battler.prototype.requestMotion = function (motionType) { _FID_Game_Battler_requestMotion.call(this, motionType); this._faceType = this._motionType; }; if (!Imported.FTKR_FAA) { var _FID_Game_Actor_performDamage = Game_Actor.prototype.performDamage; Game_Actor.prototype.performDamage = function () { _FID_Game_Actor_performDamage.call(this); this.requestMotion('damage'); }; } //============================================================================= // Sprite_Actorの修正 // アクターの顔画像表示処理を追加 //============================================================================= var _FID_Sprite_Actor_startMotion = Sprite_Actor.prototype.startMotion; Sprite_Actor.prototype.startMotion = function (motionType) { _FID_Sprite_Actor_startMotion.call(this, motionType); this.refreshFace(this.faceTypeIndex(motionType)); }; Sprite_Actor.prototype.faceTypeIndex = function (motionType) { if (!motionType) return 0; if (Imported.FTKR_ESM && !this._motion) return 0; var faceType = Imported.FTKR_ESM ? this.convertOtherMotion(this.motionName()) : motionType; return FTKR.FID.faces[faceType]; }; Sprite_Actor.prototype.refreshFace = function (faceIndex) { if (this._actor && this._actor._faceIndex !== faceIndex) { this._actor._faceIndex = faceIndex; if (BattleManager._statusWindow) BattleManager._statusWindow.refresh(); } }; //書き換え Window_BattleStatus.prototype.drawActorFace = function (actor, x, y, width, height) { this.drawFace(actor.faceName(), actor._faceIndex, x, y, width, height); }; //書き換え Window_BattleStatus.prototype.drawFace = function (faceName, faceIndex, x, y, width, height) { width = width || Window_Base._faceWidth; height = height || Window_Base._faceHeight; var bitmap = ImageManager.loadFace(faceName); var pw = Window_Base._faceWidth; var ph = Window_Base._faceHeight; var sw = Math.min(width, pw); var sh = Math.min(height, ph); var dx = Math.floor(x + Math.max(width - pw, 0) / 2); var dy = Math.floor(y + Math.max(height - ph, 0) / 2); var sx = faceIndex % 6 * pw + (pw - sw) / 2; var sy = Math.floor(faceIndex / 6) * ph + (ph - sh) / 2; this.contents.blt(bitmap, sx, sy, sw, sh, dx, dy); }; //書き換え Window_Base.prototype.drawCssFace = function (actor, dx, dy, width, height) { var len = Math.min(width, height); var dh = len || Window_Base._faceHeight; var dw = len || Window_Base._faceWidth; var offsetX = FTKR.CSS.cssStatus.face.posiX * (width - dw) / 2; dx = Math.floor(dx + offsetX); var bitmap = ImageManager.loadFace(actor.faceName()); var sw = Window_Base._faceWidth; var sh = Window_Base._faceHeight; var sx = actor._faceIndex % 6 * sw; var sy = Math.floor(actor.faceIndex() / 6) * sh; this.contents.blt(bitmap, sx, sy, sw, sh, dx, dy, dw, dh); }; //============================================================================= // FTKR_FVActorAnimation.jsの修正 // アクターの顔画像表示処理を修正 //============================================================================= if (Imported.FTKR_FAA && FTKR.FAA.destination == 1) { Sprite_ActorFace.prototype.refreshFace = function (faceIndex) { }; Sprite_ActorFace.prototype.updateFrame = function () { Sprite_Battler.prototype.updateFrame.call(this); var bitmap = this._mainSprite.bitmap; if (bitmap) { var cw = Sprite_ActorFace._imageWidth; var ch = Sprite_ActorFace._imageHeight; var motionIndex = this._actor._faceIndex; var cx = motionIndex % 6; var cy = Math.floor(motionIndex / 6); this._mainSprite.setFrame(cx * cw, cy * ch, cw, ch); } }; } //============================================================================= // Scene_Base // シーン変更時に顔番号をリセット //============================================================================= var _FID_Scene_Base_start = Scene_Base.prototype.start; Scene_Base.prototype.start = function () { _FID_Scene_Base_start.call(this); this.resetActorFaceType(); }; Scene_Base.prototype.resetActorFaceType = function () { if (!$gameParty) return; $gameParty.members().forEach(function (member) { member.clearFace(); }); }; }());//EOF