设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 117|回复: 0

[转载发布] FG7 - Easy Item Charges

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9071

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    58883
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    68848

    灌水之王

    发表于 2026-8-2 19:37:27 | 显示全部楼层 |阅读模式
    Easy Item Charges
    By: FamilyGamer7

    Introduction
                            This script was designed to imitate an item charge effect on consumable items. I had this script created within my own project/game and I thought someone could find it useful. Easy and efficient.               
    Click to expand...


    Features
                            The ability to have an item charge count on a consumable item for multiple uses. By default the game engine works similar in this way without the concept of non-stacks. The script is designed/intended to be used with Hime - Instance Items and is also a requirement for this script run and work.
    Click to expand...


    Screenshots
                            - Not Needed -               
    Click to expand...


    Script
    Spoiler: FG7 - Easy Item Charges
                    Ruby:       
    1. #==============================================================================
    2. # Title: Easy Item Charges
    3. # Author: FamilyGamer7 (FG7)
    4. # Version: 1.3
    5. # Engine: RPG Maker VX Ace
    6. #==============================================================================
    7. # ** Description |
    8. # ----------------
    9. # The "easiest" way to implement an Item Charge type effect on items.
    10. #==============================================================================
    11. # ** Change Log |
    12. # ---------------
    13. # 1.0 => Created Script
    14. # 1.1 => Removed "Alias" method as it caused issues with the project
    15. # 1.2 => Removed item charge limit (Flexible for any game/project)
    16. # 1.3 => Added Item Charges switch for ON/OFF functionality
    17. #==============================================================================
    18. # ** Terms of Use |
    19. # -----------------
    20. # * Free to use in non-commercial projects and commercial projects
    21. # * Feel free to modify and improve the script. Credit is still required.
    22. # * Credit FamilyGamer7
    23. #==============================================================================
    24. # ** Script(s) Required |
    25. # -----------------------
    26. # Hime - Instance Items:
    27. # (http://himeworks.com/redirect.php?type=script&name=Instance_Items)
    28. #
    29. # Place this script below "Hime - Instance Items" script.
    30. #==============================================================================
    31. # ** Usage |
    32. # ----------
    33. # * Plug & Play (See notes below for more information)
    34. #==============================================================================
    35. # ** Notes |
    36. # ----------
    37. # Just need to add "ANY" number value on the end of your item name.
    38. #
    39. # Ex: "Potion 3"
    40. # Ex: "Antidote 76"
    41. # Ex: "Elixir 6"
    42. #
    43. # -----------------
    44. # | Script calls: |
    45. # -----------------
    46. # - To turn script off:
    47. #     $game_system.item_charges_switch_off(true)
    48. #
    49. # - To turn script on:
    50. #     $game_system.item_charges_switch_off(false)
    51. #
    52. # * This script is ON by default, so the turn script on call is not needed
    53. #   unless you used the turn off script.
    54. #==============================================================================
    55. #==============================================================================
    56. # ** Required Script Checker
    57. #------------------------------------------------------------------------------
    58. # Ensures Required Script is in place. If not, Game will close down.
    59. #==============================================================================
    60. $imported = {} if $imported.nil?
    61.   unless $imported["TH_InstanceItems"]
    62.     msgbox("Required 'Hime - Instance Items' is not detected - Closing Game")
    63.   exit
    64. end
    65. #==============================================================================
    66. # ** Module: FG7::Easy_Item_Charges
    67. #------------------------------------------------------------------------------
    68. #  This modules creates a static variable to be used within the script.
    69. #==============================================================================
    70. module FG7
    71.   module Easy_Item_Charges
    72.    
    73. #==============================================================================
    74. # -------------------- ALLOWED TO EDIT BELOW THIS LINE ---------------------- #
    75. #==============================================================================
    76.   # Sets the switch number used for the Item Charges script
    77.   # (Feel free to change switch number for your project)
    78.   Item_Charge_Switch = 1001
    79. #==============================================================================
    80. # ---------- DO NOT EDIT BELOW THIS LINE (FOR ADVANCED USERS) --------------- #
    81. #==============================================================================
    82.   end
    83. end
    84. #==============================================================================
    85. # ** Game_System
    86. #------------------------------------------------------------------------------
    87. #  This class handles system data. It saves the disable state of saving and
    88. # menus. Instances of this class are referenced by $game_system.
    89. #==============================================================================
    90. class Game_System
    91.   #--------------------------------------------------------------------------
    92.   # * New Method: Item Charges Switch - To turn OFF/ON
    93.   # (By default the switch is off = the script is turned "ON" working)
    94.   #--------------------------------------------------------------------------
    95.   def item_charges_switch_off(string)
    96.     $game_switches[FG7::Easy_Item_Charges::Item_Charge_Switch] = string
    97.   end
    98. end
    99. #==============================================================================
    100. # ** Scene_ItemBase
    101. #------------------------------------------------------------------------------
    102. #  This class performs common processing for the item screen and skill screen.
    103. #==============================================================================
    104. class Scene_ItemBase < Scene_MenuBase
    105.   #--------------------------------------------------------------------------
    106.   # * Alias Method: Use Item (Modified to simulate "Item Charges" on items)
    107.   #--------------------------------------------------------------------------
    108.   alias :fg7_easy_item_charges_use_item :use_item
    109.   def use_item
    110.     # Checks if switch is turned on to use item charges for items
    111.     if $game_switches[FG7::Easy_Item_Charges::Item_Charge_Switch] == false
    112.       play_se_for_item
    113.       # Checks if a number is in the items name
    114.       if item.name =~ /\d/
    115.         # Separates the number from item.name and subtracts to equal new number
    116.         $item_name = item.name
    117.         $original_charge = $item_name.gsub(/[^0-9]/, '')
    118.         $reduced_charge = $original_charge.to_i - 1
    119.         $item_name = $item_name.gsub!(/\d+/,"") + $reduced_charge.to_s
    120.         # If item charge equals 1 - remove the "1" number value on item name
    121.         if $reduced_charge.to_s == "1"
    122.           $item_name = $item_name.gsub!(/\d+/,"")
    123.         end
    124.         # Places item variable back into "item.name"
    125.         item.name = $item_name
    126.         @category_window.activate
    127.       # When no number in item name - treat item as normal usage
    128.       else
    129.         user.use_item(item)
    130.         # If consuming last item in list, move cursor to top of list
    131.         @item_window.select(0) if item == nil
    132.       end
    133.       use_item_to_actors
    134.       check_common_event
    135.       check_gameover
    136.       @actor_window.refresh
    137.       # Added to provide a true item charge usage feel
    138.       @actor_window.deactivate.unselect
    139.     else
    140.       # If switch is turned off - perform original use_item call
    141.       fg7_easy_item_charges_use_item
    142.     end
    143.   end
    144. end
    复制代码


    How to Use
                            Add this script in the script editor under in the "Materials" section and above "Main Process".
    The instructions and setup for the script are held within the script header itself. No need to repeat here.               
    Click to expand...


    Terms of Use
                            - Free to use in non-commercial projects and commercial projects
    - Feel free to modify and improve the script. Credit is still required.
    - Credit FamilyGamer7               
    Click to expand...




    本贴来自国际rpgmaker官方论坛作者:FG7处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/fg7-easy-item-charges.143823/
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-17 09:31 , Processed in 0.135579 second(s), 51 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表