Can a state give an ATK bonus based off of the user's current HP?

Hi There! I apologize if this isn't in the right group, I didn't really understand where to put it.

I am using lots of Yanfly plugins, and RPG Maker MV.

I'm looking to create a state which gives an ATK bonus, but that bonus amount depends on the HP of the user when they first receive the state. For example, if the user has 20 HP when they use the skill, 10% of that will be applied as bonus ATK to everyone who receives the state.

I believe this is possible using Yanfly's plugins, but I can't seem to find exactly what I'm looking for. I'm guessing it would be part of Base Parameter Control and State and Buff Core.
I can't seem to find exactly what I'm looking for. I'm guessing it would be part of Base Parameter Control...
The problem is the notetags in Base Parameter Control don't accept JavaScript evals, just static values.

So your choices are to use a different plugin which can calculate the bonuses or modify this plugin to do so.

Quasi Params Plus can accept formulae. So you'd need Yanfly's Buffs & States to be installed for the origin of states, then use Quasi to put in the notetag:
Code:
<params>ATK: Math.round(a.stateOrigin(ID).hp/10)</params>
replace ID with the ID of your state, no leading zeros.
The problem is the notetags in Base Parameter Control don't accept JavaScript evals, just static values.

So your choices are to use a different plugin which can calculate the bonuses or modify this plugin to do so.

Quasi Params Plus can accept formulae. So you'd need Yanfly's Buffs & States to be installed for the origin of states, then use Quasi to put in the notetag:
Code:
<params>ATK: Math.round(a.stateOrigin(ID).hp/10)</params>
replace ID with the ID of your state, no leading zeros.
This worked. Thank you for your swift reply!

EDIT: Sadly, it seems like all of my attacks now miss the enemy. the new plugin must be causing some interference with the other Yanfly plugins. I'm taking a look into it, but you did still solve the question I asked, and I am grateful for that.

FURTHER EDIT: By moving the Quasi Params plugin closer to the Yanfly Base Parameters plugin, the issue resolved itself.
Moving to Plug in Support since it looks like plugins will be used in the solution.
The problem is the notetags in Base Parameter Control don't accept JavaScript evals, just static values.

So your choices are to use a different plugin which can calculate the bonuses or modify this plugin to do so.

Quasi Params Plus can accept formulae. So you'd need Yanfly's Buffs & States to be installed for the origin of states, then use Quasi to put in the notetag:
Code:
<params>ATK: Math.round(a.stateOrigin(ID).hp/10)</params>
replace ID with the ID of your state, no leading zeros.
So, I have a follow up question that I hope you can help me with.

Do you know where I can find a list of the parameters abbreviations used in the quasi plugin? I cannot find them in the plugin documentation.

The reason I ask is because for other skills and states, I want to base the bonus off of parameters other than HP. However, when I replace ".hp" with ".agi" or ".atk", I recieve an error. My assumption is that I do not have the correct abbreviations for the parameters.
You would have to post a screenshot of the error (press F12 and go to the Console tab).

Pasting the exact code that you're using is also helpful.

The abbreviations would be the same as what's listed in the damage formula reference, so agi and atk should be valid.
You would have to post a screenshot of the error (press F12 and go to the Console tab).

Pasting the exact code that you're using is also helpful.

The abbreviations would be the same as what's listed in the damage formula reference, so agi and atk should be valid.

Thanks for replying. Here are my state notetags as well as the errors in the console. I wonder if it is related to a plugin incompatibility, because I can't find the syntax error it mentions. ".hp" works but any other parameter causes an error.

If I can't find a solution, I'll take this skill out. but I liked the idea of having a user boost their own stats and then share that stat boost with their allies.

Spoiler: Images
Notetag1.png


Notetag2.png


Code Error.png


And here is ALL of what the console log states. I did try removing YanflyEventTimer plugin, but then it just flags a different Yanfly plugin as the problem.

