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

Project1

 找回密码
 注册会员
搜索
查看: 1651|回复: 11

[有事请教] 如何使同一个防具让多人装备

[复制链接]

Lv2.观梦者

梦石
0
星屑
450
在线时间
94 小时
注册时间
2020-7-18
帖子
55
发表于 2021-8-29 11:54:11 | 显示全部楼层 |阅读模式
100星屑
如题,虽然我可以把多来几个防具吧,但看上去不太美观,大佬们知道怎么使武器/防具装备时不消耗么?

最佳答案

查看完整内容

不清楚你会不会用 Window_ItemList.prototype.drawItemNumber = function(item, x, y, width) { if (this.needsNumber()) { if(item.consumable===true){ this.drawText(":", x, y, width - this.textWidth("00"), "right"); this.drawText($gameParty.numItems(item), x, y, width, "right"); } } }; Game_Party.prototype.hasItem = function(item) { if (this.numItems(item) > 0) { ...

Lv3.寻梦者

梦石
0
星屑
2585
在线时间
297 小时
注册时间
2021-5-4
帖子
101
发表于 2021-8-29 11:54:12 | 显示全部楼层
Capture.PNG
Capture1.PNG
不清楚你会不会用
JS 代码复制
  1. Window_ItemList.prototype.drawItemNumber = function(item, x, y, width) {
  2.     if (this.needsNumber()) {      
  3.                 if(item.consumable===true){
  4.                         this.drawText(":", x, y, width - this.textWidth("00"), "right");
  5.                         this.drawText($gameParty.numItems(item), x, y, width, "right");
  6.                 }     
  7.     }
  8. };
  9. Game_Party.prototype.hasItem = function(item) {
  10.     if (this.numItems(item) > 0) {
  11.         return true;
  12.     } else if (this.isAnyMemberEquipped(item)) {
  13.         return true;
  14.     } else {
  15.         return false;
  16.     }
  17. };
  18. Game_Party.prototype.gainItem = function(item, amount, includeEquip) {
  19.     const container = this.itemContainer(item);
  20.         console.log(item)
  21.     if (container) {
  22.         const lastNumber = this.numItems(item);
  23.         const newNumber = lastNumber + amount;
  24.         container[item.id] = newNumber.clamp(0, this.maxItems(item));
  25.         if (container[item.id] === 0 && item.consumable===true) {
  26.             delete container[item.id];
  27.         }
  28.         if (includeEquip && newNumber < 0) {
  29.             this.discardMembersEquip(item, 0);                       
  30.         }               
  31.         $gameMap.requestRefresh();
  32.     }
  33. }
  34.  
  35. Game_Party.prototype.maxItems = function(item) {
  36.         if(item.consumable===true){
  37.                 return 99;
  38.         }
  39.     return 1;//武器和装备最大的上限
  40. };

点评

装备不消耗多少人穿都是一样只是演示  发表于 2021-8-30 12:18
多名成员穿搭一个数量的装备,而不是单一装备同一人重复携带  发表于 2021-8-30 12:04
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
44
在线时间
4 小时
注册时间
2021-8-26
帖子
10
发表于 2021-8-29 15:59:15 | 显示全部楼层
其他大佬应该有这种插件
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
450
在线时间
94 小时
注册时间
2020-7-18
帖子
55
 楼主| 发表于 2021-8-30 12:05:16 | 显示全部楼层
MH-Pride 发表于 2021-8-30 03:32
不清楚你会不会用

是写成插件么?
还有,这段是让一种装备不消耗,还是应用到所有装备上呀
回复

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2585
在线时间
297 小时
注册时间
2021-5-4
帖子
101
发表于 2021-8-30 12:16:55 | 显示全部楼层
本帖最后由 MH-Pride 于 2021-8-30 12:20 编辑

是插件 事件我不会 当然是全部啊  装备武器不消耗 所有人都可以装备 只是方便就一个人穿
我没有设置数据库 所以只用一个人试
Capture2.PNG
Capture1.PNG
Capture.PNG
Capture.PNG
回复

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2585
在线时间
297 小时
注册时间
2021-5-4
帖子
101
发表于 2021-8-30 12:19:09 | 显示全部楼层
UTO 发表于 2021-8-30 12:05
是写成插件么?
还有,这段是让一种装备不消耗,还是应用到所有装备上呀 ...

不肯能只写一件装备的 只是方便演示 一件多见一样的
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
450
在线时间
94 小时
注册时间
2020-7-18
帖子
55
 楼主| 发表于 2021-8-30 12:19:15 | 显示全部楼层
MH-Pride 发表于 2021-8-30 12:16
是插件 事件我不会 当然是全部啊  装备武器不消耗 所有人都可以装备 只是方便就一个人穿
我没有设置数据库  ...

那大佬有没有方法只让一种类型的装备不消耗呢?
回复

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2585
在线时间
297 小时
注册时间
2021-5-4
帖子
101
发表于 2021-8-30 12:24:46 | 显示全部楼层
可以啊 你要那个不消耗
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
450
在线时间
94 小时
注册时间
2020-7-18
帖子
55
 楼主| 发表于 2021-8-30 12:26:14 | 显示全部楼层
MH-Pride 发表于 2021-8-30 12:24
可以啊 你要那个不消耗

第二类防具吧,总之先谢谢大佬了!
回复

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2585
在线时间
297 小时
注册时间
2021-5-4
帖子
101
发表于 2021-8-30 12:39:38 | 显示全部楼层
本帖最后由 MH-Pride 于 2021-8-31 10:54 编辑
UTO 发表于 2021-8-30 12:26
第二类防具吧,总之先谢谢大佬了!


第二类防具是盾??
如果是衣服应该是4
方正把item.etypeId=== 的数字换成你想要的装备号码就可以了


Window_ItemList.prototype.drawItemNumber = function(item, x, y, width) {

    if (this.needsNumber()) {      

                if(item.etypeId !==4){

                        this.drawText(":", x, y, width - this.textWidth("00"), "right");

                        this.drawText($gameParty.numItems(item), x, y, width, "right");

                }     

    }

};

Game_Party.prototype.hasItem = function(item) {

    if (this.numItems(item) > 0) {

        return true;

    } else if (this.isAnyMemberEquipped(item)) {

        return true;

    } else {

        return false;

    }

};

Game_Party.prototype.gainItem = function(item, amount, includeEquip) {

    const container = this.itemContainer(item);

      

    if (container) {
               
        const lastNumber = this.numItems(item);
               
        const newNumber = lastNumber + amount;

        container[item.id] = newNumber.clamp(0, this.maxItems(item));

        if (container[item.id] === 0 &&item.etypeId!==4) {

            delete container[item.id];

        }

        if (includeEquip && newNumber < 0) {

            this.discardMembersEquip(item, 0);                        

        }               
        $gameMap.requestRefresh();

    }

}


Game_Party.prototype.maxItems = function(item) {

        if(item.etypeId!==4){

                return 99;

        }

    return 1;//武器和装备最大的上限

};

Capture1.PNG

Capture (1) (1).png
Capture.PNG
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-19 05:28

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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