How do I set a variable using an exponent?

I'm making a game where the damage the player takes is based on the defense of the character but I want the power of the defense stat to degrade over time meaning that at 1 defense the player would take the full amount of damage but if defense was 999 then the damage would only be 0.043% of the total damage. The formula I want to use is: 100-(X^0.6667) where X is the players defense. How exactly would I do this?

On RPG Maker MV
If you want something for the damage formula, you could try:

100 - Math.pow(b.def, 0.6667)
Technical details:
Maybe I should have explained a bit more. I'm not using the damage formula because I'm not using any battles. The damage is being calculated outside of battle using variables. Currently I have it set up so the player goes on an adventure and just watches as the events happen and can run into battles that will do damage based on the players stats. So I want to use the formula to store a new number that I can use to adjust the damage the player would receive.
So I want it to be kind of like:
Spoiler: Kind of like this
var PlayerDef = Player Defense
var DamageTaken = Random 10..16
var PlayerDef = 100 - (var PlayerDef^0.6667)
var PlayerDef / 100
var DamageTaken * var PlayerDef

Not Code just don't know how to explain without something like this
you can use the exact calculations of any damage formula inside the script line of control variable.
and that includes using math.pow there, absolutely no need for scripting variables.
everything can be done by control variable.
For example, let's say the defence value is stored in variable ID 123. Then you could do:
  • Control Variables -> Script: 100 - Math.pow($gameVariables.value(123), 0.6667)
You may also want to do the "divide by 100" step last, since numerical values stored in game variables get rounded down to integers.
For example, let's say the defence value is stored in variable ID 123. Then you could do:
  • Control Variables -> Script: 100 - Math.pow($gameVariables.value(123), 0.6667)
You may also want to do the "divide by 100" step last, since numerical values stored in game variables get rounded down to integers.
Thank you the gamevariable part I was just trying to write as var PlayerDef and now it all works. Thank you
you can use the exact calculations of any damage formula inside the script line of control variable.
and that includes using math.pow there, absolutely no need for scripting variables.
everything can be done by control variable.
I never use scripting and forgot that there a script part under control variables thanks
Great! I'll close the thread, then.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Also, you're not in trouble, but in future try to make use of the +Quote and/or Edit buttons rather than making multiple posts in quick succession:

@Bigkill321, please avoid double posting, as it is against the forum rules. You can use the "Edit" function on your posts to add additional information you've forgotten or respond to multiple people. You can review our forum rules here. Thank you.

Happy RPG Making! 👋

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-set-a-variable-using-an-exponent.148260/