Any way to update skill description in mid-combat?

So I'm trying to create a skill that uses item each time it was used. I managed to create one using common event, but I was concerned due to the lack of information of whether the item was available for using that skill.

I tried putting a variable that checks the item in the middle of combat, and then make so the variable was shown on the skill description. However, after the skill was used, it appears that the variable number didn't change, even though I immediately set the variable to the item amount after use.

I believe it was due to the description wasn't updated in mid-combat. Any way so I could refresh it after skill use?
So, if I understand correctly, let's say you have 5 Potions and you have a skill that uses a Potion. Your skill description should say something like, "There are 5 Potions to use." You use your skill, it uses up a Potion, so you want the skill description to say, "There are 4 Potions to use." However, in mid-combat, it still says, "There are 5 Potions to use."

Is that right?

If that's the case, it looks like you need to set the variable again after using an item/skill. As an example, if I have a skill with the description "\V[1] Potions left", then set Variable 1 to the number of Potions in the player's inventory, then the description will be "5 Potions left" (if there are 5 Potions). If I use a Potion, it will still say "5 Potions left" unless I set Variable 1 to the number of Potions again.
So, if I understand correctly, let's say you have 5 Potions and you have a skill that uses a Potion. Your skill description should say something like, "There are 5 Potions to use." You use your skill, it uses up a Potion, so you want the skill description to say, "There are 4 Potions to use." However, in mid-combat, it still says, "There are 5 Potions to use."

Is that right?

If that's the case, it looks like you need to set the variable again after using an item/skill. As an example, if I have a skill with the description "\V[1] Potions left", then set Variable 1 to the number of Potions in the player's inventory, then the description will be "5 Potions left" (if there are 5 Potions). If I use a Potion, it will still say "5 Potions left" unless I set Variable 1 to the number of Potions again.

Yes, you understand it correctly. However, I already tried to update the variable (first by using substraction on the var, second by set the var into the current quantity after use) and it didn't seems to update the change.
It should work to update the variable after you use the skill. If you're having trouble with that, you might find my Sync Variables with Items plugin useful, you can keep a variable always equal to the count of any item in your inventory.
It should work to update the variable after you use the skill. If you're having trouble with that, you might find my Sync Variables with Items plugin useful, you can keep a variable always equal to the count of any item in your inventory.

Thanks. If the system really did update accordingly on change, then perhaps I made a mistake somewhere else. I shall try checking it once more later.
Maybe you can show us your various database information? That is, the skill and whatever events you're using to update the variable.

I tried having a skill with the description "\V[1] Potions in inventory", then made a troop that, at the end of each turn, sets variable 1 to the current count of Potions in the inventory. The skill description updated appropriately mid-combat.

Presumably, your skill that consumes items could just have a common event that sets the variable you're using in your description accordingly. You could also probably do it in the damage formula, if you're using one.
Maybe you can show us your various database information? That is, the skill and whatever events you're using to update the variable.

I tried having a skill with the description "\V[1] Potions in inventory", then made a troop that, at the end of each turn, sets variable 1 to the current count of Potions in the inventory. The skill description updated appropriately mid-combat.

Presumably, your skill that consumes items could just have a common event that sets the variable you're using in your description accordingly. You could also probably do it in the damage formula, if you're using one.
I would like to, but unfortunately I'm currently at work right now. I will try to upload it later. Thanks for the help.

EDIT:
Spoiler
This is the skill page. The skill in question is Arrow Barrage. The 1st one is the trigger, while the 2nd one is the actual skill if there's still Arrow Quiver remaining (the 3rd one to fail the skill).

Spoiler
This is the item page. I don't think there was much to say here, considering the item wasn't usable.

Spoiler
This is the common event page. This page call for switch that will activate on battle event.

Spoiler
This is the battle event section on Troops page. When the switch is activated, it will call for a conditional branch that will check whether there is any Arrow Quiver left.
If there are any {
Skill 2 play
Arrow Quiver -1
variable update (var = arrow left)
script (only for battle log about remaining item)
switch off
}
else {
Skill 3 play (fail)
switch off
}



