设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 628|回复: 4
打印 上一主题 下一主题

[有事请教] 求一个行走图叠加插件

[复制链接]

Lv2.观梦者

梦石
0
星屑
285
在线时间
43 小时
注册时间
2023-9-28
帖子
28
跳转到指定楼层
1
发表于 2023-11-2 20:19:30 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
如题,由于我制作的游戏里使用同一种武器(《鬼灭之刃》的日轮刀)的角色与NPC很多,我想为他们添加行走图里的武器。
但没有叠加图层的插件的话,需要每一个角色都做一个持刀差分。
作为学牲,我没那么多时间。
我希望可以通过叠加行走图来完成武器装备。(就像元气骑士的武器那样)
目前我已经有了一个MBS_VisualEquipment,
但这个玩意在关闭队列行进时是这个B样的:

很明显,RMMV关闭队列行进只是隐藏了跟随的角色的图层,MBS插件引用的图层却没被隐藏。
所以,我希望有大大帮忙找一个没有这个BUG的平替插件,
或是教我编辑这个js,修复这个BUG
原插件在此:
MBS_VisualEquipment.zip (3.23 KB, 下载次数: 10)

Lv3.寻梦者

梦石
0
星屑
2459
在线时间
409 小时
注册时间
2016-2-3
帖子
755
2
发表于 2023-11-5 19:39:12 | 只看该作者
自己写的坐骑插件,不保证完全能用,可以试试看

  1. //=============================================================================
  2. // Zeros_RidingSystem.js
  3. //=============================================================================
  4. /*:
  5. * @plugindesc
  6. * @author 零殇
  7. *
  8. * @param v
  9. * @desc 版本
  10. * @default 1.0
  11. *
  12. * @help
  13. *
  14. * 上坐骑图片叫做Vehicle.png,放在img/characters下面,目前只适配角色大小和坐骑图大小一样的(标准)图片,否则会出现问题
  15. * 坐骑图片编号:图片第一行0 1 2 3,第二行4 5 6 7
  16. *
  17. * 使用方法:
  18. * 事件.setRidingCharacter('Vehicle',坐骑图片编号,玩家x偏移,玩家y偏移,玩家在坐骑上的高度);
  19. *
  20. * setRidingCharacterFront('Vehicle')  //设置坐骑前景(如果有的话可以设置这张覆盖在角色上面的图片)
  21. *
  22. * 比如:
  23. * 上坐骑
  24. * $gamePlayer.setRidingCharacter('Vehicle',0,5,5,20);
  25. * 设置坐骑前景
  26. * $gamePlayer.setRidingCharacterFront('VehicleFrontz')
  27. * 下坐骑
  28. * $gamePlayer.clearRidingCharacter()
  29. */

  30. (function () {

  31.     Game_CharacterBase.prototype.setRidingCharacter = function (characterName, idx, charaHeigh, charadx, charady) {
  32.         this._ridingCharacterName = characterName;
  33.         this._ridingCharacterIndex = idx | 0;
  34.         this._charadx = charadx | 5;
  35.         this._charady = charady | 5;
  36.         this._charaHeight = charaHeigh | 20;
  37.         SceneManager.goto(Scene_Map)
  38.     };

  39.     Game_CharacterBase.prototype.setRidingCharacterFront = function (characterName) {
  40.         this._ridingCharacterNameFront = characterName;
  41.     }

  42.     // 检查角色是否骑坐骑
  43.     Game_CharacterBase.prototype.isRiding = function () {
  44.         return !!this._ridingCharacterName;
  45.     };

  46.     // 清除角色的坐骑行走图
  47.     Game_CharacterBase.prototype.clearRidingCharacter = function () {
  48.         this._ridingCharacterName = '';
  49.         this._ridingCharacterNameFront = '';
  50.         this._ridingCharacterIndex = 0;
  51.         SceneManager.goto(Scene_Map)
  52.     };

  53.     // 覆盖Sprite_Character的_updateBitmap方法
  54.     const _Sprite_Character_updateBitmap = Sprite_Character.prototype.updateBitmap;
  55.     Sprite_Character.prototype.updateBitmap = function () {
  56.         _Sprite_Character_updateBitmap.call(this);

  57.         // 检查角色是否骑坐骑,如果是,则拼接角色和坐骑的行走图
  58.         if (this._character.isRiding()) {
  59.             const characterName = this._character.characterName();
  60.             const ridingCharacterName = this._character._ridingCharacterName;
  61.             const ridingCharacterNameFront = this._character._ridingCharacterNameFront;
  62.             const characterIndex = this._character.characterIndex();
  63.             const index = this._character._ridingCharacterIndex;

  64.             const characterBitmap = ImageManager.loadCharacter(characterName);
  65.             const ridingCharacterBitmap = ImageManager.loadCharacter(ridingCharacterName);

  66.             const bitmapSize = characterBitmap.width / 12;
  67.             
  68.             let chax=this._character._charadx;
  69.             let chay=this._character._charady;
  70.             console.log(chax,chay)

  71.             const combinedBitmap = new Bitmap(bitmapSize + chax * 2, bitmapSize * 2);
  72.             let drx = (index % 4 * bitmapSize * 3 + this.characterPatternX() * bitmapSize)
  73.             let dry = (Math.floor(index / 4) * bitmapSize * 4 + (this._character.direction() - 2) / 2 * bitmapSize)
  74.             let dx = (characterIndex % 4 * bitmapSize * 3)
  75.             let dy = (Math.floor(characterIndex / 4) * bitmapSize * 4 + (this._character.direction() - 2) / 2 * bitmapSize)

  76.             let dirX = (this._character.direction() == 4 ? chax : 0) + (this._character.direction() == 6 ? -chax : 0);
  77.             let dirY = (this._character.direction() == 8 ? chay : 0) + (this._character.direction() == 2 ? -chay : 0);

  78.             combinedBitmap.blt(ridingCharacterBitmap, drx, dry, bitmapSize, bitmapSize, chax, bitmapSize);
  79.             combinedBitmap.blt(characterBitmap, dx, dy, bitmapSize, bitmapSize, dirX + chax, dirY + bitmapSize - this._character._charaHeight);

  80.             if(ridingCharacterNameFront){
  81.                 const ridingCharacterBitmapFront = ImageManager.loadCharacter(ridingCharacterNameFront);
  82.                 combinedBitmap.blt(ridingCharacterBitmapFront, drx, dry, bitmapSize, bitmapSize, chax, bitmapSize);
  83.             }

  84.             this.bitmap = combinedBitmap;
  85.         }
  86.     };

  87.     Sprite_Character.prototype.updateCharacterFrame = function () {
  88.         const pw = this.patternWidth();
  89.         const ph = this.patternHeight();
  90.         const sx = (this.characterBlockX() + this.characterPatternX()) * pw;
  91.         const sy = (this.characterBlockY() + this.characterPatternY()) * ph;

  92.         if (this._character.isRiding()) return;
  93.         else this.setFrame(sx, sy, pw, ph);
  94.     };

  95. })();
