Hello,
I am actually on the creation of a state based on a counter which is supposed to do the following:
- When the one under the effect of the state does a basic attack, the counter rises by 1. Else, it lowers by 1.
- When the one under the effect of the state is attacked and take direct damage from it, it is healed by a set purcentage of the damage taken depending on the counter.
My problem is in the second part of the state. Indeed, starting from the moment the character is supposed to take damages from an attack, the game crashes showing the following message:
Removing the influence of the counter in the heal calculation doesn't cause the game to crash anymore. The problem surely comes from there. Even while deactivating all plugins (except Yanfly's "Buffs & States Core"), the problem remains.
I wanted to know if the problem comes from my code and if yes, where I've been mistaken. Here is the full code:
Interesting fact: the state doesn't crash when the enemy is the one to be healed or if the enemy have the same state than the actor.
My version of Yanfly's "Buffs & States Core" is 1.14 and my version of RPG Maker MV is 1.5.1.
Thank you by advance. 🙂
I am actually on the creation of a state based on a counter which is supposed to do the following:
- When the one under the effect of the state does a basic attack, the counter rises by 1. Else, it lowers by 1.
- When the one under the effect of the state is attacked and take direct damage from it, it is healed by a set purcentage of the damage taken depending on the counter.
My problem is in the second part of the state. Indeed, starting from the moment the character is supposed to take damages from an attack, the game crashes showing the following message:
Removing the influence of the counter in the heal calculation doesn't cause the game to crash anymore. The problem surely comes from there. Even while deactivating all plugins (except Yanfly's "Buffs & States Core"), the problem remains.
I wanted to know if the problem comes from my code and if yes, where I've been mistaken. Here is the full code:
Code:
<Custom Apply Effect>
user._ours = user._ours || 0;
user.setStateCounter(stateId, user._ours);
</Custom Apply Effect>
<Custom Confirm Effect>
if (this.isAttack()) {
user._ours += 1;
user._ours = Math.min(user._ours, 5);
user.setStateCounter(stateId, user._ours);
}
</Custom Confirm Effect>
<Custom Respond Effect>
target.startDamagePopup();
target.clearResult();
if (this.isHpEffect() && value > 0) {
this._soinOurs = Math.trunc(value * (0.16 * user._ours));
target.gainHp(this._soinOurs);
target.startDamagePopup();
target.clearResult();
}
</Custom Respond Effect>
<Custom Conclude Effect>
if (!this.isAttack()) {
user._ours -= 1;
user._ours = Math.max(user._ours, 0);
user.setStateCounter(stateId, user._ours);
}
</Custom Conclude Effect>
<Custom Remove Effect>
user._ours = 0;
user.setStateCounter(stateId, user._ours);
</Custom Remove Effect>
Interesting fact: the state doesn't crash when the enemy is the one to be healed or if the enemy have the same state than the actor.
My version of Yanfly's "Buffs & States Core" is 1.14 and my version of RPG Maker MV is 1.5.1.
Thank you by advance. 🙂