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

[转载发布] KPocket VX

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    慵懒
    3 天前
  • 签到天数: 207 天

    连续签到: 1 天

    [LV.7]常住居民III

    3646

    主题

    862

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 昨天 16:01 | 显示全部楼层 |阅读模式
    KPocket VX
    version 1.0.6

    by Kyonides Arkanthes



    Introduction

    Force the player to keep a reduced inventory while in battle!

    Of course, the player may choose which items he or she will pack in his or her pocket.

    It is possible to call the Pocket menu from the Item menu or the map! :grin:  For more information, please read the comments I have included in my script.


    VX Script
                    Code:       
    # * KPocket VX#   Scripter : Kyonides Arkanthes#   v1.0.6 - 2019-12-01# This script allows the player to send specific items, no weapons nor armors# included, to a pocket with a limited storage space. You can open this new menu# via a script call or open the item menu and hitting the OPEN_BUTTON. If the# player opened the new Pocket menu, the player will be able to replenish items# or send them back to their inventory.# Pressing the SEND_ITEM_BUTTON will send an item to the pocket. The amount is# fixed based on the current value of the KPocket.item_limit variable.# * Script Calls *# $scene = KPocketItem.new#   Opens the Pocket Menu!# KPocket.slot_limit = Integer#   Set a new slot limit for your pocket.# KPocket.item_limit = Integer#   Set a new limit for items of the same kind.module KPocket  SWITCH_ID = 1 # Switch that activates Pocket instead of Bag  OPEN_BUTTON = Input::CTRL # Open KPocket Menu!  SEND_ITEM_BUTTON = Input::SHIFT  HELP_BUTTON = Input::Z  HELP_BUTTON_TITLE = 'Available Buttons'  HELP_BUTTONS = %w{SHIFT CTRL Z B}  HELP_BUTTON_DATA = [    'Send items to your pocket',    'Open Pocket Menu',    'Open this help window',    'Cancel or Close any menu'  ]  SENT_ITEM_LABEL = "Sent %s %s to your pocket!"  OPTIONS = ['Refill', 'To Bag', 'Cancel']  OPEN_CLOSE_INFO = ['C: Show options', 'B: Close or Exit']  @slot_limit = 10 # How many different items will be allowed?  @item_limit = 10 # Maximum number of items of the same kind  class << self    attr_accessor :slot_limit, :item_limit, :open_item_menu, :show_pocket_msg  endendunless $HIDDENCHESTmodule Graphics  def self.width() 640 end  def self.height() 480 endendendclass RPG::Item  def type() :item endendclass Game_Party  alias :kyon_pocket_gm_party_init :initialize  alias :kyon_pocket_gm_party_icu? :item_can_use?  def initialize    kyon_pocket_gm_party_init    @pocket = {}    @pocket.default = 0  end  def item_can_use?(item)    switch_on = $game_switches[KPocket::SWITCH_ID]    return true if switch_on and item.type == :item and @pocket[item.id] > 0    kyon_pocket_gm_party_icu?(item)  end  def to_pocket(item, n)    item_id = item.id    @pocket[item_id] += n    @pocket.delete(item_id) if @pocket[item_id] == 0    gain_item(item, -n)  end  def pocket_can_use?(item_id)    return if @pocket[item_id] == 0    occasion = $data_items[item_id].occasion    ($game_temp.in_battle and occasion < 2)  end  def pocket_number(item_id) @pocket[item_id] end  attr_reader :pocketendclass Window_Selectable  def no_item?() @data[index] == nil endendclass Window_Item  alias :kyon_pocket_win_item_up_help :update_help  def update_help    kyon_pocket_win_item_up_help unless KPocket.show_pocket_msg  endendclass KItemPocketWindow < Window_Selectable  def initialize    wh = $game_temp.in_battle ? 232 : 304    super(0, 56, Graphics.width, wh)    @column_max = 2    self.index = 0    refresh    self.back_opacity = 160 if $game_temp.in_battle  end  def refresh    create_contents    @data = []    $game_party.pocket.keys.sort.each{|n| @data << $data_items[n] }    @item_max = @data.size    return if @item_max == 0    self.contents = Bitmap.new(width - 32, row_max * 32)    @item_max.times{|pos| draw_item(pos) }  end  def draw_item(index)    rect = item_rect(index)    self.contents.clear_rect(rect)    item = @data[index]    return unless item    number = $game_party.pocket_number(item.id)    enabled = $game_party.pocket_can_use?(item.id)    rect.width -= 4    draw_item_name(item, rect.x, rect.y, enabled)    self.contents.draw_text(rect, sprintf(":%2d", number), 2)  end  def update_help    text = no_item? ? "" : @data[@index].description    @help_window.set_text(text)  end  def item() @data[@index] || RPG::Item.new endendclass KButtonInfoWindow < Window_Base  def initialize(x, w)    super(x, 56, w, 320)    bit = Bitmap.new(width - 32, height - 32)    bw = bit.width    bit.font.size = 24    bit.draw_text(0, 0, bw, 26, KPocket::HELP_BUTTON_TITLE, 1)    bit.fill_rect(8, 27, bw - 14, 4, Color.new(0, 0, 0))    bit.fill_rect(8, 28, bw - 16, 2, normal_color)    bit.font.size = 22    data = KPocket::HELP_BUTTON_DATA    buttons = KPocket::HELP_BUTTONS    buttons.size.times do |n|      by = 34 + n * 24      bit.draw_text(0, by, bw, 24, buttons[n])      bit.draw_text(96, by, bw, 24, data[n])    end    self.contents = bit  endendclass BasicButtonInfoWindow < Window_Base  def initialize    super(0, Graphics.height - 56, Graphics.width, 56)    self.contents = Bitmap.new(width - 32, height - 32)    half = width / 2    labels = KPocket::OPEN_CLOSE_INFO    contents.draw_text(0, 0, half, 24, labels[0])    contents.draw_text(half, 0, half, 24, labels[1])  endendclass Scene_Item  alias :kyon_pocket_scn_item_start :start  alias :kyon_pocket_scn_item_term :terminate  alias :kyon_pocket_scn_item_up :update  alias :kyon_pocket_scn_item_up_item_sel :update_item_selection  def start    @button_info = KButtonInfoWindow.new(130, 380)    @button_info.visible = false    kyon_pocket_scn_item_start  end  def terminate    kyon_pocket_scn_item_term    @button_info.dispose  end  def update    kyon_pocket_scn_item_up    update_help if @stage == :help  end  def update_item_selection    kyon_pocket_scn_item_up_item_sel    if Input.trigger?(KPocket::OPEN_BUTTON)      return Sound.play_buzzer if $game_party.pocket.empty?      Sound.play_decision      return $scene = KPocketItem.new    elsif Input.trigger?(KPocket::SEND_ITEM_BUTTON)      @item = @item_window.item      return Sound.play_buzzer unless @item      return send_item2pocket    elsif Input.trigger?(KPocket::HELP_BUTTON)      Sound.play_decision      @item_window.active = false      @button_info.z = 200      @button_info.visible = true      return @stage = :help    elsif Input.trigger?(Input::C) or Input.dir4 > 0      KPocket.show_pocket_msg = false    end  end  def send_item2pocket    item_id = @item.id    packed = KPocket.item_limit - $game_party.pocket_number(item_id)    return Sound.play_buzzer if packed == 0    Sound.play_decision    number = $game_party.item_number(@item)    number = packed if number > packed    $game_party.to_pocket(@item, number)    KPocket.show_pocket_msg = true    @item_window.refresh    text = sprintf(KPocket::SENT_ITEM_LABEL, number, @item.name)    @help_window.set_text(text, 1)  end  def update_help    if Input.trigger?(Input::B) or Input.trigger?(Input::C)      Sound.play_cancel      @stage = nil      @button_info.z = 0      @button_info.visible = false      @item_window.active = true    end  endendclass KPocketItem  def main    @stage = :main    @help_window = Window_Help.new    @item_window = KItemPocketWindow.new    @item_window.help_window = @help_window    @button_window = BasicButtonInfoWindow.new    @options = Window_Command.new(192, KPocket::OPTIONS)    @options.visible = false    @options.active = false    @options.x = (Graphics.width - 192) / 2    @options.y = (Graphics.height - 128) / 2    Graphics.transition    main_loop while @stage    Graphics.freeze    @options.dispose    @button_window.dispose    @help_window.dispose    @item_window.dispose  end  def main_loop    Graphics.update    Input.update    update  end  def update    @item_window.update    if @stage == :main      update_item    elsif @stage == :choose      update_select    end  end  def update_item    if Input.trigger?(Input::B)      Sound.play_cancel      $scene = KPocket.open_item_menu ? Scene_Item.new : Scene_Map.new      KPocket.open_item_menu = nil      return @stage = nil    elsif Input.trigger?(Input::C)      return Sound.play_buzzer if @item_window.no_item?      @item = @item_window.item      @current = $game_party.pocket_number(@item.id)      full = $game_party.pocket.size == KPocket.slot_limit      return Sound.play_buzzer if full or KPocket.item_limit == @current      Sound.play_decision      @item_window.active = false      @options.active = true      @options.visible = true      @stage = :choose    end  end  def update_select    @options.update    if Input.trigger?(Input::B)      return to_main    elsif Input.trigger?(Input::C)      pos = @options.index      return to_main if pos == 2      Sound.play_decision      if pos == 0        packed = KPocket.item_limit - @current        number = [$game_party.item_number(@item), packed].min        $game_party.to_pocket(@item, number)      else        $game_party.to_pocket(@item, -@current)      end      @item_window.refresh      @item_window.active = true      @options.visible = false      @options.active = false      @stage = :main    end  end  def to_main    Sound.play_cancel    @options.visible = false    @options.active = false    @item_window.active = true    @stage = :main  endendclass Scene_Battle  def start_item_selection    @help_window = Window_Help.new    if $game_switches[KPocket::SWITCH_ID]      @item_window = KItemPocketWindow.new    else      Window_Item.new(0, 56, 544, 232)    end    @item_window.help_window = @help_window    @actor_command_window.active = false  endend


    Terms & Conditions

    You must include my nickname and the current website's URL in your game credits. Do not repost it anywhere else!
    Free for non commercial games.


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

    本帖子中包含更多资源

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

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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-7-10 01:13 , Processed in 0.067905 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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