Hi, RPGMaker Forums!
I've recently tried to create a system that would increase the attack damage of a skill an enemy uses depending on the percentage of the enemy's health that was lost in the last turn. Unfortunately, my system causes crashes, and I'm wondering how I could go about doing this properly. Here's what I have currently, this probably isn't the most efficient way of doing this, but this is how I currently have it:
3 Variables: Enemy %, Enemy Current Health, and Enemy New Health
However, occasionally when using this formula, skills involving the multiplier (I multiply skills by Enemy %) will crash the game with the error:
So, is there a way to have skills that scale depending on how much damage the enemy has taken this round, either using javascript or plugins or such? I've heard that some plugins could affect this error but a lot of them are kind of essential, here's a short list of the ones that I think would be impacting it:
YEP_BattleEngineCore
YEP_SkillCore
YEP_X_VisualHpGauge
Any help with this would be greatly appreciated, I'm not sure whether to post this in the Javascript support channels, we'll see.
Thanks!
I've recently tried to create a system that would increase the attack damage of a skill an enemy uses depending on the percentage of the enemy's health that was lost in the last turn. Unfortunately, my system causes crashes, and I'm wondering how I could go about doing this properly. Here's what I have currently, this probably isn't the most efficient way of doing this, but this is how I currently have it:
3 Variables: Enemy %, Enemy Current Health, and Enemy New Health
- At the start of each turn, Enemy Current Health is set to the enemy's current health.
- At the end of each turn, Enemy New Health is set to the enemy's new current health.
- Enemy % is then set to the Max HP of Enemy
- Take Enemy Current Health and subtract Enemy New Health to get the amount of damage Enemy has taken this round
- Enemy % is divided by the new value of Enemy Current Health, and then divided by 100 to get the percentage of the enemy's max health that was taken last turn
- Enemy % is then multiplied by 3 and added to 1 to get the value that I multiply this enemy's attack damage by in the skill formulas to get the final damage values. This might come out at a value around ~1.21 or so, so that's a 21% increase in damage for that turn.
However, occasionally when using this formula, skills involving the multiplier (I multiply skills by Enemy %) will crash the game with the error:
This seems to be the same error as this thread, and the reasoning behind it was explained fairly in-depth in that thread. As far as I know its an undefined value / NaN value screwing things up, which then sets the HP value to a NaN, which the graphics for the health bar cannot draw, -> crash.
So, is there a way to have skills that scale depending on how much damage the enemy has taken this round, either using javascript or plugins or such? I've heard that some plugins could affect this error but a lot of them are kind of essential, here's a short list of the ones that I think would be impacting it:
YEP_BattleEngineCore
YEP_SkillCore
YEP_X_VisualHpGauge
Any help with this would be greatly appreciated, I'm not sure whether to post this in the Javascript support channels, we'll see.
Thanks!