Limiting custom-made stats

Aloha,

--Background--
I've been working on making Yanfly's Absorption barrier into a core game mechanic and therefore having it's own gauge and leveling mechanics. All of my units, player and enemy, will use barrier points. Being completely new to coding, I ran into some problems and I believed I had to have a stand alone plug in to display the barrier as it's own stat, but I found that SumRndmDude's Battle Customizer works well.

Spoiler: My test settings to make the Absorption Barrier Gauge
e6870293fe.png

--Problem--
The problem I've run into is that I cannot figure out how to set a maximum limit? Using the actor.barrierPoints function changes the numbers, but it (understandably) cannot show the gauge emptying.

While I'm on this topic, I would also need to know how to make it that the limit is dynamic (increase as the actor levels up)?

After researching, I found that user killerfer had made a Lunatic Mode script from this post that looks 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.

In short, my three questions I request assistance with is:
1. Where do I input Lunatic Mode note tags? I had assumed under Game_Actor, but is the above code just plug and chug?
2. How do I set this for each actor?
3. How to make the limit dynamic?

--The plugins in Question--
Yanfly Absorbtion Barrier plugin
SumRndmDde Battle Status Customizer

--Additional Data--
I use Yanfly's ATB battle system


Thank you so much for taking the time to view this! I've learned so much in just 40 hours haaa. Please forgive me if the questions are super noob. Thanks again. *bows*

Pinging @ABloodyCanadian since I notice they still have interest in this as well.
Inside the Yanfly script, there is this in the help section:

* ============================================================================
* Lunatic Mode - Custom Barrier Points on Battle Start
* ============================================================================
*
* For those with JavaScript proficiency, you can utilize these notetags to
* add a dynamic amount of Barrier Points during the start up of a battle.
*
* Actor, Class, Enemy, Weapon, Armor, and State Notetags:
*
* --- Unexpiring ---
*
* <Custom Barrier Points>
* value += user.hp;
* </Custom Barrier Points>
* The 'value' variable determines how many Barrier Points the user will
* start a battle with. The Barrier Points added through this notetag are
* unexpiring Barrier Points.

For your questions:
1. Notetags are in the Database. This specific notetag can be put on Actors, Classes, Enemies, Weapons, Armors, or States.
2. On the Actor entry in the Database
3. Just like in the example you showed, whereGame Variable 1 is the maximum amount of barrier points, so to increase it you would just increase Game Variable 1.
@Aloe Guvner
Thank you for taking the time to reply, I really, really appreciate it.

I took a while in replying because I had tried to figure out how to define variables and I'm confusing myself. I now understand where/how to input the notetags, but I am still unsure on how to make sense of what I'm doing.

When you (or any other reader) have time, here's a few scenarios that will help me understand what I'm doing:

--Scenario 1: leveling--
At lv 1, actor 1 has 150 barrier points (bp) max
Upon leveling, actor 1 gets +50 max bp.
Now at lv 2, actor has 200bp max.

Common Events:
Control variables: 1 Lv of Actor 1 = set = Level of Actor1
Spoiler: my variable settings
bfa84a8773.png

Actor 1's notes:
<Barrier points: +150>
<Custom Barrier Points>
value += Barrier points: +50 + $gameVariables.value(1) - user.barrierPoints();
</Custom Barrier Points>

My understanding at this time:
Control variables: 1 Lv of Actor 1 = set = Level of Actor 1 (common events was the only way I could find editable variables)
<Barrier Points: +150> (would be the actor 1 base value?)
the Lunatic notetags would be the max bp increase formula? (I'm pretty sure I butchered that)

How would I quote this formula in SumRndmDde's battle status customizer as a max stat?
value += Barrier points: +50 + $gameVariables.value(1) - user.barrierPoints();

--Scenario 2: Capping--
At lv 2, actor 1 has 200 max bp.
At the start of a battle, a skill is cast on actor 1 that gives +50bp, but nothing happens since actor 1's bp is full.

Actor 1's notes:
<Barrier points: +150>
<Custom Barrier Points>
value += Barrier points: +50 + $gameVariables.value(1) - user.barrierPoints();
if (user.barrierPoints() > ($gameVariables.value(1) - $user.barrierPoints()) {
value += $gameVariables.value(1) - user.barrierPoints();
}
</Custom Barrier Points>

My understanding at this time:
If user.barrierPoints function goes above max, then actor's bp will remain max.

Yes I'm a mess. Please help me clean up my act haa. Desperately needing (or I guess in this case wanting) is, from my experience, how I learn best. Thank you for explaining these (probably basic) concepts to me!
--Scenario 1: leveling--
Because you want the Max Barrier to go directly with the Actor Level, no need to mess with any variables. If you had some other way to track the maximum then it might be better as a Game Variable but in this case we can directly access the level.

For Actor 1 to start each battle 50 more Barrier Points for each level, this is the notetag on Actor:
Code:
<Custom Barrier Points>
value += 100 + 50 * user.level;
</Custom Barrier Points>

'value' is the amount that the actor starts the battle with. You can adjust the formula as you see fit.
Actor Level 1: Starts the battle with 150 barrier points
Actor Level 2: Starts the battle with 200 barrier points
Actor Level 3: Starts the battle with 250 barrier points
Actor Level 4: etc. etc.


--Scenario 2: Capping--

This would be the notetag to put on the Skill that is adding the barrier. This is assuming that the Actor is the target of the skill.
Code:
<Custom Target Barrier>
value = Math.min((100 + 50 * target.level) - target.barrierPoints(), 50);
</Custom Target Barrier>
To break it down:
  • 100 + 50 * target.level = this is the maximum barrier points the target is allowed to have
  • target.barrierPoints() = this is how many barrier points the target currently has
  • Math.min(stuff, 50) = takes the minimum value between the other stuff and 50
Actor Level 1 and has 150 BP --> Math.min(0, 50) --> 'value' is 0
Actor Level 1 and has 145 BP --> Math.min(5, 50) --> 'value' is 5
Actor Level 1 and has 100 BP --> Math.min(50, 50) -->'value' is 50
Actor Level 1 and has 20 BP --> Math.min(130, 50) --> 'value' is 50

'value' is the amount that is added to the target of the skill. Notice that this is different than 'value' in the notetag above.
@Aloe Guvner

Awesome! Thanks for explaining that so thoroughly. After testing it out, I am able to do what I want to do now 🙂

Have a wonderful day (because you made mines 10x better)
Thread closed IgnoreMe

Original thread: https://forums.rpgmakerweb.com/threads/limiting-custom-made-stats.89334/