How to make Defense stat increase health.

I dont know scripting. In the old yanfly Parameter Formula plugins you could go into each stat and add a formula. like

(base + plus) * rate + flat + user.def / 1000.

In the VisuStella CoreEngine there is something similar (i think) in the Parameter Settings -> JS: Formula. Im aware that there is a description but i cant seem to get the formula right. What i want is for the defense stat (a.def) to increase MaxHP. Lets say by 2 per defense for example. Is this possible with this plugin or do i need another?
You can do this with Core Engine.

In the JS: Formula, after the line "let base = this.paramBase(paramId);" put

base += Math.floor(this.def * 2);
Im getting ''RangeError: Maximum call stack size exceeded''
Oh, whoops.

I forgot the if statement to check that paramId is 0, but I'll have to have a think about this one because at the point where this is being calculated I'm not sure you can use .def. Leave it with me.

Do you want it to be 2 points per point of base def or factoring in the total def from all sources?
All sources would be nice.
Been looking at the custom parameters in the VisuStella CoreEngine.

I have already used these as derived stats but can i add function to them? Like have of them increase health?

Maybe put a formula in the constants section or something? I dunno 😛
// Declare Constants

const user = this;


// Calculations

return (user.atk * 1) + (user.luk * 0.5);

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-defense-stat-increase-health.137217/