じ☆ve冰风 发表于 2026-8-3 10:32:16

Battle Item Count ACE

Battle Item Count ACE

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:       
# * Battle Item Count ACE * #
#   Plug & Play Script
#   Scripter : Kyonides Arkanthes
#   v1.0.4 - 2024-02-03

# The scriptlet updates the number of available items every single time you pick
# one or go back to the prior actor in battle.

class Game_Actor
def clear_battle_item
    @battle_item_id = nil
end
attr_accessor :battle_item_id
end

class Game_Party
def clear_battle_items
    members.each {|m| m.clear_battle_item }
end

def members_battle_items
    members.map {|m| m.battle_item_id }
end

def battle_item_number(item)
    return item_number(item) unless @in_battle
    item_id = item.id
    battle_items = members_battle_items.select {|bit_id| item_id == bit_id }
    item_number(item) - battle_items.size
end
end

class Window_ItemList
alias :kyon_btl_itm_cnt_mk_itm_lst :make_item_list
def enable?(item)
    $game_party.usable?(item) and @battle_items > 0
end

def make_item_list
    @battle_items = {}
    @battle_items.default = 99
    kyon_btl_itm_cnt_mk_itm_lst
end

def draw_item_number(rect, item)
    number = $game_party.battle_item_number(item)
    @battle_items = number
    contents.font.color.alpha = number > 0 ? 255 : translucent_alpha
    number = sprintf(":%2d", number)
    draw_text(rect, number, 2)
end
end

class Scene_Battle
alias :kyon_btl_itm_cnt_scn_btl_term :terminate
alias :kyon_btl_itm_cnt_scn_btl_st_pty_cmd_sel :start_party_command_selection
alias :kyon_btl_itm_cnt_scn_btl_st_act_cmd_sel :start_actor_command_selection
alias :kyon_btl_itm_cnt_scn_btl_on_itm_ok :on_item_ok
alias :kyon_btl_itm_cnt_scn_btl_on_itm_cncl :on_item_cancel
def terminate
    kyon_btl_itm_cnt_scn_btl_term
    $game_party.clear_battle_items
end

def start_party_command_selection
    kyon_btl_itm_cnt_scn_btl_st_pty_cmd_sel
    $game_party.clear_battle_items
end

def start_actor_command_selection
    kyon_btl_itm_cnt_scn_btl_st_act_cmd_sel
    BattleManager.actor.clear_battle_item
end

def on_item_ok
    BattleManager.actor.battle_item_id = @item_window.item.id
    kyon_btl_itm_cnt_scn_btl_on_itm_ok
end

def on_item_cancel
    BattleManager.actor.clear_battle_item
    kyon_btl_itm_cnt_scn_btl_on_itm_cncl
end
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-ace.165150/
页: [1]
查看完整版本: Battle Item Count ACE