MV Yanfly Item Durability show in Item Name

I want the durability of an item from Yanfly Item Durability to show after the item name, like a suffix, possible with the Yanfly Item Core. This is so the player can easily judge the uses left without having to enter a new window (they select the weapon for each attack).

I figured out you can get the durability via item.durability but I don't know how to make it a suffix, nor how to update it after each use.

Some formatting, like "Iron Sword (16/30)" would be great but just "Iron Sword 16" also works.

I don't have any problems using Lunatic notetags, I just don't know which to use here and how to mix the two plugins.
So the variables in the plugin are .durability and .durMax. To help with any formatting beyond that, you'll have to explain a bit more how the player is selecting the weapon for each attack, provide the code you're using for that. But generally speaking, you should be able to do something like:
Code:
var obj=$dataItems[id number];
var displayString=obj.name + " (" + obj.durability + "/" + obj.durMax + ")";
then use displayString wherever.
This is what I have for now:

Code:
<Custom Execution>
  var id = a.equips[0].id
  var durab = a.equips[0].durability
  var baseName = $data_weapons[id].name
  var name = a.equips[0].name

  name = baseName + " (" + durab + ")"
</Custom Execution>
I'm using this in the Attack Skill, to change the weapon name after each use.
It's not doing anything for now, so maybe I'm missing something...

EDIT: For reference, the only weapon slot is the first one, so index 0 for everyone I'd suppose. I'm also testing only with the Attack skill, as this code is not written in other skill boxes.
You're not doing anything with it. You're saying the variable name is equal to this text string...and that's it. You're not doing anything to show that to the player or change the name of the item or whatever it is you want to happen.
This is what I have for now:

Code:
<Custom Execution>
  var id = a.equips[0].id
  var durab = a.equips[0].durability
  var baseName = $data_weapons[id].name
  var name = a.equips[0].name

  name = baseName + " (" + durab + ")"
</Custom Execution>
I'm using this in the Attack Skill, to change the weapon name after each use.
It's not doing anything for now, so maybe I'm missing something...

EDIT: For reference, the only weapon slot is the first one, so index 0 for everyone I'd suppose. I'm also testing only with the Attack skill, as this code is not written in other skil
in SRPG Engine why not funtion.

var id = a.equips[0].id
var durab = a.equips[0].durability
var baseName = $data_weapons[id].name
var name = a.equips[0].name
var namesenjata = baseName + " (" + durab + ")"
this.drawText(namesenjata, tp, lh * 5);
in SRPG Engine why not funtion.
If you read the post you're quoting, you're trying to use code that was already wrong and didn't function.

Additionally, this thread is 3 years old and the person you're quoting/asking hasn't been on the site for a year.

@Adisas88, please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.


Please make a new thread instead.

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-item-durability-show-in-item-name.134498/