Hi, y'all. I was working on a skill that reduces the max HP of the target by 25% of the damage taken, and this is what I came up with:
JavaScript:<Custom Deselect Effect>
erosion = Math.round(value/4);
target._paramPlus[0] -= erosion;
target.removeState(59);
</Custom Deselect Effect>
This is in the note of a state that's applied in the damage formula.
Unfortunately, it returns an error about not being able to draw the health bar because the value is non-finite, even though I'm making sure the erosion variable is rounded.
Full error
YEP_CoreEngine.js:1098 TypeError: Failed to execute 'createLinearGradient' on 'CanvasRenderingContext2D': The provided double value is non-finite.
at Bitmap.gradientFillRect (rpg_core.js:1289)
at Bitmap.gradientFillRect (YEP_CoreEngine.js:1014)
at Window_VisualHPGauge.drawGauge (YEP_X_VisualHpGauge.js:717)
at Window_VisualHPGauge.drawActorHp (WAY_X_VisualGaugesAddon.js:1146)
at Window_VisualHPGauge.refresh (YEP_X_VisualHpGauge.js:641)
at Window_VisualHPGauge.updateRefresh (YEP_X_VisualHpGauge.js:632)
at Window_VisualHPGauge.updateWindowAspects (YEP_X_VisualHpGauge.js:544)
at Window_VisualHPGauge.update (YEP_X_VisualHpGauge.js:536)
at rpg_core.js:4068
at Array.forEach (<anonymous>)
If I replace
-= erosion in the 3rd line by
-= 100, it works perfectly. So the issue has to come from the
erosion variable.
So I have no idea what's causing the
erosion value, a very much finite number because it gets rounded, to return this error.
Can somebody tell me what's wrong, and how to fix it?