查看: 2495|回复: 11

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

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

最佳答案

查看完整内容

不清楚你会不会用 [pre lang="js"] 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(it ...
梦石
0
星屑
2585
在线时间
297 小时
注册时间
2021-5-4
回帖
97
发表于 2021-8-29 11:54:12 | 显示全部楼层
Capture.PNG
Capture1.PNG
不清楚你会不会用
[pre lang="js"]

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) {
        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);
        console.log(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.consumable===true) {
            delete container[item.id];
        }
        if (includeEquip && newNumber < 0) {
            this.discardMembersEquip(item, 0);                       
        }               
        $gameMap.requestRefresh();
    }
}

Game_Party.prototype.maxItems = function(item) {
        if(item.consumable===true){
                return 99;
        }
    return 1;//武器和装备最大的上限
};
[/pre]

点评

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

使用道具 举报

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

使用道具 举报

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

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

使用道具 举报

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

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

使用道具 举报

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

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

使用道具 举报

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

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

使用道具 举报

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

使用道具 举报

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

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

使用道具 举报

梦石
0
星屑
2585
在线时间
297 小时
注册时间
2021-5-4
回帖
97
发表于 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
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部