查看: 2232|回复: 2

[有事请教] 某个物品只在队伍中有某个角色时才会掉落

[复制链接]
梦石
0
星屑
239
在线时间
168 小时
注册时间
2022-1-8
回帖
16
发表于 2022-9-9 16:06:01 | 显示全部楼层 |阅读模式
悬赏1星屑已解决
求助怎么设置某个物品只在队伍中有某个角色时才会掉落

最佳答案

查看完整内容

Game_Enemy.prototype.makeDropItems = function() { const rate = this.dropItemRate(); return this.enemy().dropItems.reduce((r, di) => { if (di.kind > 0 && Math.random() * di.denominator < rate) { let item = this.itemObject(di.kind, di.dataId); if (item.name === '道具名' && !$gameParty._actors.includes(3)) item = []; // 某某名称的道具在队伍中没 ...
梦石
2
星屑
8479
在线时间
463 小时
注册时间
2021-12-4
回帖
486

MZ评测员

发表于 2022-9-9 16:06:02 | 显示全部楼层
Game_Enemy.prototype.makeDropItems = function() {
    const rate = this.dropItemRate();
    return this.enemy().dropItems.reduce((r, di) => {
        if (di.kind > 0 && Math.random() * di.denominator < rate) {

            let item = this.itemObject(di.kind, di.dataId);
            if (item.name === '道具名' && !$gameParty._actors.includes(3))
                item = []; // 某某名称的道具在队伍中没有3号角色时不掉落
            return r.concat(item);

        } else {
            return r;
        }
    }, []);
};
rmmz_objects.js第5000行左右,对掉落道具的名称(或者编号等任何属性)进行判断,再判断队伍的成员,就能控制是否不获得该道具了。
回复

使用道具 举报

梦石
0
星屑
239
在线时间
168 小时
注册时间
2022-1-8
回帖
16
 楼主| 发表于 2022-9-10 10:15:20 | 显示全部楼层
小秋橙 发表于 2022-9-9 19:52
Game_Enemy.prototype.makeDropItems = function() {
    const rate = this.dropItemRate();
    return t ...

大佬,这个掉落物需要加在敌人掉落里面么
还有就是我用的是mv应该是一样的吧
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部