RUBY 代码 - //==============================================================================
- // dsSVActorForMenuMZ.js
- // Copyright (c) 2015 - 2020 DOURAKU
- // Released under the MIT License.
- // http://opensource.org/licenses/mit-license.php
- //==============================================================================
- /*:
- * @target MZ
- * @plugindesc 头像用行走图表示 ver1.0.0
- * @author 道楽
- *
- * @param Actor Motion Idle
- * @type string
- * @desc 非選択時のアクターのモーション
- * @default walk
- *
- * @param Actor Motion Active
- * @type string
- * @desc 選択時のアクターのモーション
- * @default victory
- *
- * @param Apply States Motion
- * @type boolean
- * @desc ステートに設定されている[SV]モーションの影響を与えます
- * @default false
- *
- * @help
- * 使用できるモーション名
- * walk wait
- * chant guard
- * damage evade
- * thrust swing
- * missile skill
- * spell item
- * escape victory
- * dying abnormal
- * sleep dead
- *
- * このプラグインは以下のメモタグの設定ができます。
- *
- * -----------------------------------------------------------------------------
- * ステートに設定するメモタグ
- *
- *
- * ステート時にアクターのモーションを変更します
- * [モーション名] - 変更するモーションの名称を設定します(文字列)
- * 「Apply States Motion」がtrueの場合でもこちらが優先されます
- */
- var Imported = Imported || {};
- Imported.dsSVActorForMenuMZ = true;
- (function (exports) {
- 'use strict';
- exports.Param = (function() {
- var ret = {};
- var parameters = PluginManager.parameters("dsSVActorForMenuMZ");
- ret.ActorMotionIdle = String(parameters["Actor Motion Idle"]);
- ret.ActorMotionActive = String(parameters["Actor Motion Active"]);
- ret.ApplyStatesMotion = Boolean(parameters["Apply States Motion"]);
- return ret;
- })();
- //--------------------------------------------------------------------------
- /** SceneManager */
- SceneManager.isCurrentScene = function(sceneClass)
- {
- return this._scene && this._scene.constructor === sceneClass;
- };
- //--------------------------------------------------------------------------
- /** Game_Actor */
- (function () {
- const base = Game_Actor.prototype.isSpriteVisible;
- Game_Actor.prototype.isSpriteVisible = function()
- {
- if ( !SceneManager.isCurrentScene(Scene_Battle) )
- {
- return true;
- }
- return base.call(this);
- };
- }());
- Game_Actor.prototype.motionTypeMenu = function()
- {
- var states = this.states();
- if ( states.length > 0 )
- {
- if ( states[0].meta.menuActorMotion )
- {
- return states[0].meta.menuActorMotion;
- }
- }
- if ( exports.Param.ApplyStatesMotion )
- {
- switch ( this.stateMotionIndex() )
- {
- case 1: return "abnormal";
- case 2: return "sleep";
- case 3: return "dead";
- }
- }
- return "";
- };
- Game_Actor.prototype.motionTypeMenuIdle = function()
- {
- var motion = this.motionTypeMenu();
- return (motion !== "") ? motion : exports.Param.ActorMotionIdle;
- };
- Game_Actor.prototype.motionTypeMenuActive = function()
- {
- var motion = this.motionTypeMenu();
- return (motion !== "") ? motion : exports.Param.ActorMotionActive;
- };
- //--------------------------------------------------------------------------
- /** Sprite_ActorMenu */
- exports.Sprite_ActorMenu = (function() {
- function Sprite_ActorMenu()
- {
- this.initialize.apply(this, arguments);
- }
- Sprite_ActorMenu.prototype = Object.create(Sprite_Actor.prototype);
- Sprite_ActorMenu.prototype.constructor = Sprite_ActorMenu;
- Sprite_ActorMenu.prototype.createMainSprite = function()
- {
- Sprite_Actor.prototype.createMainSprite.call(this);
- this._mainSprite.anchor.y = 0.5;
- };
- Sprite_ActorMenu.prototype.startIdleMotion = function()
- {
- this.startMotion(this._actor.motionTypeMenuIdle());
- };
- Sprite_ActorMenu.prototype.startActiveMotion = function()
- {
- this.startMotion(this._actor.motionTypeMenuActive());
- };
- Sprite_ActorMenu.prototype.updateMotion = function()
- {
- this.updateMotionCount();
- };
- Sprite_ActorMenu.prototype.updateShadow = function()
- {
- this._shadowSprite.hide();
- };
- // unused
- Sprite_ActorMenu.prototype.updateDamagePopup = function() {};
- Sprite_ActorMenu.prototype.startEntryMotion = function() {};
- Sprite_ActorMenu.prototype.setActorHome = function(index) {};
- Sprite_ActorMenu.prototype.startMove = function(x, y, duration) {};
- Sprite_ActorMenu.prototype.moveToStartPosition = function() {};
- return Sprite_ActorMenu;
- })();
- //--------------------------------------------------------------------------
- /** Window_StatusBase */
- (function () {
- const base = Window_StatusBase.prototype.loadFaceImages;
- Window_StatusBase.prototype.loadFaceImages = function()
- {
- for ( const actor of $gameParty.members() )
- {
- ImageManager.loadSvActor(actor.battlerName());
- }
- };
- }());
- (function () {
- const base = Window_StatusBase.prototype.paint;
- Window_StatusBase.prototype.paint = function()
- {
- this.hideAdditionalSprites();
- base.apply(this, arguments);
- };
- }());
- Window_StatusBase.prototype.isActiveSprite = function(index)
- {
- if ( this.active )
- {
- if ( this.cursorAll() )
- {
- return true;
- }
- else if ( this.index() >= 0 )
- {
- if ( index === this.index() )
- {
- return true;
- }
- if ( index === this._pendingIndex )
- {
- return true;
- }
- }
- }
- return false;
- };
- Window_StatusBase.prototype.createActorMenuSprite = function(actor)
- {
- const key = "actor%1-svactor".format(actor.actorId());
- var sprite = this.createInnerSprite(key, exports.Sprite_ActorMenu);
- sprite.setBattler(actor);
- return sprite;
- };
- Window_StatusBase.prototype.placeSVActor = function(actor, x, y, width, height)
- {
- var sprite = this.createActorMenuSprite(actor);
- sprite.setHome(x + width / 2, y + height / 2);
- sprite.startIdleMotion();
- sprite.show();
- };
- Window_StatusBase.prototype.drawActorFace = function(actor, x, y, width, height)
- {
- width = width || ImageManager.faceWidth;
- height = height || ImageManager.faceHeight;
- this.placeSVActor(actor, x, y, width, height);
- };
- //--------------------------------------------------------------------------
- /** Window_MenuStatus */
- (function () {
- const base = Window_MenuStatus.prototype.update;
- Window_MenuStatus.prototype.update = function()
- {
- base.apply(this, arguments);
- this.updateActorSprites();
- };
- }());
- Window_MenuStatus.prototype.updateActorSprites = function()
- {
- const maxItem = this.maxItems();
- const maxVisible = this.maxVisibleItems();
- const opacity = this.translucentOpacity();
- const topIndex = this.topIndex();
- for ( let ii = 0; ii < maxVisible; ii++ )
- {
- const index = topIndex + ii;
- if (index >= maxItem)
- {
- continue;
- }
- const actor = this.actor(index);
- const sprite = this.createActorMenuSprite(actor);
- sprite.opacity = actor.isBattleMember() ? 255 : opacity;
- if ( this.isActiveSprite(index) )
- {
- sprite.startActiveMotion();
- }
- else
- {
- sprite.startIdleMotion();
- }
- }
- };
- //--------------------------------------------------------------------------
- /** Window_EquipStatus */
- (function () {
- const base = Window_EquipStatus.prototype.refresh;
- Window_EquipStatus.prototype.refresh = function()
- {
- this.hideAdditionalSprites();
- base.apply(this, arguments);
- };
- }());
- //--------------------------------------------------------------------------
- /** Window_BattleStatus */
- (function () {
- const base = Window_BattleStatus.prototype.update;
- Window_BattleStatus.prototype.update = function()
- {
- base.apply(this, arguments);
- this.updateActorSprites();
- };
- }());
- Window_BattleStatus.prototype.updateActorSprites = function()
- {
- const maxItem = this.maxItems();
- const maxVisible = this.maxVisibleItems();
- const opacity = this.translucentOpacity();
- const topIndex = this.topIndex();
- for ( let ii = 0; ii < maxVisible; ii++ )
- {
- const index = topIndex + ii;
- if (index >= maxItem)
- {
- continue;
- }
- const actor = this.actor(index);
- const sprite = this.createActorMenuSprite(actor);
- sprite.opacity = actor.isBattleMember() ? 255 : opacity;
- sprite.startIdleMotion();
- }
- };
- }((this.dsSVActorForMenuMZ = this.dsSVActorForMenuMZ || {})));
复制代码
这个脚本和NRP_DynamicAnimationMZ脚本一起使用时战斗中显示异常能不能把战斗中头像用战斗图表示关闭让战斗恢复原来的显示方法

本帖来自P1论坛作者huangchaoyong,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址: https://rpg.blue/forum.php?mod=viewthread&tid=486185 若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。 |