Spoiler
By the way, on turn 0, there is also variable operation to check remaining item on battle start.
So I've discovered an interesting issue here. When I have a common event or a troop event that reduces the number of an item, if I display text to show the current variable representing the inventory count, it shows the correct number. However, the skill description doesn't update unless I actually open the item window.

As an example, if I recreate what you have, I see the variable updating as expected, but the skill description doesn't - but then if I go to items in battle, even if I don't use one, then back to the skill, the skill description updates appropriately.

I have to leave for work in a few minutes, but I'll dig into the underlying code later and see if I can't figure out why what you're doing doesn't work and a possible workaround.
It's possible that the skill description window isn't being refreshed, but rather just hidden / shown.
@Zevia: Thanks, I appreciate it XD.

@Aloe Guvner: Hmm, if it's hidden, do you have a suggestion on how to show it?

At the moment, following what Zevia has found, I believe the workaround is how to call the item menu and then immediately close it. From what I've seen script operation could do, I think it's even possible to do so without the player even notice.
Aloe Guvner got it right - when you open up the Skill Window, all it does for the Help Window is call the show method, which only changes its visibility and does not refresh the text. So, I've got a couple solutions for you.

One is a very small plugin. Doesn't require any configuration, just drop it in, save your project, good to go:
Code:
/*:
* @plugindesc This plugin automatically refreshes the helpWindow when it's shown.
* @author Zevia

* @help When the current Scene's Help Window is shown, its refresh method will
* also be called so that variable values will be recalculated.
*/

(function() {
    'use strict';

    Window_Help.prototype.show = function() {
        this.refresh();
        Window_Base.prototype.show.call(this);
    };
})();

The other is to add the following script call to your common event after you've changed the variable:
Code:
SceneManager._scene._helpWindow.refresh();

This will refresh the text of the description so that it properly updates the current value of the variable before it's shown.

One other note, unrelated to your issue: you might want to move the logic from your troop event into your common event. Since your first Arrow Barrage skill has to target an enemy, your common event can then force your actor to use your second or third Arrow Barge skill with the target of "last target" and it will still target the same enemy. That way, you only have to manage the event in one place, instead of every troop in your database.

It will also remove the need for turning a switch on and off and having a "moment" listener in every troop.

Spoiler: Example Images
Skill:
SwssQfp.png

Common Event:
qwWc7Pg.png
Aloe Guvner got it right - when you open up the Skill Window, all it does for the Help Window is call the show method, which only changes its visibility and does not refresh the text. So, I've got a couple solutions for you.

One is a very small plugin. Doesn't require any configuration, just drop it in, save your project, good to go:
Code:
/*:
* @plugindesc This plugin automatically refreshes the helpWindow when it's shown.
* @author Zevia

* @help When the current Scene's Help Window is shown, its refresh method will
* also be called so that variable values will be recalculated.
*/

(function() {
    'use strict';

    Window_Help.prototype.show = function() {
        this.refresh();
        Window_Base.prototype.show.call(this);
    };
})();

The other is to add the following script call to your common event after you've changed the variable:
Code:
SceneManager._scene._helpWindow.refresh();

This will refresh the text of the description so that it properly updates the current value of the variable before it's shown.

One other note, unrelated to your issue: you might want to move the logic from your troop event into your common event. Since your first Arrow Barrage skill has to target an enemy, your common event can then force your actor to use your second or third Arrow Barge skill with the target of "last target" and it will still target the same enemy. That way, you only have to manage the event in one place, instead of every troop in your database.

It will also remove the need for turning a switch on and off and having a "moment" listener in every troop.

Spoiler: Example Images
Skill:
SwssQfp.png

Common Event:
qwWc7Pg.png

Thank you very much, Zevia. I'll try this as soon as I got back from work.

I didn't know that I could just use common event for calling skill. This will definitely make my work easier, thanks!

EDIT: It worked exactly as I hoped for! Thanks!

Original thread: https://forums.rpgmakerweb.com/threads/any-way-to-update-skill-description-in-mid-combat.104262/