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

[转载发布] Battle Item Count VX

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

    连续签到: 2 天

    [LV.7]常住居民III

    7564

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 2026-7-18 17:42:56 | 显示全部楼层 |阅读模式
    Battle Item Count VX

    by Kyonides


    Introduction

    Do you need to update the number of potions or elixirs currently available for the next couple of actors during battle?
    Or were you in need of canceling your previous actor's action to change the item the actor is going to consume next?
    Then this scriptlet is for you!


                    Ruby:       
    1. # * Battle Item Count VX * #
    2. #   Plug & Play Script
    3. #   Scripter : Kyonides Arkanthes
    4. #   v1.0.4 - 2024-02-03
    5. # The scriptlet updates the number of available items every single time you pick
    6. # one or go back to the prior actor in battle.
    7. class Game_Actor
    8.   def clear_battle_item
    9.     @battle_item_id = nil
    10.   end
    11.   attr_accessor :battle_item_id
    12. end
    13. class Game_Party
    14.   def clear_battle_items
    15.     members.each {|m| m.clear_battle_item }
    16.   end
    17.   def members_battle_items
    18.     members.map {|m| m.battle_item_id }
    19.   end
    20.   def battle_item_number(item)
    21.     return item_number(item) unless $game_temp.in_battle
    22.     item_id = item.id
    23.     battle_items = members_battle_items.select {|bit_id| item_id == bit_id }
    24.     item_number(item) - battle_items.size
    25.   end
    26. end
    27. class Window_Item
    28.   alias :kyon_btl_itm_cnt_win_ref :refresh
    29.   def refresh
    30.     @battle_items = {}
    31.     @battle_items.default = 99
    32.     kyon_btl_itm_cnt_win_ref
    33.   end
    34.   def enable?(item)
    35.     $game_party.item_can_use?(item) and @battle_items[item.id] > 0
    36.   end
    37.   def draw_item(index)
    38.     rect = item_rect(index)
    39.     self.contents.clear_rect(rect)
    40.     item = @data[index]
    41.     return unless item
    42.     number = $game_party.battle_item_number(item)
    43.     @battle_items[item.id] = number
    44.     enabled = enable?(item)
    45.     rect.width -= 4
    46.     draw_item_name(item, rect.x, rect.y, enabled)
    47.     self.contents.draw_text(rect, sprintf(":%2d", number), 2)
    48.   end
    49.   def battle_item_none?
    50.     @battle_items[@data[@index].id] == 0
    51.   end
    52. end
    53. class Scene_Battle
    54.   alias :kyon_btl_itm_cnt_scn_btl_term :terminate
    55.   alias :kyon_btl_itm_cnt_scn_btl_st_pty_cmd_sel :start_party_command_selection
    56.   alias :kyon_btl_itm_cnt_scn_btl_prr_act :prior_actor
    57.   alias :kyon_btl_itm_cnt_scn_btl_end_trgt_act_sel :end_target_actor_selection
    58.   def terminate
    59.     kyon_btl_itm_cnt_scn_btl_term
    60.     $game_party.clear_battle_items
    61.   end
    62.   def start_party_command_selection
    63.     $game_party.clear_battle_items
    64.     kyon_btl_itm_cnt_scn_btl_st_pty_cmd_sel
    65.   end
    66.   def turn_decrease_item_count
    67.     @active_battler.clear_battle_item if @active_battler
    68.   end
    69.   def prior_actor
    70.     turn_decrease_item_count
    71.     kyon_btl_itm_cnt_scn_btl_prr_act
    72.     turn_decrease_item_count
    73.   end
    74.   def update_target_actor_selection
    75.     @target_actor_window.update
    76.     if Input.trigger?(Input::B)
    77.       Sound.play_cancel
    78.       end_target_actor_selection
    79.     elsif Input.trigger?(Input::C)
    80.       Sound.play_decision
    81.       @active_battler.action.target_index = @target_actor_window.index
    82.       @active_battler.battle_item_id = @item.id if @item
    83.       @item = nil
    84.       end_target_actor_selection
    85.       end_skill_selection
    86.       end_item_selection
    87.       next_actor
    88.     end
    89.   end
    90.   def update_item_selection
    91.     @item_window.active = true
    92.     @item_window.update
    93.     @help_window.update
    94.     if Input.trigger?(Input::B)
    95.       Sound.play_cancel
    96.       end_item_selection
    97.     elsif Input.trigger?(Input::C)
    98.       @item = @item_window.item
    99.       $game_party.last_item_id = @item.id if @item
    100.       return Sound.play_buzzer unless $game_party.item_can_use?(@item)
    101.       return Sound.play_buzzer if @item_window.battle_item_none?
    102.       Sound.play_decision
    103.       determine_item
    104.     end
    105.   end
    106. end
    复制代码


    Terms & Conditions

    Free for use in ANY game.
    Due credit is mandatory.
    That's it!



    本贴来自国际rpgmaker官方论坛作者:kyonides处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/battle-item-count-vx.163036/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-7-30 21:21 , Processed in 0.129746 second(s), 55 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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