Spoiler: Console In Entirety
KDCore is loaded 2.9.2
PKD_ExtendedLoot.js:1760 XDev KDCore 2.8.2 skipped by new or exists version
PKD_SimpleSkillsTree.js:7158 KDCore is loaded 3.2.7
HIME_Party.js:410 Uncaught TypeError: Cannot read property 'trim' of undefined
at HIME_Party.js:410
at HIME_Party.js:1048
pixi.js:27682
PixiJS 4.5.4 - ✰ WebGL ✰ http://www.pixijs.com/ ♥♥♥


61PKD_SimpleSkillsTree.js:521 TypeError: SceneManager._scene.pIsLootWindowIsOpen is not a function
at Object._.IsLootWindowIsOpen (PKD_ExtendedLoot.js:9060)
at Object._.IsShouldVisualDrop (PKD_ExtendedLoot.js:9039)
at Game_Party._.gainItem (PKD_ExtendedLoot.js:8788)
at Game_Party._.gainItem (PKD_ExtendedLoot.js:8826)
at Game_Party.gainItem (DreamX_RandomPrefixesSuffixes.js:1443)
at Game_Party.<anonymous> (rpg_objects.js:4908)
at Array.forEach (<anonymous>)
at Game_Party.setupBattleTestItems (rpg_objects.js:4906)
at Game_Party.setupBattleTest (rpg_objects.js:4890)
at Function.DataManager.setupBattleTest (rpg_managers.js:227)
KDCore.warning @ PKD_SimpleSkillsTree.js:521
YEP_EventTimerControl.js:385 SCRIPT CALL ERROR
YEP_EventTimerControl.js:386 $gameActors.actor($gameVariables.value(64)).addState(133);
subject.setStateCounter(133, $gameVariables.value(61);

YEP_EventTimerControl.js:387 SyntaxError: missing ) after argument list
at Game_Interpreter.command355 (YEP_CoreEngine.js:1358)
at Game_Interpreter.executeCommand (rpg_objects.js:8930)
at Game_Interpreter.update (rpg_objects.js:8838)
at Game_Interpreter.updateChild (rpg_objects.js:8849)
at Game_Interpreter.update (rpg_objects.js:8832)
at Game_Troop.updateInterpreter (rpg_objects.js:5226)
at Function.BattleManager.updateEventMain (rpg_managers.js:2281)
at Function.BattleManager.updateEvent (YEP_BattleEngineCore.js:1937)
at Function.BattleManager.update (YEP_BattleEngineCore.js:1895)
at Scene_Battle.updateBattleProcess (rpg_scenes.js:2265)
Yanfly.Util.displayError @ YEP_EventTimerControl.js:387
YEP_EventTimerControl.js:385 CUSTOM STATE 40 CODE ERROR
YEP_EventTimerControl.js:386 <params>
MHP: Math.round(a.stateOrigin(40).hp/10)
ATK: Math.round(a.stateOrigin(41).atk/10)
DEF: Math.round(a.stateOrigin(41).def/10)
AGI: Math.round(a.stateOrigin(41).agi/10)
MAT: Math.round(a.stateOrigin(41).mat/10)
MDF: Math.round(a.stateOrigin(41).mdf/10)
</params>

