查看: 3411|回复: 2

[有事请教] 请问这个用战斗图做头像的脚本怎么让他战斗时不使用

[复制链接]
梦石
0
星屑
165
在线时间
38 小时
注册时间
2021-6-1
回帖
32
发表于 2021-6-30 18:41:17 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 huangchaoyong 于 2021-7-2 07:41 编辑

[pre lang="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
*
* このプラグインは以下のメモタグの設定ができます。
*
* -----------------------------------------------------------------------------
* ステートに設定するメモタグ
*
* <menuActorMotion:[モーション名]>
*  ステート時にアクターのモーションを変更します
*  [モーション名] - 変更するモーションの名称を設定します(文字列)
*                   「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 || {})));
[/pre]
这个脚本和NRP_DynamicAnimationMZ脚本一起使用时战斗中显示异常能不能把战斗中头像用战斗图表示关闭让战斗恢复原来的显示方法
捕获.PNG
070940vqife60gjd0geij0.gif
梦石
0
星屑
2585
在线时间
297 小时
注册时间
2021-5-4
回帖
97
发表于 2021-6-30 20:05:22 | 显示全部楼层
  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();
        };
y+height/2 就是设置高度 增加值就可以了 把除2 拿掉看看高度如何
回复

使用道具 举报

梦石
0
星屑
165
在线时间
38 小时
注册时间
2021-6-1
回帖
32
 楼主| 发表于 2021-7-1 06:53:43 | 显示全部楼层
本帖最后由 huangchaoyong 于 2021-7-2 07:35 编辑

sdds.gif dsfs 73.png 战斗中显示异常能不能把战斗中头像用战斗图表示关闭让战斗恢复原来的显示方法
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部