赞 | 3 |
VIP | 333 |
好人卡 | 91 |
积分 | 2 |
经验 | 55775 |
最后登录 | 2017-7-18 |
在线时间 | 2070 小时 |
Lv1.梦旅人 Mr.Gandum
- 梦石
- 0
- 星屑
- 226
- 在线时间
- 2070 小时
- 注册时间
- 2007-1-31
- 帖子
- 3039
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 feizhaodan 于 2014-9-5 18:10 编辑
先向CAPCOM致敬。
再向生化危机系列致敬。
之后开始本贴。
VX用的一个很像生化危机0123维罗妮卡的道具箱。玩过的人都知道。
没玩过的人看这个。
就是这样的。
具体功能:
1,存东西(废话)
2,取东西(废话)
3,利用变量后期调整格子数量。
4,决定道具箱里刚开始就有的道具。
制作者:我。这个是处女作,不要喷的太厉害
最后上脚本:- #=begin
- #============================================================================
- # ☆ 生化危机式道具箱
- # 由feizhaodan制作。
- # 版本号: 1.0.1
- # 2012/8/8
- # 转载时请连同这里一起转
- #============================================================================
- module StockItem
- STOCK =[]
- # 在这里制作初始箱内道具
- # 格式:
- # STOCK[n] = [kind, id, number]
- # n 是在箱子里的第几个, 不使用0号
- # kind 是种类
- # id 是物品的ID
- # number 是数量
- STOCK[1] = [2, 1, 5] # 在箱子里的第一格放5个恢复剂
- STOCK[2] = [0, 2, 1]
- STOCK[3] = [1, 1, 1]
-
-
- # 箱子的大小。
- STOCKMAX = 40
-
-
- # 空格显示的字符
- NON_STOCK_WORD = " - EMPTY - "
-
- # 设置箱子大小变量。
- # 更改这个变量可以后期更改箱子大小。
- # 缩小时将会从后开始逐个删除内容。
- STOCK_VARY = 27
-
- module_function
-
- # 清空0数量格子
- def clear_stock
- for i in @stock
- if i[2] == 0
- i[1] = 0
- end
- end
- end
-
- # 初始化格子
- def initialize_stock
- for i in 0...@stock_max
- if @stock[i] == nil
- @stock.push([0, 0, 0])
- end
- end
- end
- end
- #==============================================================================
- # ■ Game_Party
- #------------------------------------------------------------------------------
- # 处理同伴的类。包含金钱以及物品的信息。本类的实例请参考 $game_party。
- #==============================================================================
- class Game_Party < Game_Unit
- alias stock_item_initialize initialize
- attr_reader :stocks
- def initialize
- stock_item_initialize
- create_stock_items
- end
- def create_stock_items
- @stocks = Array.new(StockItem::STOCKMAX+1)
- StockItem::STOCK.each_with_index do |ini,i|
- next if ini.nil?
- @stocks[i] = ini
- end
- end
- end
- #==============================================================================
- # □ Window_StockItem_Stock
- #-----------------------------------------------------------------------
- # ○ 箱子内容的窗口。
- #==============================================================================
- class Window_StockItem_Stock < Window_Selectable
- #----------------------------------------------------------------------------
- # ○ 初始化
- #----------------------------------------------------------------------------
- def initialize
- x = 0
- width = 544 / 2
- # 判定是否导入KGC帮助条强化
- if $imported != nil and $imported["HelpExtension"] == true
- rowmax = KGC::HelpExtension::ROW_MAX
- height = 416 - (WLH * rowmax + 32)
- y = WLH * rowmax + 32
- else
- height = 416 - (WLH + 32)
- y = WLH + 32
- end
- # 生成窗口
- super(x, y, width, height)
- # 获取箱子内容
- @no_stock_word = StockItem::NON_STOCK_WORD
- self.index = 0
- # 初始化箱子
- define_box
- # 刷新
- refresh
- end
- #----------------------------------------------------------------------------
- # ○ 刷新
- #----------------------------------------------------------------------------
- def refresh
- # 制成箱子道具表
- @item_data =[]
- for i in 1...@stockmax
- if @stock[i][1] != 0
- case @stock[i][0]
- when 0 # 武器
- @item_data.push($data_weapons[@stock[i][1]])
- when 1 # 防具
- @item_data.push($data_armors[@stock[i][1]])
- when 2 # 道具
- @item_data.push($data_items[@stock[i][1]])
- end
- elsif @stock[i][1] == 0 # 空格子
- @item_data.push("nil")
- end
- end
- @item_max = @item_data.size
- create_contents
- # 开始绘制道具
- for i in 0...@item_max
- draw_item(i)
- end
- end
- #----------------------------------------------------------------------------
- # ○ 绘制道具
- #----------------------------------------------------------------------------
- def draw_item(index)
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- item = @item_data[index]
- if item != nil and item != "nil"
- for i in 1...@item_max
- if item.is_a?(RPG::Weapon)
- if item.id == @stock[i][1] and @stock[i][0] == 0
- @number = @stock[i][2]
- end
- elsif item.is_a?(RPG::Armor)
- if item.id == @stock[i][1] and @stock[i][0] == 1
- @number = @stock[i][2]
- end
- elsif item.is_a?(RPG::Item)
- if item.id == @stock[i][1] and @stock[i][0] == 2
- @number = @stock[i][2]
- end
- end
- end
- enabled = true
- rect.width -= 4
- draw_item_name(item, rect.x, rect.y, enabled)
- self.contents.draw_text(rect, sprintf(":%2d", @number), 2)
- elsif item = "nil"
- number = ""
- enabled = true
- draw_empty_name(rect.x, rect.y)
- end
- end
- #----------------------------------------------------------------------------
- # ○ 绘制空道具
- #----------------------------------------------------------------------------
- def draw_empty_name(x, y)
- self.contents.font.color = normal_color
- self.contents.draw_text(x + 24, y, 172, WLH, @no_stock_word)
- end
- #----------------------------------------------------------------------------
- # ○ 初始化道具格子
- #----------------------------------------------------------------------------
- def initialize_stock
- @stock =[]
- @stock = $game_party.stocks
- for i in 1...@stockmax
- if @stock[i] == nil
- @stock.push([0, 0, 0])
- end
- end
- end
- def define_box
- var = StockItem::STOCK_VARY
- @stockmax = $game_party.stocks.size-1
- initialize_stock
- if $game_variables[var] == 0
- $game_variables[var] = StockItem::STOCKMAX
- return
- end
- last_stock = @stockmax
- @stockmax = $game_variables[var]
- refresh_stock(last_stock)
- end
- def refresh_stock(last_stock)
- if last_stock >= @stockmax
- for i in 1...@stockmax
- if $game_party.stocks[i] == nil
- $game_party.stocks[i] = [0, 0, 0]
- end
- end
- else
- loop do
- $game_party.stocks.delete_at -1
- if $game_party.stocks.size - 1 == @stockmax
- break
- end
- end
- end
- end
- end
- #==============================================================================
- # ■ Window_Item
- #------------------------------------------------------------------------------
- # 物品画面、战斗画面、显示浏览物品的窗口。
- #==============================================================================
- class Window_StockItem_Party < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # x : 窗口 X 座标
- # y : 窗口 Y 座标
- # width : 窗口宽度
- # height : 窗口高度
- #--------------------------------------------------------------------------
- def initialize
- x = 544 / 2
- width = 544 / 2
- if $imported != nil and $imported["HelpExtension"] == true
- rowmax = KGC::HelpExtension::ROW_MAX
- height = 416 - (WLH * rowmax + 32)
- y = WLH * rowmax + 32
- else
- height = 416 - (WLH + 32)
- y = WLH + 32
- end
- super(x, y, width, height)
- @column_max = 1
- self.index = 0
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 获取项目
- #--------------------------------------------------------------------------
- def item
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- # ● 判断是否为物品
- # item : 项目
- #--------------------------------------------------------------------------
- def include?(item)
- return false if item == nil
- if $game_temp.in_battle
- return false unless item.is_a?(RPG::Item)
- end
- return true
- end
- #--------------------------------------------------------------------------
- # ● 判断是否为有效状态
- # item : 项目
- #--------------------------------------------------------------------------
- def enable?(item)
- return $game_party.item_can_use?(item)
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- @data = []
- for item in $game_party.items
- next unless include?(item)
- @data.push(item)
- if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id
- self.index = @data.size - 1
- end
- end
- @data.push(nil) if include?(nil)
- @data.push("取出")
- @item_max = @data.size
- create_contents
- for i in 0...@item_max
- draw_item(i)
- end
- end
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- item = @data[index]
- if item != nil and item != "取出"
- number = $game_party.item_number(item)
- enabled = true
- rect.width -= 4
- draw_item_name(item, rect.x, rect.y, enabled)
- self.contents.draw_text(rect, sprintf(":%2d", number), 2)
- elsif item == "取出"
- draw_withdraw_name(rect.x, rect.y)
- end
- end
- #--------------------------------------------------------------------------
- # ● 更新帮助窗口文字
- #--------------------------------------------------------------------------
- def update_help
- if item != nil and item != "取出"
- @help_window.set_text(item.description)
- elsif item == "取出"
- @help_window.set_text("取出道具。")
- end
- end
- def draw_withdraw_name(x, y)
- self.contents.font.color = normal_color
- self.contents.draw_text(x + 24, y, 172, WLH, "取出")
- end
- end
- #==============================================================================
- # □ Window_StockNumber
- #------------------------------------------------------------------------------
- # 箱子画面里决定数量的窗口。
- #==============================================================================
- class Window_StockNumber < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # x : 窗口 X 座标
- # y : 窗口 Y 座标
- #--------------------------------------------------------------------------
- def initialize
- x = 544 / 2 / 2
- y = 416 / 2 + 416 / 2 / 2
- super(x, y, 544 / 2, WLH * 3)
- @item = nil
- [url=home.php?mod=space&uid=25307]@Max[/url] = 1
- @number = 1
- end
- #--------------------------------------------------------------------------
- # ● 设置商品、最大数量和价格
- #--------------------------------------------------------------------------
- def set(item, max, type)
- @item = item
- @max = max
- @number = 1
- @type = type
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 设置数量输入
- #--------------------------------------------------------------------------
- def number
- return @number
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- x = 96
- y = 16
- self.contents.clear
- draw_item_name(@item, 0, 0)
- self.contents.font.color = normal_color
- self.contents.draw_text(x + 32, 0, 20, WLH, "×")
- self.contents.draw_text(x + 68, 0, 20, WLH, @number, 2)
- self.cursor_rect.set(x + 64, 0, 28, WLH)
- case @type
- when 0
- self.contents.draw_text(x + 96, 0, WLH * 2, WLH, "存入")
- when 1
- self.contents.draw_text(x + 96, 0, WLH * 2, WLH, "取出")
- when 2
- self.contents.draw_text(x + 96, 0, WLH * 2, WLH, "存入")
- end
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def update
- super
- if self.active
- last_number = @number
- if Input.repeat?(Input::RIGHT) and @number < @max
- @number += 1
- end
- if Input.repeat?(Input::LEFT) and @number > 1
- @number -= 1
- end
- if Input.repeat?(Input::UP) and @number < @max
- @number = [@number + 10, @max].min
- end
- if Input.repeat?(Input::DOWN) and @number > 1
- @number = [@number - 10, 1].max
- end
- if @number != last_number
- Sound.play_cursor
- refresh
- end
- end
- end
- end
- #==============================================================================
- # □ Window_StockNumber
- #------------------------------------------------------------------------------
- # 箱子画面里交换时的窗口
- #==============================================================================
- class Window_StockTrade < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # x : 窗口 X 座标
- # y : 窗口 Y 座标
- #--------------------------------------------------------------------------
- def initialize
- x = 544 / 2 / 2
- y = 416 / 2 - 416 / 2 / 2
- super(x, y, 544 / 2, WLH * 3)
- @item = nil
- @number = 1
- end
- #--------------------------------------------------------------------------
- # ● 设置商品、最大数量和价格
- #--------------------------------------------------------------------------
- def set(item, number)
- @item = item
- @number = number
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 设置数量输入
- #--------------------------------------------------------------------------
- def number
- return @number
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- x = 96
- self.contents.clear
- draw_item_name(@item, 0, 0)
- self.contents.font.color = normal_color
- self.contents.draw_text(x + 32, 0, 20, WLH, "×")
- self.contents.draw_text(x + 68, 0, 20, WLH, @number, 2)
- self.cursor_rect.set(x + 64, 0, 28, WLH)
- self.contents.draw_text(x + 96, 0, WLH * 2, WLH, "取出")
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def update
- super
- refresh
- end
- end
- #============================================================================
- # ☆ 生化危机式道具箱
- # 由feizhaodan制作。
- # 版本号: 1.0.1
- # 2012/8/8
- # 转载时请连同这里一起转
- #============================================================================
- #============================================================================
- # □ Scene_StockItem
- #----------------------------------------------------------------------------
- # 处理道具箱子的场景。
- #============================================================================
- class Scene_StockItem < Scene_Base
- def start
- super
- create_menu_background
- define_box
- @stock_item_stock = Window_StockItem_Stock.new
- @stock_item_party = Window_StockItem_Party.new
- @help_window = Window_Help.new
- @stock_item_party.help_window = @help_window
- @stock_item_stock.help_window = @help_window
- @stock_number = Window_StockNumber.new
- @stock_number.visible = false
- @stock_number.active = false
- @stock_trade = Window_StockTrade.new
- @stock_trade.visible = false
- @stock_trade.active = false
- if $imported != nil and $imported["HelpExtension"] == true
- @help_window.row_max = KGC::HelpExtension::ROW_MAX
- end
- if $imported != nil and $imported["LimitBreak"] == true
- @imported_limit = true
- else
- @imported_limit = false
- end
- @stock_item_stock.active = true
- @stock_item_party.active = false
- end
-
- def terminate
- @stock_item_stock.dispose
- @stock_item_party.dispose
- @help_window.dispose
- @stock_number.dispose
- @stock_trade.dispose
- end
-
- def update
- @stock_item_stock.update
- @stock_item_party.update
- @help_window.update
- @stock_number.update
- @stock_trade.update
- if @stock_item_stock.active == true
- update_item_stock
- elsif @stock_item_party.active == true
- update_item_party
- elsif @stock_number.active == true
- update_number
- end
- end
-
- def update_item_stock
- if Input.trigger?(Input::B) # 取消键按下时
- Sound.play_cancel # 播放取消音效
- $scene = Scene_Map.new # 回到菜单画面
- end
- if Input.trigger?(Input::C) # 决定建按下时
- Sound.play_decision
- @stock_index = @stock_item_stock.index + 1 # 记录箱子格子号码
- if $game_party.stocks[@stock_index][1] == 0 # 当格子未使用
- [url=home.php?mod=space&uid=86665]@save[/url] = true # 开启存储伏笔
- @trade = false
- @withdraw = false
- else # 否则
- @trade = true # 开启交换伏笔
- @save = false
- @withdraw = false
- end
- @stock_item_stock.active = false
- @stock_item_party.active = true
- end
- end
-
- def update_item_party
- if Input.trigger?(Input::B) # 取消键按下时
- Sound.play_cancel # 播放取消音效
- @stock_item_stock.active = true
- @stock_item_party.active = false
- end
- if Input.trigger?(Input::C) # 决定建按下时
- @item = @stock_item_party.item # 获取道具信息
- @item_type = 0
- case @item
- when RPG::Item
- @item_type = 2
- when RPG::Weapon
- @item_type = 0
- when RPG::Armor
- @item_type = 1
- end
- if @save # 当存入时
- if @item == "取出" # 若道具是取出则返回错误
- Sound.play_buzzer
- return
- end
- Sound.play_decision
- carry_number = $game_party.item_number(@item) # 获取道具数量
- if @imported_limit == true # 若导入KGC界限突破
- max = carry_number
- @stock_number.set(@item, max, 0)
- @stock_item_party.active = false
- @stock_number.visible = true
- @stock_number.active = true
- else
- max = carry_number # 若没有导入则用99做最大值
- @stock_number.set(@item, max, 0)
- @stock_item_party.active = false
- @stock_number.visible = true
- @stock_number.active = true
- end
- else
- if $game_party.stocks[@stock_index][1] == @item.id and @item_type == $game_party.stocks[@stock_index][0]
- @save = false
- @trade = false # 关闭交换伏笔
- @withdraw = true # 开启取出伏笔
- carry_number = $game_party.item_number(@item)
- number = $game_party.stocks[@stock_index][2]
- if @imported_limit == true
- if carry_number == @item.number_limit
- Sound.play_buzzer
- return
- else
- Sound.play_decision
- max = number
- max = [max, @item.number_limit - carry_number].min
- @stock_number.set(@item, max, 1)
- @stock_item_party.active = false
- @stock_number.visible = true
- @stock_number.active = true
- end
- else
- if carry_number == 99
- Sound.play_buzzer
- return
- else
- Sound.play_decision
- max = number
- max = [max, 99 - carry_number].min
- @stock_number.set(@item, max, 1)
- @stock_item_party.active = false
- @stock_number.visible = true
- @stock_number.active = true
- end
- end
- elsif @item == "取出" # 当目标是取出时
- @save = false
- @trade = false # 关闭交换伏笔
- @withdraw = true # 开启取出伏笔
- case $game_party.stocks[@stock_index][0]
- when 0 # 武器
- @item = $data_weapons[$game_party.stocks[@stock_index][1]]
- when 1 # 防具
- @item = $data_armors[$game_party.stocks[@stock_index][1]]
- when 2 # 道具
- @item = $data_items[$game_party.stocks[@stock_index][1]]
- end
- carry_number = $game_party.item_number(@item)
- number = $game_party.stocks[@stock_index][2]
- if @imported_limit == true
- if carry_number == @item.number_limit
- Sound.play_buzzer
- return
- else
- Sound.play_decision
- max = number
- max = [max, @item.number_limit - carry_number].min
- @stock_number.set(@item, max, 1)
- @stock_item_party.active = false
- @stock_number.visible = true
- @stock_number.active = true
- end
- else
- if carry_number == 99
- Sound.play_buzzer
- return
- else
- Sound.play_decision
- max = number
- max = [max, 99 - carry_number].min
- @stock_number.set(@item, max, 1)
- @stock_item_party.active = false
- @stock_number.visible = true
- @stock_number.active = true
- end
- end
- elsif $game_party.stocks[@stock_index][1] != @item.id or $game_party.stocks[@stock_index][0] != @item.type
- @save = false
- @trade = true # 开启交换伏笔
- @withdraw = false # 关闭取出伏笔
- carry_number = $game_party.item_number(@item)
- number = $game_party.stocks[@stock_index][2]
- case $game_party.stocks[@stock_index][0]
- when 0 # 武器
- @trade_item = $data_weapons[$game_party.stocks[@stock_index][1]]
- when 1 # 防具
- @trade_item = $data_armors[$game_party.stocks[@stock_index][1]]
- when 2 # 道具
- @trade_item = $data_items[$game_party.stocks[@stock_index][1]]
- end
- if @imported_limit == true
- if number + $game_party.item_number(@item) >= @trade_item.number_limit
- Sound.play_buzzer
- return
- else
- Sound.play_decision
- max = carry_number
- @stock_number.set(@item, max ,2)
- @stock_trade.set(@trade_item, number)
- @stock_trade.refresh
- @stock_item_party.active = false
- @stock_number.visible = true
- @stock_number.active = true
- @stock_trade.visible = true
- end
- else
- if number + $game_party.item_number(@item) >= 99
- Sound.play_buzzer
- return
- else
- Sound.play_decision
- max = carry_number
- @stock_number.set(@item, max, 2)
- @stock_trade.set(@trade_item, number)
- @stock_trade.refresh
- @stock_item_party.active = false
- @stock_number.visible = true
- @stock_number.active = true
- @stock_trade.visible = true
- end
- end
- end
- end
- end
- end
-
- def update_number
- if Input.trigger?(Input::B) # 取消键按下时
- Sound.play_cancel # 播放取消音效
- @stock_item_party.active = true
- @stock_number.visible = false
- @stock_number.active = false
- @stock_trade.visible = false
- end
- if Input.trigger?(Input::C)
- [url=home.php?mod=space&uid=297884]@END[/url] = false
- Sound.play_decision
- if @save
- $game_party.lose_item(@item, @stock_number.number)
- for i in 1...@stockmax
- if $game_party.stocks[i][1] == @item.id and $game_party.stocks[i][0] == @item_type
- $game_party.stocks[i][2] += @stock_number.number
- @end = true
- break
- end
- end
- if @end == false
- $game_party.stocks[@stock_index][0] = @item_type
- $game_party.stocks[@stock_index][1] = @item.id
- $game_party.stocks[@stock_index][2] += @stock_number.number
- end
- elsif @trade
- $game_party.lose_item(@item, @stock_number.number)
- $game_party.gain_item(@trade_item, @stock_trade.number)
- for i in 1...@stockmax
- if $game_party.stocks[i][1] == @item.id and $game_party.stocks[i][0] == @item_type
- $game_party.stocks[i][2] += @stock_number.number
- $game_party.stocks[@stock_index][2] = 0
- @end = true
- break
- end
- end
- if @end == false
- $game_party.stocks[@stock_index][0] = @item_type
- $game_party.stocks[@stock_index][1] = @item.id
- $game_party.stocks[@stock_index][2] = @stock_number.number
- end
- elsif @withdraw
- $game_party.gain_item(@item, @stock_number.number)
- $game_party.stocks[@stock_index][2] -= @stock_number.number
- end
- clear_stock
- @stock_item_stock.active = true
- @stock_number.visible = false
- @stock_number.active = false
- @stock_trade.visible = false
- @end = false
- @stock_item_stock.refresh
- @stock_item_party.refresh
- end
- end
- # 清空0数量格子
- def clear_stock
- for i in 1...@stockmax
- if $game_party.stocks[i][2] == 0
- $game_party.stocks[i][1] = 0
- end
- end
- end
-
- def define_box
- var = StockItem::STOCK_VARY
- @stockmax = StockItem::STOCKMAX
- if $game_variables[var] == 0
- $game_variables[var] = StockItem::STOCKMAX
- return
- end
- @stockmax = $game_variables[var]
- refresh_stock
- end
- def refresh_stock
- for i in 1...@stockmax
- if $game_party.stocks[i] == nil
- $game_party.stocks[i] = [0, 0, 0]
- end
- end
- end
- end
- #============================================================================
- # ☆ 生化危机式道具箱
- # 由feizhaodan制作。
- # 版本号: 1.0.1
- # 2012/8/8
- # 转载时请连同这里一起转
- #============================================================================
- #=end
复制代码 使用方法:将以上内容拷贝后粘贴在main上头。之后在想要打开箱子的位置使用事件脚本的- $scene = Scene_StockItem.new
复制代码 冲突:未知,可能和一些更改的很厉害的道具系统冲突。
另:支持KGC大人作 界限突破(限制道具持有数功能)和 帮助栏扩张。因为我也用 |
评分
-
查看全部评分
|