Multiple uses from consumable items before it breaks script?

You guys have all been very helpful in making me scripts and I appreciate it.

There is something in RPG Maker for the PS1 that does not exist in VX Ace and I was wondering if there are any scripts to do this. Or one could be made.

Basically, I want an item to be used X amount of times before it breaks. Like you get five uses out of it before the item is used up.

Also, I want to be able to make other items have a certain percentage chance of breaking upon use. say I wanted to have a special item that cures HP, however, there is a 60% chance that once you use the item, it is used up. Meaning, there is a 40% chance you can use the item again.

Ideally I would want something that I can put in the note box on how many times I can use the item or the break chance.
Something like <break after: 5> meaning you have five uses out of it or <Break Chance: 60> meaning 60% chance it will break after use.

Maybe the script could include an editable string in the script letting the user know that it broke. Like "[name of item] broke!"

Could I get someone to get me a script something like this?

Please and thank you.
Here it is:
Try this mod
This is a new script but I just used yanfly skill restrictions for the framework.
Spoiler: Item limited uses
Ruby:
#==============================================================================
#
# ▼ Yanfly Engine Ace - Item Limited Uses v1.00
# -- Last Updated: 2023.09.01
# -- Level: Easy
# -- Requires: n/a
# -- Coded by Roninator2
#==============================================================================

$imported = {} if $imported.nil?
$imported["YEA-ItemLimitUse"] = true

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2023.09.01 - Started Script and Finished.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Sometimes good game balance depends on restriction mechanics. One of these
# mechanics include the amount of times an item can be used (limited uses)
# This is intented to be used with items that you only get one of.
# Compatible with Instance Items (preferred)
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# -----------------------------------------------------------------------------
# Item Notetags - These notetags go in the items notebox in the database.
# -----------------------------------------------------------------------------
# <limit use: x>
# This will allow the skill to only be usable x times throughout the course of
# battle. Once the skill is used x times, it is disabled until the battle is
# over. This effect only takes place during battle.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================

module YEA
  module ITEM_RESTRICT
    
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Limited Use Settings -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # Some skills have limited uses per battle. These limited uses are reset
    # at the start and end of each battle and do not apply when used outside of
    # battle. There are no effects that can affect limited uses.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    LIMIT_COLOUR  = 8          # Colour used from "Window" skin.
    LIMIT_SIZE    = 18         # Font size used
    LIMIT_TEXT    = "%s uses"  # Text used
    LIMIT_ICON    = 0          # Icon used. Set 0 to disable.
    
  end # SKILL_RESTRICT
end # YEA

#==============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================

module YEA
  module REGEXP
    module ITEM
      LIMIT_USE = /<(?:LIMIT_USE|limit use):[ ](\d+)>/i
    end # ITEM
  end # REGEXP
end # YEA

#==============================================================================
# ■ Icon
#==============================================================================

module Icon
 
  #--------------------------------------------------------------------------
  # self.itemlimit
  #--------------------------------------------------------------------------
  def self.itemlimit; return YEA::ITEM_RESTRICT::LIMIT_ICON; end
    
end # Icon

#==============================================================================
# ■ DataManager
#==============================================================================

module DataManager
 
  #--------------------------------------------------------------------------
  # alias method: load_database
  #--------------------------------------------------------------------------
  class <<self; alias load_database_liu load_database; end
  def self.load_database
    load_database_liu
    load_notetags_liu
  end
 
  #--------------------------------------------------------------------------
  # new method: load_notetags_srs
  #--------------------------------------------------------------------------
  def self.load_notetags_liu
    for obj in $data_items
      next if obj.nil?
      obj.load_notetags_liu
    end
  end
 
end # DataManager

#==============================================================================
# ■ RPG::Item
#==============================================================================

class RPG::UsableItem
 
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :limit_use

  #--------------------------------------------------------------------------
  # common cache: load_notetags_liu
  #--------------------------------------------------------------------------
  def load_notetags_liu
    @limit_use = 0
    #---
    self.note.split(/[\r\n]+/).each { |line|
      case line
      #---
      when YEA::REGEXP::ITEM::LIMIT_USE
        @limit_use = $1.to_i
      end
    } # self.note.split
    #---
  end
 
end # RPG::Items

#==============================================================================
# ■ Game_BattlerBase
#==============================================================================

class Game_Battler
 
  #--------------------------------------------------------------------------
  # * Consume Items
  #--------------------------------------------------------------------------
  def consume_item(item)
    if item.limit_use >= 1
      item.limit_use -= 1
    end
    $game_party.consume_item(item) if item.limit_use == 0
  end
    
end # Game_BattlerBase

#==============================================================================
# ■ Window_Base
#==============================================================================

class Window_Base < Window
 
  def limit_colour; text_color(YEA::ITEM_RESTRICT::LIMIT_COLOUR); end;
 
end # Window_Base

#==============================================================================
# ■ Window_SkillList
#==============================================================================

class Window_ItemList < Window_Selectable
 
  #--------------------------------------------------------------------------
  # alias method: draw_item
  #--------------------------------------------------------------------------
  alias window_itemlist_draw_item_liu draw_item
  def draw_item(index)
    if item_limit_restrict?(index)
      draw_item_restriction(index)
    else
      window_itemlist_draw_item_liu(index)
    end
  end
 
  #--------------------------------------------------------------------------
  # new method: limit_restricted?
  #--------------------------------------------------------------------------
  def item_limit_restrict?(index)
    item = @data[index]
    return true if item.limit_use >= 1
  end

  #--------------------------------------------------------------------------
  # new method: draw_item
  #--------------------------------------------------------------------------
  def draw_item_restriction(index)
    item = @data[index]
    rect = item_rect(index)
    rect.width -= 4
    draw_item_name(item, rect.x, rect.y, enable?(item))
    draw_item_limited(rect, item)
  end
 
  #--------------------------------------------------------------------------
  # new method: draw_skill_limited
  #--------------------------------------------------------------------------
  def draw_item_limited(rect, item)
    change_color(limit_colour, enable?(item))
    icon = Icon.itemlimit
    if icon > 0
      draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(item))
      rect.width -= 24
    end
    contents.font.size = YEA::ITEM_RESTRICT::LIMIT_SIZE
    text = sprintf(YEA::ITEM_RESTRICT::LIMIT_TEXT, item.limit_use)
    draw_text(rect, text, 2)
    reset_font_settings
  end
 
end # Window_SkillList

#==============================================================================
#
# ▼ End of File
#
#==============================================================================

Here it is:
Missed that one. I looked in my list but didn't search for charges keyword, otherwise I might have found it.
That is limited uses, not what I am after.

I want the item to be there until you use it a number of time then the item is gone. Also, I want it to work outside the battle.

There is a difference between only allowing an item to be used X amount of times during battle and an item being used up after X amount of times.
That is limited uses, not what I am after.

I want the item to be there until you use it a number of time then the item is gone. Also, I want it to work outside the battle.

There is a difference between only allowing an item to be used X amount of times during battle and an item being used up after X amount of times.
I'm pretty sure the one I gave you does that. But check it out and tell me if I'm wrong. (I haven't tested it myself). About the using it outside of battle, you can just simply do that changing the "ocassion" method in the item database to only map.
About the breaking part, you could make that with a common event each time you use the item.
I want the item to be there until you use it a number of time then the item is gone. Also, I want it to work outside the battle.
Both options we provided do that, it is not restricted to battle only.

use it a number of time then the item is gone
AKA - limited uses

Original thread: https://forums.rpgmakerweb.com/threads/multiple-uses-from-consumable-items-before-it-breaks-script.160820/