YEP_EventTimerControl.js:387 SyntaxError: Unexpected token <
at Game_Actor.Game_Battler.customEffectEval (YEP_BuffsStatesCore.js:1378)
at Game_Actor.Game_Battler.addStateEffects (YEP_BuffsStatesCore.js:1396)
at Game_Actor.Game_Battler.addState (YEP_BuffsStatesCore.js:1391)
at Game_Actor.Game_Battler.addState (YEP_X_VisualStateFX.js:300)
at Game_Actor.Game_Battler.addState (YEP_EnhancedTP.js:3657)
at Game_Action.itemEffectAddNormalState (YEP_BattleEngineCore.js:3545)
at Game_Action.itemEffectAddState (rpg_objects.js:1873)
at Game_Action.applyItemEffect (rpg_objects.js:1805)
at Game_Action.<anonymous> (rpg_objects.js:1662)
at Array.forEach (<anonymous>)
Yanfly.Util.displayError @ YEP_EventTimerControl.js:387
YEP_EventTimerControl.js:385 SCRIPT CALL ERROR
YEP_EventTimerControl.js:386 $gameActors.actor($gameVariables.value(64)).addState(133);
subject.setStateCounter(133, $gameVariables.value(61);

YEP_EventTimerControl.js:387 SyntaxError: missing ) after argument list
at Game_Interpreter.command355 (YEP_CoreEngine.js:1358)
at Game_Interpreter.executeCommand (rpg_objects.js:8930)
at Game_Interpreter.update (rpg_objects.js:8838)
at Game_Interpreter.updateChild (rpg_objects.js:8849)
at Game_Interpreter.update (rpg_objects.js:8832)
at Game_Troop.updateInterpreter (rpg_objects.js:5226)
at Function.BattleManager.updateEventMain (rpg_managers.js:2281)
at Function.BattleManager.updateEvent (YEP_BattleEngineCore.js:1937)
at Function.BattleManager.update (YEP_BattleEngineCore.js:1895)
at Scene_Battle.updateBattleProcess (rpg_scenes.js:2265)
Yanfly.Util.displayError @ YEP_EventTimerControl.js:387
rpg_managers.js:1949 RangeError: Maximum call stack size exceeded
at Game_Actor.Game_BattlerBase.param (QuasiParamsPlus.js:447)
at Game_Actor.get (rpg_objects.js:2137)
at eval (eval at Game_BattlerBase.evalParamFormula (QuasiParamsPlus.js:477), <anonymous>:1:30)
at Game_Actor.Game_BattlerBase.evalParamFormula (QuasiParamsPlus.js:477)
at Game_Actor.Game_BattlerBase.stateParamPlus (QuasiParamsPlus.js:486)
at Game_Actor.Game_BattlerBase.param (QuasiParamsPlus.js:450)
at Game_Actor.get (rpg_objects.js:2137)
at eval (eval at Game_BattlerBase.evalParamFormula (QuasiParamsPlus.js:477), <anonymous>:1:30)
at Game_Actor.Game_BattlerBase.evalParamFormula (QuasiParamsPlus.js:477)
at Game_Actor.Game_BattlerBase.stateParamPlus (QuasiParamsPlus.js:486)
SceneManager.catchException @ rpg_managers.js:1949
what's in state 41?
That syntax is quite incorrect.

1 - You can never nest notetags. Putting one inside of the other will not do anything.

2 - There's no reason to try to make it a Custom Apply Effect in the first place. You don't want it to be executed one time when the state goes on, you want it to be in effect for the entire time (which is what the <params> notetag does by itself).

Is it intentional that you reference two different states? You're looking at state 40 and state 41, and there's no guarantee that they're both on the target. What is the ID of this state?
That syntax is quite incorrect.

1 - You can never nest notetags. Putting one inside of the other will not do anything.

2 - There's no reason to try to make it a Custom Apply Effect in the first place. You don't want it to be executed one time when the state goes on, you want it to be in effect for the entire time (which is what the <params> notetag does by itself).

Is it intentional that you reference two different states? You're looking at state 40 and state 41, and there's no guarantee that they're both on the target. What is the ID of this state?
Well damn. I could have sworn on the life of my dead mother that the original example that you gave me was within a Custom Applly Effect tag, but it clearly wasn't. I take that tag away and the error disappears.

I don't know what I was thinking. I greatly appreciate Yanfly's engine, but it doesn't always make sense to me, hence why I'm willing to put in tags I don't always understand. It's taken a long time to get to the point where I can use lunatic mode and have even a remote idea of what's going on.

Thank you again for your help. I'll take a look at those state ID's too and make sure they are doing what they're supposed to be.

Original thread: https://forums.rpgmakerweb.com/threads/can-a-state-give-an-atk-bonus-based-off-of-the-users-current-hp.158657/