复制代码
MV/MZ Zeros魔塔样板

原创ARPG系统火爆出售中(论坛优惠价)(内含90+功能)
-------------------------------------------------------------------
*事件党*福利!本人两年的事件研究大集合

!点击上面看*事件党*详情(内含200+收集插件)



回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
285
在线时间
43 小时
注册时间
2023-9-28
帖子
28
3
 楼主| 发表于 2023-11-7 16:46:33 | 只看该作者
79160475 发表于 2023-11-5 19:39
自己写的坐骑插件,不保证完全能用,可以试试看

哇,谢谢大大!(虽然一时半会没看懂)
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1742
在线时间
566 小时
注册时间
2017-10-13
帖子
52
4
发表于 2023-11-7 19:04:57 | 只看该作者
79160475 发表于 2023-11-5 19:39
自己写的坐骑插件,不保证完全能用,可以试试看

挺好用的。
如果搞一个不一样大小的就好了。  坐骑应该是大一点吧。  比如上面是48*48  下面  96*48 多好
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2459
在线时间
409 小时
注册时间
2016-2-3
帖子
755
5
发表于 2024-1-21 14:31:26 | 只看该作者
huangke 发表于 2023-11-7 19:04
挺好用的。
如果搞一个不一样大小的就好了。  坐骑应该是大一点吧。  比如上面是48*48  下面  96*48 多好 ...

理论上使用整个大图就行了
MV/MZ Zeros魔塔样板

原创ARPG系统火爆出售中(论坛优惠价)(内含90+功能)
-------------------------------------------------------------------
*事件党*福利!本人两年的事件研究大集合

!点击上面看*事件党*详情(内含200+收集插件)



回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-29 17:57

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表