Help with Yanfly's Absorbtion Barrier and Creating a Max Stat

I am creating a system similar to wound/vitality (essential HP and Barrier Points) and I am hoping to modify Yanfly's Absorption Barrier to do so. In this system, the actors have the equivalent of a Max HP stat and I need to set up the equivalent of a Max BP stat, so the players start with the BP (or VP for vitality points), have a separate stat like HP Regen for the Barrier Regen per turn, and have a max barrier value. (I will change the crit value so it adds to a barrier penetration percentage). Can you maybe give me a brief note coding or some direction? Please and thank you
Let me ask you something, the actors will have a fixed barrier max during the full game or will it change? Will the max barrier change when they level up or by other means. I think that is kind of easy to do with the lunatic mode, I will try to help you.
Thank you! The barrier max would be like a secondary hp stat, different for each actor. I am using a attribute point buy system, so the players should be able to buy a higher max. The idea is to have a stat that is quicker to recover and easier to heal that will protect the characters true HP, which will be difficult to heal, and take a longer amount of time.
@Omegadragon8


Okay so where would you store the barrier max stat? In a variable? Like a variable for each actor Max Vitality stat? Just to understand this correctly so I can make the formulas. And about the barrier regen. Would it be based in the max value? Like every turn regenerate 50% of max barrier?
I would like there to be a total of 6 stats to govern how much damage can be taken. These are Health (MHP), Health Points (HP), Regeneration (HP Regen), Vitality (Barrier Point Max), Vitality Points (VP, or Current Barrier Points) and Restoration (Barrier Point Regen). I can store the stats in variable if that's easier to translate the mechanics. So essentially I would be using barrier points to translate an entire second tier of Hit Points.
@Omegadragon8


That didn't help much. You need to tell me how to make your formula. I made something like this:


- Variable 1 is actor 1 max barrier points (Max Vitality)


<Custom Barrier Points>


value += $gameVariables.value(1) - user.barrierPoints();


</Custom Barrier Points>


This makes he start every battle with a full barrier, but it never goes over the max value.


Now every turn he restores up to half of his max barrier.


<Custom Barrier Regen>


if (user.barrierPoints() > ($gameVariables.value(1)/2)) {


value += $gameVariables.value(1) - user.barrierPoints();


} else {


value += $gameVariables.value(1)/2;


}


</Custom Barrier Regen>


So for example: Actor 1 max barrier is 100, if his barrier is below 50 he restores only 50, if not he restores enough to be full only.


You told which stats you will be making, if you tell me how they will affect the barrier (like in a formula) I can help you make it.
So far looks great 🙂  Formula wise...hmmm
Vitality = Barrier Point Max = VIT
Vitality Points = Current Barrier Points = VP
Restoration = Barrier Point Recovered per turn. = RES

I'm thinking that the Restoration stat should be a percentage of the Vitality recovered (since my game will be using low stats that shouldn't be that big of a problem) But for now lets just keep it simple, if you give me a base, I should be able to use my considerable amount of limited scripting ability to alter the formula if need be. So let's say that the Restoration stat directly translates to how much VP is recovered per turn. I am not sure if this will cause complications but I am using Yanfly's ATB.

If Actor 1 has a VIT of 200 and a RES of 16, he takes damage reducing his VP to 100, next turn he should recover 16 VP, bringing his VP to 116
If Actor 2 has a VIT of 200 and a RES of 32, he takes damage reducing his VP to 100, next turn he should recover 32 VP bringing his VP to 132
 
@Omegadragon8


Now I get it. Let's say variable 1 is the actor VIT and variable 2 is his RES


<Custom Barrier Regen>


if (user.barrierPoints() > ($gameVariables.value(1) - $gameVariables.value(2))) {


value += $gameVariables.value(1) - user.barrierPoints();


} else {


value += $gameVariables.value(2);


}


</Custom Barrier Regen>


Hope this helps 🙂


Btw I don't think ATB will change anything, just the frequency which the barrier is restored since this notetag uses the same "moment" in battle as the default regen and ATB uses that a lot different than DTB.
AWESOME! Thanks a bunch, going to put that into work right away 😀
Almost got it to work, unfortunately it is causing a syntax error on map after moving for about thirty seconds. I copied and pasted directly from here into the character's notebox.


Also the final formula (which I did not test or alter the above script to test) will be;
   VIT - (VIT * (100/(100+RES))) 
This formula helps generate a sort of diminishing return.
@Omegadragon8


Ok, for the formula try this:


<Custom Barrier Regen>


var vit = $gameVariables.value(1);


var res = $gameVariables.value(2);


if (user.barrierPoints() > vit - Math.floor(vit - (vit * (100/(100+res))))) {


value += vit - user.barrierPoints();


} else {


value += Math.floor(vit - (vit * (100/(100+res))));


}


</Custom Barrier Regen>


About the error, see if it is another plugin that you are using. I just tested here and I walked about 2 minutes and no crash. I was only using YEP - Engine Core, YEP - Battle Engine Core, YEP - ATB and YEP - Absorption Barrier. It is probably something that is messing with the barrier regeneration outside of battle.


PS: If you have another problem and want me to see it faster, type @killerfer in your message. I don't see this thread everyday.
@killerfer
Its perfect! I don't know why the other formula was causing the error (especially since it was easier than this one) but it all works perfectly now with no crash. Thank you so much Killerfer

Original thread: https://forums.rpgmakerweb.com/threads/help-with-yanflys-absorbtion-barrier-and-creating-a-max-stat.57454/