查看: 3476|回复: 2

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

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

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

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

×
本帖最后由 huangchaoyong 于 2021-7-2 07:41 编辑
  1. //==============================================================================
  2. // dsSVActorForMenuMZ.js
  3. // Copyright (c) 2015 - 2020 DOURAKU
  4. // Released under the MIT License.
  5. // http://opensource.org/licenses/mit-license.php
  6. //==============================================================================

  7. /*:
  8. * @target MZ
  9. * @plugindesc 头像用行走图表示 ver1.0.0
  10. * @author 道楽
  11. *
  12. * @param Actor Motion Idle
  13. * @type string
  14. * @desc 非選択時のアクターのモーション
  15. * @default walk
  16. *
  17. * @param Actor Motion Active
  18. * @type string
  19. * @desc 選択時のアクターのモーション
  20. * @default victory
  21. *
  22. * @param Apply States Motion
  23. * @type boolean
  24. * @desc ステートに設定されている[SV]モーションの影響を与えます
  25. * @default false
  26. *
  27. * @help
  28. * 使用できるモーション名
  29. *   walk     wait
  30. *   chant    guard
  31. *   damage   evade
  32. *   thrust   swing
  33. *   missile  skill
  34. *   spell    item
  35. *   escape   victory
  36. *   dying    abnormal
  37. *   sleep    dead
  38. *
  39. * このプラグインは以下のメモタグの設定ができます。
  40. *
  41. * -----------------------------------------------------------------------------
  42. * ステートに設定するメモタグ
  43. *
  44. * <menuActorMotion:[モーション名]>
  45. *  ステート時にアクターのモーションを変更します
  46. *  [モーション名] - 変更するモーションの名称を設定します(文字列)
  47. *                   「Apply States Motion」がtrueの場合でもこちらが優先されます
  48. */

  49. var Imported = Imported || {};
  50. Imported.dsSVActorForMenuMZ = true;

  51. (function (exports) {
  52.         'use strict';

  53.         exports.Param = (function() {
  54.                 var ret = {};
  55.                 var parameters = PluginManager.parameters("dsSVActorForMenuMZ");
  56.                 ret.ActorMotionIdle = String(parameters["Actor Motion Idle"]);
  57.                 ret.ActorMotionActive = String(parameters["Actor Motion Active"]);
  58.                 ret.ApplyStatesMotion = Boolean(parameters["Apply States Motion"]);
  59.                 return ret;
  60.         })();

  61.         //--------------------------------------------------------------------------
  62.         /** SceneManager */
  63.         SceneManager.isCurrentScene = function(sceneClass)
  64.         {
  65.                 return this._scene && this._scene.constructor === sceneClass;
  66.         };

  67.         //--------------------------------------------------------------------------
  68.         /** Game_Actor */
  69.         (function () {
  70.                 const base = Game_Actor.prototype.isSpriteVisible;
  71.                 Game_Actor.prototype.isSpriteVisible = function()
  72.                 {
  73.                         if ( !SceneManager.isCurrentScene(Scene_Battle) )
  74.                         {
  75.                                 return true;
  76.                         }
  77.                         return base.call(this);
  78.                 };
  79.         }());

  80.         Game_Actor.prototype.motionTypeMenu = function()
  81.         {
  82.                 var states = this.states();
  83.                 if ( states.length > 0 )
  84.                 {
  85.                         if ( states[0].meta.menuActorMotion )
  86.                         {
  87.                                 return states[0].meta.menuActorMotion;
  88.                         }
  89.                 }
  90.                 if ( exports.Param.ApplyStatesMotion )
  91.                 {
  92.                         switch ( this.stateMotionIndex() )
  93.                         {
  94.                         case 1: return "abnormal";
  95.                         case 2: return "sleep";
  96.                         case 3: return "dead";
  97.                         }
  98.                 }
  99.                 return "";
  100.         };

  101.         Game_Actor.prototype.motionTypeMenuIdle = function()
  102.         {
  103.                 var motion = this.motionTypeMenu();
  104.                 return (motion !== "") ? motion : exports.Param.ActorMotionIdle;
  105.         };

  106.         Game_Actor.prototype.motionTypeMenuActive = function()
  107.         {
  108.                 var motion = this.motionTypeMenu();
  109.                 return (motion !== "") ? motion : exports.Param.ActorMotionActive;
  110.         };

  111.         //--------------------------------------------------------------------------
  112.         /** Sprite_ActorMenu */
  113.         exports.Sprite_ActorMenu = (function() {

  114.                 function Sprite_ActorMenu()
  115.                 {
  116.                         this.initialize.apply(this, arguments);
  117.                 }

  118.                 Sprite_ActorMenu.prototype = Object.create(Sprite_Actor.prototype);
  119.                 Sprite_ActorMenu.prototype.constructor = Sprite_ActorMenu;

  120.                 Sprite_ActorMenu.prototype.createMainSprite = function()
  121.                 {
  122.                         Sprite_Actor.prototype.createMainSprite.call(this);
  123.                         this._mainSprite.anchor.y = 0.5;
  124.                 };

  125.                 Sprite_ActorMenu.prototype.startIdleMotion = function()
  126.                 {
  127.                         this.startMotion(this._actor.motionTypeMenuIdle());
  128.                 };

  129.                 Sprite_ActorMenu.prototype.startActiveMotion = function()
  130.                 {
  131.                         this.startMotion(this._actor.motionTypeMenuActive());
  132.                 };

  133.                 Sprite_ActorMenu.prototype.updateMotion = function()
  134.                 {
  135.                         this.updateMotionCount();
  136.                 };

  137.                 Sprite_ActorMenu.prototype.updateShadow = function()
  138.                 {
  139.                         this._shadowSprite.hide();
  140.                 };

  141.                 // unused
  142.                 Sprite_ActorMenu.prototype.updateDamagePopup = function() {};
  143.                 Sprite_ActorMenu.prototype.startEntryMotion = function() {};
  144.                 Sprite_ActorMenu.prototype.setActorHome = function(index) {};
  145.                 Sprite_ActorMenu.prototype.startMove = function(x, y, duration) {};
  146.                 Sprite_ActorMenu.prototype.moveToStartPosition = function() {};

  147.                 return Sprite_ActorMenu;
  148.         })();

  149.         //--------------------------------------------------------------------------
  150.         /** Window_StatusBase */
  151.         (function () {
  152.                 const base = Window_StatusBase.prototype.loadFaceImages;
  153.                 Window_StatusBase.prototype.loadFaceImages = function()
  154.                 {
  155.                         for ( const actor of $gameParty.members() )
  156.                         {
  157.                                 ImageManager.loadSvActor(actor.battlerName());
  158.                         }
  159.                 };
  160.         }());

  161.         (function () {
  162.                 const base = Window_StatusBase.prototype.paint;
  163.                 Window_StatusBase.prototype.paint = function()
  164.                 {
  165.                         this.hideAdditionalSprites();
  166.                         base.apply(this, arguments);
  167.                 };
  168.         }());

  169.         Window_StatusBase.prototype.isActiveSprite = function(index)
  170.         {
  171.                 if ( this.active )
  172.                 {
  173.                         if ( this.cursorAll() )
  174.                         {
  175.                                 return true;
  176.                         }
  177.                         else if ( this.index() >= 0 )
  178.                         {
  179.                                 if ( index === this.index() )
  180.                                 {
  181.                                         return true;
  182.                                 }
  183.                                 if ( index === this._pendingIndex )
  184.                                 {
  185.                                         return true;
  186.                                 }
  187.                         }
  188.                 }
  189.                 return false;
  190.         };

  191.         Window_StatusBase.prototype.createActorMenuSprite = function(actor)
  192.         {
  193.                 const key = "actor%1-svactor".format(actor.actorId());
  194.                 var sprite = this.createInnerSprite(key, exports.Sprite_ActorMenu);
  195.                 sprite.setBattler(actor);
  196.                 return sprite;
  197.         };

  198.         Window_StatusBase.prototype.placeSVActor = function(actor, x, y, width, height)
  199.         {
  200.                 var sprite = this.createActorMenuSprite(actor);
  201.                 sprite.setHome(x + width / 2, y + height / 2);
  202.                 sprite.startIdleMotion();
  203.                 sprite.show();
  204.         };

  205.         Window_StatusBase.prototype.drawActorFace = function(actor, x, y, width, height)
  206.         {
  207.                 width = width || ImageManager.faceWidth;
  208.                 height = height || ImageManager.faceHeight;
  209.                 this.placeSVActor(actor, x, y, width, height);
  210.         };

  211.         //--------------------------------------------------------------------------
  212.         /** Window_MenuStatus */
  213.         (function () {
  214.                 const base = Window_MenuStatus.prototype.update;
  215.                 Window_MenuStatus.prototype.update = function()
  216.                 {
  217.                         base.apply(this, arguments);
  218.                         this.updateActorSprites();
  219.                 };
  220.         }());

  221.         Window_MenuStatus.prototype.updateActorSprites = function()
  222.         {
  223.                 const maxItem = this.maxItems();
  224.                 const maxVisible = this.maxVisibleItems();
  225.                 const opacity = this.translucentOpacity();
  226.                 const topIndex = this.topIndex();
  227.                 for ( let ii = 0; ii < maxVisible; ii++ )
  228.                 {
  229.                         const index = topIndex + ii;
  230.                         if (index >= maxItem)
  231.                         {
  232.                                 continue;
  233.                         }
  234.                         const actor = this.actor(index);
  235.                         const sprite = this.createActorMenuSprite(actor);
  236.                         sprite.opacity = actor.isBattleMember() ? 255 : opacity;
  237.                         if ( this.isActiveSprite(index) )
  238.                         {
  239.                                 sprite.startActiveMotion();
  240.                         }
  241.                         else
  242.                         {
  243.                                 sprite.startIdleMotion();
  244.                         }
  245.                 }
  246.         };

  247.         //--------------------------------------------------------------------------
  248.         /** Window_EquipStatus */
  249.         (function () {
  250.                 const base = Window_EquipStatus.prototype.refresh;
  251.                 Window_EquipStatus.prototype.refresh = function()
  252.                 {
  253.                         this.hideAdditionalSprites();
  254.                         base.apply(this, arguments);
  255.                 };
  256.         }());

  257.         //--------------------------------------------------------------------------
  258.         /** Window_BattleStatus */
  259.         (function () {
  260.                 const base = Window_BattleStatus.prototype.update;
  261.                 Window_BattleStatus.prototype.update = function()
  262.                 {
  263.                         base.apply(this, arguments);
  264.                         this.updateActorSprites();
  265.                 };
  266.         }());

  267.         Window_BattleStatus.prototype.updateActorSprites = function()
  268.         {
  269.                 const maxItem = this.maxItems();
  270.                 const maxVisible = this.maxVisibleItems();
  271.                 const opacity = this.translucentOpacity();
  272.                 const topIndex = this.topIndex();
  273.                 for ( let ii = 0; ii < maxVisible; ii++ )
  274.                 {
  275.                         const index = topIndex + ii;
  276.                         if (index >= maxItem)
  277.                         {
  278.                                 continue;
  279.                         }
  280.                         const actor = this.actor(index);
  281.                         const sprite = this.createActorMenuSprite(actor);
  282.                         sprite.opacity = actor.isBattleMember() ? 255 : opacity;
  283.                         sprite.startIdleMotion();
  284.                 }
  285.         };

  286. }((this.dsSVActorForMenuMZ = this.dsSVActorForMenuMZ || {})));
复制代码

这个脚本和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.

在本版发帖返回顶部