Hello.
I am using Yanfly's Item Durability Plugin for the use of Weapons, but for the sake of the player's convenience I used Yanfly Buff and States Core to create a state and manipulate it's counter to display the current number of uses a Weapon has left.
Works like this:
<Custom Action End Effect>
var dur = user.equips()[0].durability;
if(dur >= 0)
{
user.setStateCounter(12, dur);
} else {
user.setStateCounter(12, "∞");
}
</Custom Action End Effect>
This will show the remaining uses of a weapon, unless the weapon is unbreakable in which case it just shows the infinity sign. Works just fine in combat. I also have the same code for a <Custom Battle Effect> to update the information when entering battle.
The problem I'm having is that because this is the only way for the state to update, any changes to weapons outside of combat will not reflect on the menu screen. So if the last battle ended with the remaining durability at 8, and the character decides to change to a weapon with a durability of 12, it will still display as 8 in the menu.
Unfortunately, Buff and States Core only provide conditions for updates that can happen in battle. If someone knows how to update the state when needed in the menu, like when the scene is updated when the character changes, that would defiantly help the game seem less clunky.
I am using Yanfly's Item Durability Plugin for the use of Weapons, but for the sake of the player's convenience I used Yanfly Buff and States Core to create a state and manipulate it's counter to display the current number of uses a Weapon has left.
Works like this:
<Custom Action End Effect>
var dur = user.equips()[0].durability;
if(dur >= 0)
{
user.setStateCounter(12, dur);
} else {
user.setStateCounter(12, "∞");
}
</Custom Action End Effect>
This will show the remaining uses of a weapon, unless the weapon is unbreakable in which case it just shows the infinity sign. Works just fine in combat. I also have the same code for a <Custom Battle Effect> to update the information when entering battle.
The problem I'm having is that because this is the only way for the state to update, any changes to weapons outside of combat will not reflect on the menu screen. So if the last battle ended with the remaining durability at 8, and the character decides to change to a weapon with a durability of 12, it will still display as 8 in the menu.
Unfortunately, Buff and States Core only provide conditions for updates that can happen in battle. If someone knows how to update the state when needed in the menu, like when the scene is updated when the character changes, that would defiantly help the game seem less clunky.
