seeking help for how to change BaseParameter scale with Hp...

Hello, i seeking help for how to change BaseParameter scale with Hp?
for example :
when Actor Hp >= 80 %, Atk boost 30.
when Actor (80%> Hp >= 50 %), Atk boost 20.
when Actor (Hp < 50%). Atk drop 10.


I am uisng Yanfly plugin source & game is ATB system.
That was me coding :

<Custom Turn End Effect>
if((a.hp/a.mhp) >= 0.8)user.addAtk (30);
if(0.8 > (a.hp/a.mhp) >= 0.5)user.addAtk (20);
if((a.hp/a.mhp) < 0.5)user.addAtk (-10)
</Custom Turn End Effect>

this code was totally wrong....;_;;_;;_;
result out was this effect working only after my actor finish action,
what actual i want is actor Atk change every time when his HP plus or drop...

another mistake was when my actor remain his hp > 80% several turn,
his Atk always goes up 30 every turn....:dizzy::dizzy::dizzy::dizzy:

seeking help!!!

Original thread: https://forums.rpgmakerweb.com/threads/seeking-help-for-how-to-change-baseparameter-scale-with-hp.88769/