Project1
标题:
yep龙骨插件和mog掉落插件兼容问题
[打印本页]
作者:
xuxu1997
时间:
2023-10-23 22:30
标题:
yep龙骨插件和mog掉落插件兼容问题
当我使用yep的龙骨插件,mog掉落动画插件就不会生效
通过查看调用堆栈,我找到了源头,问题是rpg_scenes.js中的这段代码
Scene_Battle.prototype.update = function() {
.....
if (active && !this.isBusy()) {
this.updateBattleProcess();
}
Scene_Base.prototype.update.call(this);
};
使用龙骨敌人后,杀死敌人不会立即进入繁忙状态,所以会继续执行this.updateBattleProcess(),猜测是龙骨死亡动画造成的,所以看了代码:
Game_Enemy.prototype.performCollapse = function() {
var result = false;
if (this.hasDragonBone === true) {
result = dragonBonesIntegration.PlayAnimationOnBattler(this, "dead");
SoundManager.playBossCollapse1();
}
if (result === false) {
dragonBonesIntegration.Game_Enemy_prototype_performCollapse.call(this);
}
};
这段代码先检查敌人是否具有龙骨动画,如果有,就播放龙骨动画并伴随特定的音效。如果没有龙骨动画或者无法播放龙骨动画,那么将继续使用默认的倒下动画。
于是我删除了龙骨动画代码,使用默认倒下,果然mog掉落动画生效了。
那么问题来了,有什么办法保留龙骨死亡动画,并且掉落动画生效呢?
作者:
xuxu1997
时间:
2023-11-2 02:01
记录一下我的解决过程,防止后面遗忘。
经过测试,我发现yep龙骨插件和mog掉落插件是兼容的,并不会导致动画不出现 。导致这个问题的原因是mog的敌人死亡动画效果插件(MOG_CollapseEffects.js)。
因为在龙骨插件中,有关于龙骨敌人死亡后的动画播放,所以再使用mog的死亡动画会出现问题,最坏的情况会导致卡死。
所以我在mog的死亡动画插件中修改了下面的代码
Game_Battler.prototype.checkCollapseEffect = function() {
//if (this._collpaseData[0] === -1) {this.setDefaultCollapse()};
//if (this._collpaseData[1] > 0) {this.startAnimation(this._collpaseData[1], false, 0)};
if (this.enemy() && this.enemy().meta["DragonBone Replace Sprite"]) {
return; // 如果设置了元数据,不执行消失动画
} else {
if (this._collpaseData[0] === -1) {
this.setDefaultCollapse();
}
if (this._collpaseData[1] > 0) {
this.startAnimation(this._collpaseData[1], false, 0);
}
}
};
如果在敌人的注释中设置了元数据<DragonBone Replace Sprite>,那么就不执行mog的死亡动画。
再次运行测试后,不管是龙骨敌人还是正常敌人,掉落动画都能正常显示了。
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1