MV Battles + Calling JS in skill note tags to reduce max hp

Hello.

Intention:

Having a skill reduce MAXHP permanently on its target

Details:
I attempted to do this via damage formula but all it does is affect current HP not Max HP.
I attempted this "b.setmHp(b.mhp * 0.5)"

It would appear I would need to use the notetags to accomplish this by calling JS (Strings, syntax???)

Am I even asking the right kind of question? How do I do this? This would help me understand JS.
notetags in themselves have absolutely no function, you would need a plugin to read and execute notetags.

I suggest taking one step back and give us a screenshot of the skill that does not work, and then we can look for a solution.
Test skill does 50% max HP + 100 damage.
Calls a common event to set Max HP as the new default.
Problem: It does this even if the attack misses (bad)

Second Image:
Set variable with Max HP.
Minus current HP.
Subtract Max HP parameter by difference.

Plugins Used:
Yanfly

What I'd Like To Do
- Use JS to do this instead of variables...
- Not have the MaxHP changed if the attack misses
- Not have to create variable sets for each actor.
- If/Then statements checking for individual party members (or a single function that checks which actor is being targeted, and subtracts damage from max HP)
- How to do this with notetags (Eval function??). Yanfly also has custom code that can be applied by specific parts of a battle action.
- Is there a master list of operators.
- I am looking at this and my brain is melting.
- I did a run through Code Combat today so I have a better understanding of JS than when I made the first post.
- Help me Obi Wan.

Screen_Shot_2017-05-14_at_9.44.50_PM.png
Screen_Shot_2017-05-14_at_9.44.50_PM.png
check your plugins - something there messed up the engine.
If the skill misses, the common event should not be called - that is how the default engine works.
Most likely either a wrong setting in yanfly's plugins (they usually do a lot more than people think) or a wrong plugin order messing up the functions.
This is my plugin setup
https://s21.postimg.org/6vqpqri8n/Screen_Shot_2017-05-15_at_10.18.40_AM.png
Screen_Shot_2017-05-15_at_10.18.40_AM.png
@DigDigDig
Your screenshot is incomplete as it doesn't show all plugins, but it shows enough to proof that you messed up the plugin order.
Please check Yanfly's website - all his plugins are required to be in the exact order as given there, or they will not work correctly. And your order of the plugins is wrong.

Change the order as required and start a new game to test the results, if the error is still there give new screenshots of the corrected order with the complete list of all plugins and we can continue checking.

Original thread: https://forums.rpgmakerweb.com/threads/mv-battles-calling-js-in-skill-note-tags-to-reduce-max-hp.78609/