MV how do i get the enemy damage output as a variable?

hi! i've recently implemented a QTE plugin for attacks in my game, and i'd like to know if there's a way to get an enemy's damage output assigned to a variable so i can divide it by 2 if you hit the qte just right!
is there a script call for this?
or maybe an eval i can put in the damage formula to assign it to a variable?
thanks in advance!!!
You can put v[3] in front of your damage formula to assign it to variable 3. (Note: if your formula has any semicolons in it, put that after the last semicolon.)

However, I think that won't give you the result you want. You probably want the final damage actually applied to the actor, right? But the value in the damage formula is just a base damage value which is then adjusted for several different factors.

Reading your post in more detail though, I think you may be approaching the problem from the wrong angle. It sounds like what you should be looking for is not a way for your QTE to fiddle with your damage, but rather a way for your damage formula to see the state of the QTE. If that's the case, all you need to do is set a variable on the actor. I don't know anything about your QTE, but if you write code like the following in it:

JavaScript:
$gameTroop.members()[1].perfectQte = true

Then in your enemy's damage formula you can do something like:

JavaScript:
(a.perfectQte ? 0.5 : 1) * (the rest of your damage formula)

You'll want to make sure you set perfectQte back to false somewhere, otherwise hitting it perfectly once will halve the damage forever.
You can also modify the damage value with Yanfly tags, like 'custom react effect', if you give your battlers passives.
You'll want to make sure you set perfectQte back to false somewhere, otherwise hitting it perfectly once will halve the damage forever.
thanks! i appreciate the thoughtful response, however it doesn't seem to be working as intended? i've inputted your code and damage formula as you've given them to me but it seems to give the same damage regardless of if the qte is failed or completed (the qte plugin, by the way, is here)

i'll attach my code used in the notetags for the skill, in the setup action with yanfly's action sequences (which this plugin depends on, afaik)

JavaScript:
<setup action>

display action
eval: $gameTroop.members()[1].perfectQte = false
eval: $gameTemp.reserveCommonEvent(36);

eval: $gameMap.QTE(["normal"],100,["up","up","up","up"],true)
if $gameMap.getQTEResult() === "success"
    eval: $gameTroop.members()[1].perfectQte = true
    eval: $gameTemp.reserveCommonEvent(37);
    break action

else $gameMap.getQTEResult() === "failure"
    eval: $gameTemp.reserveCommonEvent(38);
    break action
    end

</setup action>

i'm not a javascript expert by any means, so i'm not sure if anything here is written incorrectly or not...
another thought i had was to use switches instead, but i wouldn't know how to check if a switch is on/off in a damage formula
$gameTroop gives the enemies, $gameParty gives your actors

Also, index 1 gives the second thing in the array
aahh, changing the 1 to 0 worked! i forget arrays start at 0 lols, thanks sm!
That's not even JavaScript…

another thought i had was to use switches instead, but i wouldn't know how to check if a switch is on/off in a damage formula
Yes, switches would have been a viable option too, good point. This isn't a built-in feature, but some plugins enable you to reference switches in damage formulas as s[3] (which would be switch 3). Without such a plugin, you would need to write $gameSwitches.value(3).

But I see you got it working with a member variable, so that should be fine. I'll just add that if there's any chance of the enemy using that particular skill other than in your QTE, you should be sure to set perfectQte to false after the whole thing ends too.
That's not even JavaScript…

It's Yanfly action sequence...

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-get-the-enemy-damage-output-as-a-variable.178469/