查看: 3265|回复: 3

[有事请教] 请教一下关于插件冲突的问题。【已解决】

[复制链接]
梦石
0
星屑
245
在线时间
25 小时
注册时间
2020-4-6
回帖
15
发表于 2020-9-25 11:48:00 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 alucardzhou 于 2020-9-26 07:53 编辑


请教一个避免插件冲突的情况。

具体情况:
想引用FTKR_SkillTreeSystem
https://github.com/futokoro/RPGMaker/blob/master/sampleProject/SkillTreeSample.zip
结果发现FTKR_SkillTreeSystem和Yep_CoreEngine 有一个冲突:都定义了learnSkill  = function(skillId)
Yep_CoreEngine
Game_Actor.prototype.learnSkill = function(skillId) {
    if (!this._skills.contains(skillId)) {
        this._skills.push(skillId);
        this._skills.sort(function(a, b) {
            return a - b;
        });
    }
};

FTKR_SkillTreeSystem
    var _STS_Game_Actor_learnSkill = Game_Actor.prototype.learnSkill;
    Game_Actor.prototype.learnSkill = function(skillId) {
        if (!this.isStsLearnedSkill(skillId)) {
            this.setStsSkillCount(skillId, 0);
        }
        _STS_Game_Actor_learnSkill.call(this, skillId);
        this.checkInitSts();
        if (this.isLearnedSkill(skillId) && !this.stsCount(skillId)) {
            if (FTKR.STS.learnedActorVarID) $gameVariables.setValue(FTKR.STS.learnedActorVarID, this.actorId());
            if (FTKR.STS.learnedSkillVarID) $gameVariables.setValue(FTKR.STS.learnedSkillVarID, skillId);
            this.stsCountUp(skillId);
            this._stsLearnSkills[skillId] = true;
            this.checkStsForgetSkills(skillId);
        }
        if (this._initStsFlag) {
            this.stsUsedCost(skillId);
        }
    };

虽然在插件管理中把FTKR_SkillTreeSystem 放到 Yep_CoreEngine 后面就可以了。

但是感觉Yep_CoreEngine 的逻辑是有用,怕以后有冲突
* Version 1.19:
* - Updated for RPG Maker MV version 1.3.2.
* - Fixed 'LearnSkill' function for actors to not be bypassed if a piece of
* equipment has temporarily added a skill.


参看了一下 https://www.wikimoe.com/?post=48
简单加上了 (function(_global) {    })(this);

请教大神这样处理可以么?(以后Yep_CoreEngine 不会报错)如果不对请怎么改?
(function(_global) {
    var _STS_Game_Actor_learnSkill = Game_Actor.prototype.learnSkill;
    Game_Actor.prototype.learnSkill = function(skillId) {
                if (!this.isStsLearnedSkill(skillId)) {
            this.setStsSkillCount(skillId, 0);
        }
        _STS_Game_Actor_learnSkill.call(this, skillId);
        this.checkInitSts();
        if (this.isLearnedSkill(skillId) && !this.stsCount(skillId)) {
            if (FTKR.STS.learnedActorVarID) $gameVariables.setValue(FTKR.STS.learnedActorVarID, this.actorId());
            if (FTKR.STS.learnedSkillVarID) $gameVariables.setValue(FTKR.STS.learnedSkillVarID, skillId);
            this.stsCountUp(skillId);
            this._stsLearnSkills[skillId] = true;
            this.checkStsForgetSkills(skillId);
        }
        if (this._initStsFlag) {
            this.stsUsedCost(skillId);
        }
    };
})(this);
梦石
0
星屑
39236
在线时间
11155 小时
注册时间
2009-3-15
回帖
4768
发表于 2020-9-25 15:03:51 | 显示全部楼层
YEP是重定义
FTKR是改别名..
所以FTKR在YEP下面应该没问题了吧?

评分

参与人数 1赞 +1 收起 理由
alucardzhou + 1 塞糖

查看全部评分

回复

使用道具 举报

梦石
0
星屑
245
在线时间
25 小时
注册时间
2020-4-6
回帖
15
 楼主| 发表于 2020-9-26 07:43:44 | 显示全部楼层
soulsaga 发表于 2020-9-25 15:03
YEP是重定义
FTKR是改别名..
所以FTKR在YEP下面应该没问题了吧?

十分感谢。
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部