Implementing Poise Gauge

Hello all, getting back into RMMV after a long hiatus and I wanted to know if anyone had ideas on how to make the following idea work:

I'm trying to implement a Sekiro-like poise gauge into a turn based rpg. Essentially, I want most attacks in the game to deal both HP damage AND some Poise damage, and when a character or enemy's poise bar fills all the way up (say to 100), they become "staggered," losing their next turn and taking more damage until they act again, after which stagger wears off and their poise reverts to 0.

The staggered state itself is easy to do, just the normal stun state for a turn plus extra damage taken. It's the poise itself I'm stuck on.

At first I thought to rework TP for the poise gauge, but even with Yanfly's More TP Modes add-on (http://www.yanfly.moe/wiki/More_TP_Modes_(YEP)) I don't see how it could work, because the TP gained is determined by the one being hit, not the attacker, and I want the attacker's skill to determine poise damage. So then I thought adding another sort of health bar would be easier, but I'm not certain how to implement that, or how to trigger the "staggered" state once this secondary health is depleted. I'd be really grateful for any help offered. Thank you!

Tl;dr what I need help with is:

How to implement a secondary health bar (poise)
How to trigger a state once that bar is depleted (stagger)
Bonus points: How to display the bar using WAY Visual Gauges Addon (https://www.dropbox.com/s/7t5eqy8eqxyk4vv/WAY_X_VisualGaugesAddon.js?e=2&dl=0), which I'm already using to show HP, MP TP as it stands

Thank you!
At first I thought to rework TP for the poise gauge, but even with Yanfly's More TP Modes add-on I don't see how it could work
You wouldn't need a plugin to implement that part of it. By default, you gain TP when you are hit and when you use a skill with a TP Gain value in the database.

Once you 0 out all of the TP Gain fields, then the default functionality will make the target gain TP according to how much damage they take.

If you need the gain to not be related to the amount of damage, then you would
- Ask for a one-line plugin to get rid of that part of the default engine
- Use a Yanfly's Skill Core notetag to put Post-Damage Evals on skills that call target.gainTp()
Code:
<Post-Damage Eval>
// Store the current TP for reference
let tempTp = target.tp;
// Deal 12 TP damage
target.gainTp(12);
// Did that damage push them to 100?
if (target.tp >= 100 && tempTp < 100)
    target.addState(69);
// Where 69 is the ID of the state to stun for one turn
</Post-Damage Eval>

I'm not certain how to implement that, or how to trigger the "staggered" state once this secondary health is depleted.
Give the actor a passive state from Yanfly's Auto Passive States with the condition of tp == 100. That can have a defense decrease or Buffs & State notetag or however you want to implement the increased damage.
Thank you so much! I'll try this soon and let you know how it goes!
Since I'm not sure which of the things I listed you want to try, if you need to eliminate the default gaining TP by getting hit...paste the below into a text editor, save it as a *.js file, include as a plugin.
Code:
Game_Battler.prototype.chargeTpByDamage = function(damageRate) {};
You might find this plugin useful:

'm trying to implement a Sekiro-like poise gauge into a turn based rpg. Essentially, I want most attacks in the game to deal both HP damage AND some Poise damage, and when a character or enemy's poise bar fills all the way up (say to 100), they become "staggered," losing their next turn and taking more damage until they act again, after which stagger wears off and their poise reverts to 0.
That's not Sekiro, that's just regular stagger bar that was done since before FF13. I can remember as far back as psp games doing it.

Are you doing multiple healthbars or sectioned thresholds? Instant death triggers for individual phases?
Hello all! sorry for the delay, got sick for a few days. A few things:

@NamEtag You're right, it is not identical to Sekiro's, that was just my first point of reference. No multiple healthbars or instant death triggers, might be interesting in the future, but won't work on anything like that yet

@Silenity Thank you, that is a cool plug-in! I'm gonna stick with TP for poise for now but I downloaded the one you linked and will use it for other stuff

@ATT_Turan Thank you so so much! Everything you mentioned/provided has worked out great for the most part and I'm moving ahead with making skills, states and such to elaborate the system.

Just a couple more things:

1. For some reason, skills are doing a little more TP damage than they should be. The skill in question deals 20 TP damage in the note tag, but for some reason always deal 25 in combat. When I changed it to deal 10, dealt 15 instead. No idea why. EDIT: Thought this was just for enemies but it's happening for player characters too

2. I wanted to use SRD's (praise be) TP Upgrade plug-in but after some testing, I've found it conflicts with YEP Battle Core for some reason. Specifically, what happens is that after the enemy takes their first turn, I'm not given the option to take another turn with the player character. It isn't a freeze, the menu for choosing skills/magic/etc just doesn't show up, maybe because the enemy turn hasn't "finished" or something. For the moment I've just disabled the plugin but it could be useful in the future. If anyone knows of a patch/workaround I'd be mighty grateful.

3. Not a problem but a question. I plan to allow the player characters to choose defensive stances they can change each turn. The options are: Recover (Regain MP (Stamina in my game), lose some TP), Evade (if attacked, don't take damage but lose a fixed amount of MP, say 30, if MP is less than 30 when trying to evade, take attacking skill's HP damage and remove Evade), or Block (if attacked, take no damage, but instead gain TP- amount determined by attacking skill- if TP reaches max then apply staggered state and remove Block). Evade shouldn't be so hard to work out though I don't know how to force a "miss" yet. The real issue is with Block. Is it possible for attacking skills to check if the defender has the Block state and only deal their TP damage IF that is the case, and if so, how would I go about implementing it? I imagine it would happen through skill core, maybe through a modification of the notetag @ATT_Turan provided but I'm not sure.

Thanks again!

PS: As an addendum to #3, I'd like to add a fourth defensive option for monster/beast enemies called Wild where they take HP AND TP damage- the only difference from Block would be that the Wild state wouldn't reduce damage to 0. So I guess the attacking skills should check if EITHER of those states are active.
1. For some reason, skills are doing a little more TP damage than they should be.
You'd have to show your work to get any help. Show any notetags being used, are you in fact using any plugins that deal with it, etc.

Because that's not "a little more," that's consistently 5 more.

Is it possible for attacking skills to check if the defender has the Block state and only deal their TP damage IF that is the case
You could try this. Give actors a passive state with the Yanfly Buffs & States notetag
Code:
<Custom React Effect>
if (target.isGuard() && this.isDamage() && this.isHpEffect())
{
    target.gainTp(value);
    value = 0;
}
</Custom React Effect>
You'd have to show your work to get any help. Show any notetags being used, are you in fact using any plugins that deal with it, etc.

Because that's not "a little more," that's consistently 5 more.


You could try this. Give actors a passive state with the Yanfly Buffs & States notetag
Code:
<Custom React Effect>
if (target.isGuard() && this.isDamage() && this.isHpEffect())
{
    target.gainTp(value);
    value = 0;
}
</Custom React Effect>
As it turns out the extra TP was coming from Yanfly's Enhanced TP Gauge- the enemies and actors were all set to Mode 1 by default which generates extra TP from taking damage.

Thank you for the code, but actually I took out the default Attack and Guard and am using a custom skill, "Block," which applies a custom state (assigned to slot #11) called "Block" to the user that persists until it's broken, so I'd need attacking skills to check for that state specifically. I think the only change to the code you provided would be the

(target.isGuard()

line which I need to alter to check instead for the state- something like

(target.isState11()

though I doubt that's actually how it's written.

Finally, would it be possible to put notetags on weapons to increase the TP damage they deal in accordance with the notetag you provided me earlier? I'd want to amend the line

target.gainTp(12);

to be something like

target.gainTp(12+X);

the X in this case being the amount added by the weapon, so the weapon's tag would have to generate a variable used in the skill's tag. Is something like that possible? Thank you!

EDIT: Another thing I'm running into trouble with: for my Evade skill (which applies the Evade state) I've figured out how to negate the incoming damage, but I cannot for the life of me figure out how to make the user lose a set amount of MP when attacked. What I'm trying to do is use a "deselect" effect from Yanfly Buffs States Core that reads:


<Custom Deselect Effect>

user.gainMP(-30)

</Custom Deselect Effect>

It doesn't seem to work though. Does anyone know of a guide/primer for the sort of javascript coding needed for RPG MAKER? Like, relevant terms and such?
There's a pinned thread in the Learning JavaScript section of MV script calls.

There's also this site:

Neither are likely to be of tremendous use if you don't have a foundation in JavaScript to begin with, they're not intended to be tutorials - but they are an organized reference.
There's a pinned thread in the Learning JavaScript section of MV script calls.

There's also this site:

Neither are likely to be of tremendous use if you don't have a foundation in JavaScript to begin with, they're not intended to be tutorials - but they are an organized reference.
Thank you! I gotta start learning sooner or later. If mods wanna close this thread that'd be great, I've got plenty to work on at the moment.
Going to save this thread for later, I remember doing something like this a while back. Good luck on your project!

Original thread: https://forums.rpgmakerweb.com/threads/implementing-poise-gauge.168857/