设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 3084|回复: 6
打印 上一主题 下一主题

[已经解决] 有木有背包容量和物品仓库脚本?

[复制链接]

Lv4.逐梦者

【欧皇】

梦石
3
星屑
2046
在线时间
1004 小时
注册时间
2013-8-19
帖子
3486

开拓者

跳转到指定楼层
1
发表于 2014-5-10 15:34:27 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
我在做一个生存游戏,我想让游戏更真实些。

点评

什么容量?是背包物品的最大种类数?还是最大负重?  发表于 2014-5-10 20:32

评分

参与人数 1星屑 +50 收起 理由
天地有正气 + 50 广告机举报奖

查看全部评分

QQ:2223942063
Q群:365819625
贪吃方1.4

Lv4.逐梦者

【欧皇】

梦石
3
星屑
2046
在线时间
1004 小时
注册时间
2013-8-19
帖子
3486

开拓者

2
 楼主| 发表于 2014-5-10 21:10:40 | 只看该作者
@芯☆淡茹水 背包最大种类数(吧?)
QQ:2223942063
Q群:365819625
贪吃方1.4
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
33071
在线时间
5103 小时
注册时间
2012-11-19
帖子
4878

开拓者

3
发表于 2014-5-10 21:20:30 | 只看该作者
欧买歌 发表于 2014-5-10 21:10
@芯☆淡茹水 背包最大种类数(吧?)

吾试试。如果背包满,再增加物品的话,就对话框提示。
xp vx va mv  va mz 各类型脚本/插件定制
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
33071
在线时间
5103 小时
注册时间
2012-11-19
帖子
4878

开拓者

4
发表于 2014-5-10 22:25:43 | 只看该作者
这个:
背包物品限制.rar (189.62 KB, 下载次数: 172)

评分

参与人数 1星屑 +120 收起 理由
天地有正气 + 120 认可答案

查看全部评分

xp vx va mv  va mz 各类型脚本/插件定制
回复 支持 反对

使用道具 举报

Lv4.逐梦者

【欧皇】

梦石
3
星屑
2046
在线时间
1004 小时
注册时间
2013-8-19
帖子
3486

开拓者

5
 楼主| 发表于 2014-5-11 13:18:54 | 只看该作者
芯☆淡茹水 发表于 2014-5-10 22:25
这个:

可是,还有仓库脚本吗?
如果没有,那我就不用了。

点评

自己动一下手,不可能让我帮你搜吧。  发表于 2014-5-11 15:59
仓库脚本论坛搜索得到哈。  发表于 2014-5-11 15:48
QQ:2223942063
Q群:365819625
贪吃方1.4
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
266 小时
注册时间
2014-1-19
帖子
142
6
发表于 2014-5-12 21:29:51 | 只看该作者
这个仓库脚本可能对您有帮助:
  1. #==============================================================================
  2. # 本脚本来自www.66rpg.com,转载和使用请保留此信息
  3. #==============================================================================
  4. # 物品银行 V1.1完美版,制作+强化:IKKI,此脚本修改自真实商店脚本。
  5. # 调用:$scene = Scene_Shop_Vb.new(1)  
  6. #
  7. #==============================================================================
  8. # ■ Scene_Shop
  9. #------------------------------------------------------------------------------
  10. #  处理商店画面的类。
  11. #==============================================================================
  12. class Game_System
  13.   attr_accessor :goods   
  14.   alias vaule_shop_66RPG_initialize initialize
  15.   def initialize
  16.     vaule_shop_66RPG_initialize
  17.     @goods = []
  18.   ###########################################################################
  19.     # 初期的时候的商店物品,编号顺序:种类,ID,可卖数量
  20.     @goods[1] = [[-1,-1,-1]]  
  21.   ###########################################################################
  22.   end
  23.   def shop_change(shop,kind,id,delnumber)
  24.     dl = delnumber
  25.     for dt in $game_system.goods[shop]
  26.       if (dt[0]==kind) and (dt[1]==id)
  27.         dt[2] -= dl
  28.         dt[2] = [dt[2],99].min
  29.         if dt[2] == 0
  30.           $game_system.goods[shop].delete(dt)
  31.         end
  32.         return
  33.       end
  34.     end
  35.     $game_system.goods[shop].push([kind,id,-delnumber])
  36.   end
  37. end

  38. class Scene_Shop_Vb
  39.   def initialize(shop_number)
  40.     # 当前商店编号
  41.     @shop_now = shop_number     
  42.   end   
  43.   #--------------------------------------------------------------------------
  44.   # ● 主处理
  45.   #--------------------------------------------------------------------------
  46.   def main
  47.     # 生成帮助窗口
  48.     @help_window = Window_Help_Vb.new
  49.     # 生成指令窗口
  50.     @command_window = Window_ShopCommand_Vb.new
  51.     # 生成金钱窗口
  52.     @gold_window = Window_Gold_Vb.new
  53.     @gold_window.x = 480
  54.     @gold_window.y = 64
  55.     # 生成游戏时间窗口
  56.     @playtime_window = Window_PlayTime_Vb.new
  57.     @playtime_window.x = 380
  58.     @playtime_window.y = 0
  59.     # 生成时间窗口
  60.     @dummy_window = Window_Base.new(0, 128, 640, 352)
  61.     # 生成购买窗口
  62.     @buy_window = Window_ShopBuy_Vb.new($game_system.goods[@shop_now])
  63.     @buy_window.active = false
  64.     @buy_window.visible = false
  65.     @buy_window.help_window = @help_window
  66.     # 生成卖出窗口
  67.     @sell_window = Window_ShopSell_Vb.new
  68.     @sell_window.active = false
  69.     @sell_window.visible = false
  70.     @sell_window.help_window = @help_window
  71.     # 生成数量输入窗口
  72.     @number_window = Window_ShopNumber_Vb.new
  73.     @number_window.active = false
  74.     @number_window.visible = false
  75.     # 生成状态窗口
  76.     @status_window = Window_ShopStatus_Vb.new
  77.     @status_window.visible = true
  78.     # 执行过渡
  79.     Graphics.transition
  80.     # 主循环
  81.     loop do
  82.       # 刷新游戏画面
  83.       Graphics.update
  84.       # 刷新输入信息
  85.       Input.update
  86.       # 刷新画面
  87.       update
  88.       # 如果画面切换的话就中断循环
  89.       if $scene != self
  90.         break
  91.       end
  92.     end
  93.     # 准备过渡
  94.     Graphics.freeze
  95.     # 释放窗口
  96.     @help_window.dispose
  97.     @command_window.dispose
  98.     @playtime_window.dispose
  99.     @gold_window.dispose
  100.     @dummy_window.dispose
  101.     @buy_window.dispose
  102.     @sell_window.dispose
  103.     @number_window.dispose
  104.     @status_window.dispose
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   # ● 刷新画面
  108.   #--------------------------------------------------------------------------
  109.   def update
  110.     # 刷新窗口
  111.     @help_window.update
  112.     @command_window.update
  113.     @playtime_window.update
  114.     @gold_window.update
  115.     @dummy_window.update
  116.     @buy_window.update
  117.     @sell_window.update
  118.     @number_window.update
  119.     @status_window.update
  120.     # 指令窗口激活的情况下: 调用 update_command
  121.     if @command_window.active
  122.       update_command
  123.       return
  124.     end
  125.     # 购买窗口激活的情况下: 调用 update_buy
  126.     if @buy_window.active
  127.       update_buy
  128.       return
  129.     end
  130.     # 卖出窗口激活的情况下: 调用 update_sell
  131.     if @sell_window.active
  132.       update_sell
  133.       return
  134.     end
  135.     # 个数输入窗口激活的情况下: 调用 update_number
  136.     if @number_window.active
  137.       update_number
  138.       return
  139.     end
  140.   end
  141.   #--------------------------------------------------------------------------
  142.   # ● 刷新画面 (指令窗口激活的情况下)
  143.   #--------------------------------------------------------------------------
  144.   def update_command
  145.     # 按下 B 键的情况下
  146.     if Input.trigger?(Input::B)
  147.       # 演奏取消 SE
  148.       $game_system.se_play($data_system.cancel_se)
  149.       # 切换到地图画面
  150.       $scene = Scene_Map.new
  151.       return
  152.     end
  153.     # 按下 C 键的情况下
  154.     if Input.trigger?(Input::C)
  155.       # 命令窗口光标位置分支
  156.       case @command_window.index
  157.       when 1  # 购买
  158.         # 演奏确定 SE
  159.         $game_system.se_play($data_system.decision_se)
  160.         # 窗口状态转向购买模式
  161.         @command_window.active = false
  162.         @dummy_window.visible = false
  163.         @buy_window.active = true
  164.         @buy_window.visible = true
  165.         @buy_window.refresh
  166.         @status_window.visible = true
  167.       when 0  # 卖出
  168.         # 演奏确定 SE
  169.         $game_system.se_play($data_system.decision_se)
  170.         # 窗口状态转向卖出模式
  171.         @command_window.active = false
  172.         @dummy_window.visible = false
  173.         @sell_window.active = true
  174.         @sell_window.visible = true
  175.         @sell_window.refresh
  176.         @status_window.visible = true
  177.       when 2  # 取消
  178.         # 演奏确定 SE
  179.         $game_system.se_play($data_system.decision_se)
  180.         # 切换到地图画面
  181.         $scene = Scene_Map.new
  182.       end
  183.       return
  184.     end
  185.   end
  186.   #--------------------------------------------------------------------------
  187.   # ● 刷新画面 (购买窗口激活的情况下)
  188.   #--------------------------------------------------------------------------
  189.   def update_buy
  190.     # 设置状态窗口的物品
  191.     @status_window.item = @buy_window.item
  192.     # 按下 B 键的情况下
  193.     if Input.trigger?(Input::B)
  194.       # 演奏取消 SE
  195.       $game_system.se_play($data_system.cancel_se)
  196.       # 窗口状态转向初期模式
  197.       @command_window.active = true
  198.       @dummy_window.visible = true
  199.       @buy_window.active = false
  200.       @buy_window.visible = false
  201.       @status_window.visible = true
  202.       @status_window.item = nil
  203.       # 删除帮助文本
  204.       @help_window.set_text("")
  205.       return
  206.     end
  207.     # 按下 C 键的情况下
  208.     if Input.trigger?(Input::C)
  209.       # 获取物品
  210.       @item = @buy_window.item
  211.       # 物品无效的情况下、或者价格在所持金以上的情况下
  212.       if @item == nil# or @item.price > $game_party.gold
  213.         # 演奏冻结 SE
  214.         $game_system.se_play($data_system.buzzer_se)
  215.         return
  216.       end
  217.       # 获取物品所持数
  218.       case @item
  219.       when RPG::Item
  220.         number = $game_party.item_number(@item.id)
  221.       when RPG::Weapon
  222.         number = $game_party.weapon_number(@item.id)
  223.       when RPG::Armor
  224.         number = $game_party.armor_number(@item.id)
  225.       end
  226.       # 如果已经拥有了 99 个情况下
  227.       if number == 99
  228.         # 演奏冻结 SE
  229.         $game_system.se_play($data_system.buzzer_se)
  230.         return
  231.       end
  232.       # 演奏确定 SE
  233.       $game_system.se_play($data_system.decision_se)
  234.       # 计算可以最多购买的数量
  235.       max = @item.price == 0 ? 99 : $game_party.gold / @item.price
  236.       max = [[max, 99 - number].min,@buy_window.item_number].min
  237.       # 窗口状态转向数值输入模式
  238.       @buy_window.active = false
  239.       @buy_window.visible = false
  240.       @number_window.set(@item, max, @item.price)
  241.       @number_window.active = true
  242.       @number_window.visible = true
  243.     end
  244.   end
  245.   #--------------------------------------------------------------------------
  246.   # ● 画面更新 (卖出窗口激活的情况下)
  247.   #--------------------------------------------------------------------------
  248.   def update_sell
  249.     # 按下 B 键的情况下
  250.     if Input.trigger?(Input::B)
  251.       # 演奏取消 SE
  252.       $game_system.se_play($data_system.cancel_se)
  253.       # 窗口状态转向初期模式
  254.       @command_window.active = true
  255.       @dummy_window.visible = true
  256.       @sell_window.active = false
  257.       @sell_window.visible = false
  258.       @status_window.visible = true
  259.       @status_window.item = nil
  260.       # 删除帮助文本
  261.       @help_window.set_text("")
  262.       return
  263.     end
  264.     # 按下 C 键的情况下
  265.     if Input.trigger?(Input::C)
  266.       # 获取物品
  267.       @item = @sell_window.item
  268.       # 物品无效的情况下、或者价格为 0 (不能卖出) 的情况下
  269.       if @item == nil# or @item.price == 0
  270.         # 演奏冻结 SE
  271.         $game_system.se_play($data_system.buzzer_se)
  272.         return
  273.       end
  274.       
  275.       
  276.       # 如果金钱为 0 G情况下
  277.       if $game_party.gold == 0
  278.         # 演奏冻结 SE
  279.         $game_system.se_play($data_system.buzzer_se)
  280.         $game_temp.message_text = "老大,没有钱不要来存东西好不好?"
  281.         # 切换到地图画面
  282.         $scene = Scene_Map.new
  283.         return
  284.       end
  285.       
  286.       
  287.       # 演奏确定 SE
  288.       $game_system.se_play($data_system.decision_se)
  289.       # 获取物品的所持数
  290.       case @item
  291.       when RPG::Item
  292.         number = $game_party.item_number(@item.id)
  293.       when RPG::Weapon
  294.         number = $game_party.weapon_number(@item.id)
  295.       when RPG::Armor
  296.         number = $game_party.armor_number(@item.id)
  297.       end
  298.       # 最大卖出个数 = 物品的所持数
  299.       max = number
  300.       # 窗口状态转向个数输入模式
  301.       @sell_window.active = false
  302.       @sell_window.visible = false
  303.       @number_window.set(@item, max, @item.price / 2)
  304.       @number_window.active = true
  305.       @number_window.visible = true
  306.       @status_window.visible = true
  307.     end
  308.   end
  309.   #--------------------------------------------------------------------------
  310.   # ● 刷新画面 (个数输入窗口激活的情况下)
  311.   #--------------------------------------------------------------------------
  312.   def update_number
  313.     # 按下 B 键的情况下
  314.     if Input.trigger?(Input::B)
  315.       # 演奏取消 SE
  316.       $game_system.se_play($data_system.cancel_se)
  317.       # 设置个数输入窗口为不活动·非可视状态
  318.       @number_window.active = false
  319.       @number_window.visible = false
  320.       # 命令窗口光标位置分支
  321.       case @command_window.index
  322.       when 1  # 购买
  323.         # 窗口状态转向购买模式
  324.         @buy_window.active = true
  325.         @buy_window.visible = true
  326.       when 0  # 卖出
  327.         # 窗口状态转向卖出模式
  328.         @sell_window.active = true
  329.         @sell_window.visible = true
  330.       end
  331.       return
  332.     end
  333.     # 按下 C 键的情况下
  334.     if Input.trigger?(Input::C)
  335.       # 演奏商店 SE
  336.       $game_system.se_play($data_system.shop_se)
  337.       # 设置个数输入窗口为不活动·非可视状态
  338.       @number_window.active = false
  339.       @number_window.visible = false
  340.       # 命令窗口光标位置分支
  341.       case @command_window.index
  342.       when 1  # 购买
  343.         # 购买处理
  344.         temp = 0
  345.         case @item
  346.         when RPG::Item
  347.           $game_party.gain_item(@item.id, @number_window.number)
  348.         when RPG::Weapon
  349.           $game_party.gain_weapon(@item.id, @number_window.number)
  350.           temp = 1
  351.         when RPG::Armor
  352.           $game_party.gain_armor(@item.id, @number_window.number)
  353.           temp = 2
  354.         end
  355.         goods_del(temp,@item.id,@number_window.number)
  356.         # 刷新各窗口
  357.         @buy_window = Window_ShopBuy_Vb.new($game_system.goods[@shop_now])
  358.         @buy_window.help_window = @help_window
  359.         @gold_window.refresh
  360.         @buy_window.refresh
  361.         @status_window.refresh
  362.         # 窗口状态转向购买模式
  363.         @buy_window.active = true
  364.         @buy_window.visible = true
  365.       when 0  # 卖出
  366.         # 卖出处理
  367.         $game_party.lose_gold(@number_window.number)
  368.         temp = 0
  369.         case @item
  370.         when RPG::Item
  371.           $game_party.lose_item(@item.id, @number_window.number)
  372.         when RPG::Weapon
  373.           $game_party.lose_weapon(@item.id, @number_window.number)
  374.           temp = 1
  375.         when RPG::Armor
  376.           $game_party.lose_armor(@item.id, @number_window.number)
  377.           temp = 2
  378.         end
  379.         # 刷新各窗口
  380.         goods_del(temp,@item.id,-@number_window.number)
  381.         @buy_window = Window_ShopBuy_Vb.new($game_system.goods[@shop_now])
  382.         @buy_window.active = false
  383.         @buy_window.visible = false
  384.         @buy_window.help_window = @help_window
  385.         @gold_window.refresh
  386.         @sell_window.refresh
  387.         @status_window.refresh
  388.         # 窗口状态转向卖出模式
  389.         @sell_window.active = true
  390.         @sell_window.visible = true
  391.       end
  392.       return
  393.     end
  394.   end
  395.   # 删除可出售商品内容
  396.   def goods_del(kind,id,delnumber)
  397.     dl = delnumber
  398.     for dt in $game_system.goods[@shop_now]
  399.       if (dt[0]==kind) and (dt[1]==id)
  400.         dt[2] -= dl
  401.         dt[2] = [dt[2],99].min
  402.         if dt[2] == 0
  403.           $game_system.goods[@shop_now].delete(dt)
  404.         end
  405.         return
  406.       end
  407.     end
  408.     $game_system.goods[@shop_now].push([kind,id,-delnumber])
  409.   end
  410. end



  411. #==============================================================================
  412. # ■ Window_PlayTime_Vb
  413. #------------------------------------------------------------------------------
  414. #  菜单画面显示游戏时间的窗口。
  415. #==============================================================================

  416. class Window_PlayTime_Vb < Window_Base
  417.   #--------------------------------------------------------------------------
  418.   # ● 初始化对像
  419.   #--------------------------------------------------------------------------
  420.   def initialize
  421.     super(0, 0, 260, 64)
  422.     self.contents = Bitmap.new(width - 32, height - 32)
  423.     refresh
  424.   end
  425.   #--------------------------------------------------------------------------
  426.   # ● 刷新
  427.   #--------------------------------------------------------------------------
  428.   def refresh
  429.     self.contents.clear
  430.     self.contents.font.color = system_color
  431.     self.contents.draw_text(4, 0, 120, 32, "游戏时间")
  432.     @total_sec = Graphics.frame_count / Graphics.frame_rate
  433.     hour = @total_sec / 60 / 60
  434.     min = @total_sec / 60 % 60
  435.     sec = @total_sec % 60
  436.     text = sprintf("%02d:%02d:%02d", hour, min, sec)
  437.     self.contents.font.color = normal_color
  438.     self.contents.draw_text(124, 0, 120, 32, text, 0)
  439.   end
  440.   #--------------------------------------------------------------------------
  441.   # ● 刷新画面
  442.   #--------------------------------------------------------------------------
  443.   def update
  444.     super
  445.     if Graphics.frame_count / Graphics.frame_rate != @total_sec
  446.       refresh
  447.     end
  448.   end
  449. end



  450. #==============================================================================
  451. # ■ Window_Selectable_Vb
  452. #------------------------------------------------------------------------------
  453. #  拥有光标的移动以及滚动功能的窗口类。
  454. #==============================================================================

  455. class Window_Selectable_Vb < Window_Base
  456.   #--------------------------------------------------------------------------
  457.   # ● 定义实例变量
  458.   #--------------------------------------------------------------------------
  459.   attr_reader   :index                    # 光标位置
  460.   attr_reader   :help_window              # 帮助窗口
  461.   #--------------------------------------------------------------------------
  462.   # ● 初始画对像
  463.   #     x      : 窗口的 X 坐标
  464.   #     y      : 窗口的 Y 坐标
  465.   #     width  : 窗口的宽
  466.   #     height : 窗口的高
  467.   #--------------------------------------------------------------------------
  468.   def initialize(x, y, width, height)
  469.     super(x, y, width, height)
  470.     @item_max = 1
  471.     @column_max = 1
  472.     [url=home.php?mod=space&uid=370741]@Index[/url] = -1
  473.   end
  474.   #--------------------------------------------------------------------------
  475.   # ● 设置光标的位置
  476.   #     index : 新的光标位置
  477.   #--------------------------------------------------------------------------
  478.   def index=(index)
  479.     @index = index
  480.     # 刷新帮助文本 (update_help 定义了继承目标)
  481.     if self.active and @help_window != nil
  482.       update_help
  483.     end
  484.     # 刷新光标矩形
  485.     update_cursor_rect
  486.   end
  487.   #--------------------------------------------------------------------------
  488.   # ● 获取行数
  489.   #--------------------------------------------------------------------------
  490.   def row_max
  491.     # 由项目数和列数计算出行数
  492.     return (@item_max + @column_max - 1) / @column_max
  493.   end
  494.   #--------------------------------------------------------------------------
  495.   # ● 获取开头行
  496.   #--------------------------------------------------------------------------
  497.   def top_row
  498.     # 将窗口内容的传送源 Y 坐标、1 行的高 32 等分
  499.     return self.oy / 32
  500.   end
  501.   #--------------------------------------------------------------------------
  502.   # ● 设置开头行
  503.   #     row : 显示开头的行
  504.   #--------------------------------------------------------------------------
  505.   def top_row=(row)
  506.     # row 未满 0 的场合更正为 0
  507.     if row < 0
  508.       row = 0
  509.     end
  510.     # row 超过 row_max - 1 的情况下更正为 row_max - 1
  511.     if row > row_max - 1
  512.       row = row_max - 1
  513.     end
  514.     # row 1 行高的 32 倍、窗口内容的传送源 Y 坐标
  515.     self.oy = row * 32
  516.   end
  517.   #--------------------------------------------------------------------------
  518.   # ● 获取 1 页可以显示的行数
  519.   #--------------------------------------------------------------------------
  520.   def page_row_max
  521.     # 窗口的高度,设置画面的高度减去 32 ,除以 1 行的高度 32
  522.     return (self.height - 32) / 32
  523.   end
  524.   #--------------------------------------------------------------------------
  525.   # ● 获取 1 页可以显示的项目数
  526.   #--------------------------------------------------------------------------
  527.   def page_item_max
  528.     # 将行数 page_row_max 乘上列数 @column_max
  529.     return page_row_max * @column_max
  530.   end
  531.   #--------------------------------------------------------------------------
  532.   # ● 帮助窗口的设置
  533.   #     help_window : 新的帮助窗口
  534.   #--------------------------------------------------------------------------
  535.   def help_window=(help_window)
  536.     @help_window = help_window
  537.     # 刷新帮助文本 (update_help 定义了继承目标)
  538.     if self.active and @help_window != nil
  539.       update_help
  540.     end
  541.   end
  542.   #--------------------------------------------------------------------------
  543.   # ● 更新光标举行
  544.   #--------------------------------------------------------------------------
  545.   def update_cursor_rect
  546.     # 光标位置不满 0 的情况下
  547.     if @index < 0
  548.       self.cursor_rect.empty
  549.       return
  550.     end
  551.     # 获取当前的行
  552.     row = @index / @column_max
  553.     # 当前行被显示开头行前面的情况下
  554.     if row < self.top_row
  555.       # 从当前行向开头行滚动
  556.       self.top_row = row
  557.     end
  558.     # 当前行被显示末尾行之后的情况下
  559.     if row > self.top_row + (self.page_row_max - 1)
  560.       # 从当前行向末尾滚动
  561.       self.top_row = row - (self.page_row_max - 1)
  562.     end
  563.     # 计算光标的宽
  564.     cursor_width = self.width / @column_max - 32
  565.     # 计算光标坐标
  566.     x = @index % @column_max * (cursor_width + 32)
  567.     y = @index / @column_max * 32 - self.oy
  568.     # 更新国标矩形
  569.     self.cursor_rect.set(x, y, cursor_width, 32)
  570.   end
  571.   #--------------------------------------------------------------------------
  572.   # ● 刷新画面
  573.   #--------------------------------------------------------------------------
  574.   def update
  575.     super
  576.     # 可以移动光标的情况下
  577.     if self.active and @item_max > 0 and @index >= 0
  578.       # 方向键下被按下的情况下
  579.       if Input.repeat?(Input::DOWN)
  580.         # 列数不是 1 并且方向键的下的按下状态不是重复的情况、
  581.         # 或光标位置在(项目数-列数)之前的情况下
  582.         if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
  583.            @index < @item_max - @column_max
  584.           # 光标向下移动
  585.           $game_system.se_play($data_system.cursor_se)
  586.           @index = (@index + @column_max) % @item_max
  587.         end
  588.       end
  589.       # 方向键上被按下的情况下
  590.       if Input.repeat?(Input::UP)
  591.         # 列数不是 1 并且方向键的下的按下状态不是重复的情况、
  592.         # 或光标位置在列之后的情况下
  593.         if (@column_max == 1 and Input.trigger?(Input::UP)) or
  594.            @index >= @column_max
  595.           # 光标向上移动
  596.           $game_system.se_play($data_system.cursor_se)
  597.           @index = (@index - @column_max + @item_max) % @item_max
  598.         end
  599.       end
  600.    # 方向键右被按下的情况下
  601.      if Input.repeat?(Input::RIGHT)
  602.       
  603.      if @column_max >= 2 and  @index == @item_max - 1
  604.         $game_system.se_play($data_system.cursor_se)
  605.         @index = -1
  606.         end
  607.       
  608.        # 列数为 2 以上并且、光标位置在(项目数 - 1)之前的情况下
  609.        if @column_max >= 2 and @index < @item_max - 1
  610.          # 光标向右移动
  611.          $game_system.se_play($data_system.cursor_se)
  612.          @index += 1
  613.        end  
  614.      end
  615.      
  616.       # 方向键左被按下的情况下
  617.      if Input.repeat?(Input::LEFT)
  618.       
  619.      if  @column_max >= 2 and @index == 0
  620.          $game_system.se_play($data_system.cursor_se)
  621.          @index = @item_max
  622.          end
  623.       
  624.        # 列数为 2 以上并且、光标位置在 0 之后的情况下
  625.        if @column_max >= 2 and @index > 0
  626.          # 光标向左移动
  627.          $game_system.se_play($data_system.cursor_se)
  628.          @index -= 1
  629.        end
  630.      end
  631.      # R 键被按下的情况下
  632.       if Input.repeat?(Input::R)
  633.         # 显示的最后行在数据中最后行上方的情况下
  634.         if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
  635.           # 光标向后移动一页
  636.           $game_system.se_play($data_system.cursor_se)
  637.           @index = [@index + self.page_item_max, @item_max - 1].min
  638.           self.top_row += self.page_row_max
  639.         end
  640.       end
  641.       # L 键被按下的情况下
  642.       if Input.repeat?(Input::L)
  643.         # 显示的开头行在位置 0 之后的情况下
  644.         if self.top_row > 0
  645.           # 光标向前移动一页
  646.           $game_system.se_play($data_system.cursor_se)
  647.           @index = [@index - self.page_item_max, 0].max
  648.           self.top_row -= self.page_row_max
  649.         end
  650.       end
  651.     end
  652.     # 刷新帮助文本 (update_help 定义了继承目标)
  653.     if self.active and @help_window != nil
  654.       update_help
  655.     end
  656.     # 刷新光标矩形
  657.     update_cursor_rect
  658.   end
  659. end



  660. #==============================================================================
  661. # ■ Window_Help_Vb
  662. #------------------------------------------------------------------------------
  663. #  特技及物品的说明、角色的状态显示的窗口。
  664. #==============================================================================

  665. class Window_Help_Vb < Window_Base
  666.   #--------------------------------------------------------------------------
  667.   # ● 初始化对像
  668.   #--------------------------------------------------------------------------
  669.   def initialize
  670.     super(0, 0, 380, 64)
  671.     self.contents = Bitmap.new(width - 32, height - 32)
  672.   end
  673.   #--------------------------------------------------------------------------
  674.   # ● 设置文本
  675.   #     text  : 窗口显示的字符串
  676.   #     align : 对齐方式 (0..左对齐、1..中间对齐、2..右对齐)
  677.   #--------------------------------------------------------------------------
  678.   def set_text(text, align = 0)
  679.     # 如果文本和对齐方式的至少一方与上次的不同
  680.     if text != @text or align != @align
  681.       # 再描绘文本
  682.       self.contents.clear
  683.       self.contents.font.color = normal_color
  684.       self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
  685.       @text = text
  686.       @align = align
  687.       [url=home.php?mod=space&uid=95897]@actor[/url] = nil
  688.     end
  689.     self.visible = true
  690.   end
  691.   #--------------------------------------------------------------------------
  692.   # ● 设置角色
  693.   #     actor : 要显示状态的角色
  694.   #--------------------------------------------------------------------------
  695.   def set_actor(actor)
  696.     if actor != @actor
  697.       self.contents.clear
  698.       draw_actor_name(actor, 4, 0)
  699.       draw_actor_state(actor, 140, 0)
  700.       draw_actor_hp(actor, 284, 0)
  701.       draw_actor_sp(actor, 460, 0)
  702.       @actor = actor
  703.       @text = nil
  704.       self.visible = true
  705.     end
  706.   end
  707.   #--------------------------------------------------------------------------
  708.   # ● 设置敌人
  709.   #     enemy : 要显示名字和状态的敌人
  710.   #--------------------------------------------------------------------------
  711.   def set_enemy(enemy)
  712.     text = enemy.name
  713.     state_text = make_battler_state_text(enemy, 112, false)
  714.     if state_text != ""
  715.       text += "  " + state_text
  716.     end
  717.     set_text(text, 1)
  718.   end
  719. end




  720. #==============================================================================
  721. # ■ Window_Gold_Vb
  722. #------------------------------------------------------------------------------
  723. #  显示金钱的窗口。
  724. #==============================================================================

  725. class Window_Gold_Vb < Window_Base
  726.   #--------------------------------------------------------------------------
  727.   # ● 初始化窗口
  728.   #--------------------------------------------------------------------------
  729.   def initialize
  730.     super(0, 0, 160, 64)
  731.     self.contents = Bitmap.new(width - 32, height - 32)
  732.     refresh
  733.   end
  734.   #--------------------------------------------------------------------------
  735.   # ● 刷新
  736.   #--------------------------------------------------------------------------
  737.   def refresh
  738.     self.contents.clear
  739.     cx = contents.text_size($data_system.words.gold).width
  740.     self.contents.font.size = 17
  741.     self.contents.font.color = system_color
  742.     self.contents.draw_text(4, 0, 120, 17, "钱包",1)
  743.     self.contents.font.color = normal_color
  744.     self.contents.draw_text(4, 17, 120-cx-2, 17, $game_party.gold.to_s, 2)
  745.     self.contents.font.color = system_color
  746.     self.contents.draw_text(124-cx, 17, cx, 17, $data_system.words.gold, 2)
  747.   end
  748. end




  749. #==============================================================================
  750. # ■ Window_ShopBuy_Vb
  751. #------------------------------------------------------------------------------
  752. #  商店画面、浏览显示可以购买的商品的窗口。
  753. #==============================================================================

  754. class Window_ShopBuy_Vb < Window_Selectable_Vb
  755.   attr_accessor :shop_goods
  756.   #--------------------------------------------------------------------------
  757.   # ● 初始化对像
  758.   #     shop_goods : 商品
  759.   #--------------------------------------------------------------------------
  760.   def initialize(shop_goods)
  761.     super(0, 128, 368, 352)
  762.     @shop_goods = shop_goods
  763.     refresh
  764.     self.index = 0
  765.   end
  766.   #--------------------------------------------------------------------------
  767.   # ● 获取物品
  768.   #--------------------------------------------------------------------------
  769.   def item
  770.     return @data[self.index]
  771.   end
  772.   #--------------------------------------------------------------------------
  773.   # ● 获取物品
  774.   #--------------------------------------------------------------------------
  775.   def item_number
  776.     return @data_number[self.index]
  777.   end
  778.   #--------------------------------------------------------------------------
  779.   # ● 刷新
  780.   #--------------------------------------------------------------------------
  781.   def refresh
  782.     if self.contents != nil
  783.       self.contents.dispose
  784.       self.contents = nil
  785.     end
  786.     @data = []
  787.     @data_number = []
  788.     for goods_item in @shop_goods
  789.       case goods_item[0]
  790.       when 0
  791.         item = $data_items[goods_item[1]]
  792.       when 1
  793.         item = $data_weapons[goods_item[1]]
  794.       when 2
  795.         item = $data_armors[goods_item[1]]
  796.       end
  797.       if (item != nil) and (goods_item[2] != 0)
  798.         @data.push(item)
  799.         @data_number.push(goods_item[2])
  800.       else
  801.         @data.delete(item)
  802.       end
  803.     end
  804.     # 如果项目数不是 0 就生成位图、描绘全部项目
  805.     @item_max = @data.size
  806.     if @item_max > 0
  807.       self.contents = Bitmap.new(width - 32, row_max * 32)
  808.       for i in 0...@item_max
  809.         draw_item(i)
  810.       end
  811.     end
  812.   end
  813.   #--------------------------------------------------------------------------
  814.   # ● 描绘羡慕
  815.   #     index : 项目编号
  816.   #--------------------------------------------------------------------------
  817.   def draw_item(index)
  818.     item = @data[index]
  819.     # 获取物品所持数
  820.     case item
  821.     when RPG::Item
  822.       number = $game_party.item_number(item.id)
  823.     when RPG::Weapon
  824.       number = $game_party.weapon_number(item.id)
  825.     when RPG::Armor
  826.       number = $game_party.armor_number(item.id)
  827.     end
  828.     x = 4
  829.     y = index * 32
  830.     rect = Rect.new(x, y, self.width - 32, 32)
  831.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  832.     bitmap = RPG::Cache.icon(item.icon_name)
  833.     opacity = self.contents.font.color == normal_color ? 255 : 128
  834.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  835.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  836.     self.contents.draw_text(x + 240, y, 88, 32, "存有  ", 2)
  837.     self.contents.draw_text(x + 240, y, 88, 32, @data_number[index].to_s, 2)
  838.   end
  839.   #--------------------------------------------------------------------------
  840.   # ● 刷新帮助文本
  841.   #--------------------------------------------------------------------------
  842.   def update_help
  843.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  844.   end
  845. end




  846. #==============================================================================
  847. # ■ Window_ShopCommand_Vb
  848. #------------------------------------------------------------------------------
  849. #  商店画面、选择要做的事的窗口
  850. #==============================================================================

  851. class Window_ShopCommand_Vb < Window_Selectable_Vb
  852.   #--------------------------------------------------------------------------
  853.   # ● 初始化对像
  854.   #--------------------------------------------------------------------------
  855.   def initialize
  856.     super(0, 64, 480, 64)
  857.     self.contents = Bitmap.new(width - 32, height - 32)
  858.     @item_max = 3
  859.     @column_max = 3
  860.     @commands = ["存入物品", "取出物品", "离开银行"]
  861.     refresh
  862.     self.index = 0
  863.   end
  864.   #--------------------------------------------------------------------------
  865.   # ● 刷新
  866.   #--------------------------------------------------------------------------
  867.   def refresh
  868.     self.contents.clear
  869.     for i in 0...@item_max
  870.       draw_item(i)
  871.     end
  872.   end
  873.   #--------------------------------------------------------------------------
  874.   # ● 描绘项目
  875.   #     index : 项目编号
  876.   #--------------------------------------------------------------------------
  877.   def draw_item(index)
  878.     x = 4 + index * 160
  879.     self.contents.draw_text(x, 0, 128, 32, @commands[index])
  880.   end
  881. end




  882. #==============================================================================
  883. # ■ Window_ShopSell_Vb
  884. #------------------------------------------------------------------------------
  885. #  商店画面、浏览显示可以卖掉的商品的窗口。
  886. #==============================================================================

  887. class Window_ShopSell_Vb < Window_Selectable_Vb
  888.   #--------------------------------------------------------------------------
  889.   # ● 初始化对像
  890.   #     shop_goods : 商品
  891.   #--------------------------------------------------------------------------
  892.   def initialize
  893.     super(0, 128, 368, 352)
  894.     refresh
  895.     self.index = 0
  896.   end
  897.   #--------------------------------------------------------------------------
  898.   # ● 获取物品
  899.   #--------------------------------------------------------------------------
  900.   def item
  901.     return @data[self.index]
  902.   end
  903.   #--------------------------------------------------------------------------
  904.   # ● 获取物品
  905.   #--------------------------------------------------------------------------
  906.   def item_number
  907.     return @data_number[self.index]
  908.   end
  909.   #--------------------------------------------------------------------------
  910.   # ● 刷新
  911.   #--------------------------------------------------------------------------
  912.   def refresh
  913.     if self.contents != nil
  914.       self.contents.dispose
  915.       self.contents = nil
  916.     end
  917.     @data = []
  918.     for i in 1...$data_items.size
  919.       if $game_party.item_number(i) > 0
  920.         @data.push($data_items[i])
  921.       end
  922.     end
  923.     for i in 1...$data_weapons.size
  924.       if $game_party.weapon_number(i) > 0
  925.         @data.push($data_weapons[i])
  926.       end
  927.     end
  928.     for i in 1...$data_armors.size
  929.       if $game_party.armor_number(i) > 0
  930.         @data.push($data_armors[i])
  931.       end
  932.     end
  933.     # 如果项目数不是 0 就生成位图、描绘全部项目
  934.     @item_max = @data.size
  935.     if @item_max > 0
  936.       self.contents = Bitmap.new(width - 32, row_max * 32)
  937.       for i in 0...@item_max
  938.         draw_item(i)
  939.       end
  940.     end
  941.   end
  942.   #--------------------------------------------------------------------------
  943.   # ● 描绘羡慕
  944.   #     index : 项目编号
  945.   #--------------------------------------------------------------------------
  946.   def draw_item(index)
  947.     item = @data[index]
  948.     # 获取物品所持数
  949.     case item
  950.     when RPG::Item
  951.       number = $game_party.item_number(item.id)
  952.     when RPG::Weapon
  953.       number = $game_party.weapon_number(item.id)
  954.     when RPG::Armor
  955.       number = $game_party.armor_number(item.id)
  956.     end
  957.     x = 4
  958.     y = index * 32
  959.     rect = Rect.new(x, y, self.width - 32, 32)
  960.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  961.     bitmap = RPG::Cache.icon(item.icon_name)
  962.     opacity = self.contents.font.color == normal_color ? 255 : 128
  963.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  964.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  965.     self.contents.draw_text(x + 240, y, 88, 32, "带有  ", 2)
  966.     self.contents.draw_text(x + 240, y, 88, 32, number.to_s, 2)
  967.   end
  968.   #--------------------------------------------------------------------------
  969.   # ● 刷新帮助文本
  970.   #--------------------------------------------------------------------------
  971.   def update_help
  972.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  973.   end
  974. end



  975. #==============================================================================
  976. # ■ Window_ShopNumber_Vb
  977. #------------------------------------------------------------------------------
  978. #  商店画面、输入买卖数量的窗口。
  979. #==============================================================================

  980. class Window_ShopNumber_Vb < Window_Base
  981.   #--------------------------------------------------------------------------
  982.   # ● 初始化对像
  983.   #--------------------------------------------------------------------------
  984.   def initialize
  985.     super(0, 128, 368, 352)
  986.     self.contents = Bitmap.new(width - 32, height - 32)
  987.     @item = nil
  988.     [url=home.php?mod=space&uid=25307]@Max[/url] = 1
  989.     @price = 0
  990.     [url=home.php?mod=space&uid=27178]@Number[/url] = 1
  991.   end
  992.   #--------------------------------------------------------------------------
  993.   # ● 设置物品、最大个数、价格
  994.   #--------------------------------------------------------------------------
  995.   def set(item, max, price)
  996.     @item = item
  997.     @max = max
  998.     @price = price
  999.     @number = 1
  1000.     refresh
  1001.   end
  1002.   #--------------------------------------------------------------------------
  1003.   # ● 被输入的件数设置
  1004.   #--------------------------------------------------------------------------
  1005.   def number
  1006.     return @number
  1007.   end
  1008.   #--------------------------------------------------------------------------
  1009.   # ● 刷新
  1010.   #--------------------------------------------------------------------------
  1011.   def refresh
  1012.     self.contents.clear
  1013.     draw_item_name(@item, 4, 96)
  1014.     self.contents.font.color = normal_color
  1015.     self.contents.draw_text(272, 96, 32, 32, "×")
  1016.     self.contents.draw_text(308, 96, 24, 32, @number.to_s, 2)
  1017.     self.cursor_rect.set(304, 96, 32, 32)
  1018.   end
  1019.   #--------------------------------------------------------------------------
  1020.   # ● 刷新画面
  1021.   #--------------------------------------------------------------------------
  1022.   def update
  1023.     super
  1024.     if self.active
  1025.       # 光标右 (+1)
  1026.       if Input.repeat?(Input::RIGHT) and @number < @max
  1027.         $game_system.se_play($data_system.cursor_se)
  1028.         @number += 1
  1029.         refresh
  1030.       end
  1031.       # 光标左 (-1)
  1032.       if Input.repeat?(Input::LEFT) and @number > 1
  1033.         $game_system.se_play($data_system.cursor_se)
  1034.         @number -= 1
  1035.         refresh
  1036.       end
  1037.       # 光标上 (+10)
  1038.       if Input.repeat?(Input::UP) and @number < @max
  1039.         $game_system.se_play($data_system.cursor_se)
  1040.         @number = [@number + 10, @max].min
  1041.         refresh
  1042.       end
  1043.       # 光标下 (-10)
  1044.       if Input.repeat?(Input::DOWN) and @number > 1
  1045.         $game_system.se_play($data_system.cursor_se)
  1046.         @number = [@number - 10, 1].max
  1047.         refresh
  1048.       end
  1049.     end
  1050.   end
  1051. end




  1052. #==============================================================================
  1053. # ■ Window_ShopStatus_Vb
  1054. #------------------------------------------------------------------------------
  1055. #  商店画面、显示物品所持数与角色装备的窗口。
  1056. #==============================================================================

  1057. class Window_ShopStatus_Vb < Window_Base
  1058.   #--------------------------------------------------------------------------
  1059.   # ● 初始化对像
  1060.   #--------------------------------------------------------------------------
  1061.   def initialize
  1062.     super(368, 128, 272, 352)
  1063.     self.contents = Bitmap.new(width - 32, height - 32)
  1064.     @item = nil
  1065.     refresh
  1066.   end
  1067.   #--------------------------------------------------------------------------
  1068.   # ● 刷新
  1069.   #--------------------------------------------------------------------------
  1070.   def refresh
  1071.     self.contents.clear
  1072.     self.contents.font.color = system_color
  1073.     self.contents.draw_text(0, 0, 202, 32, "每存入一件物品都要收取1元的保管费!")
  1074.     self.contents.draw_text(0, 34, 202, 32, "不过,您来取物品的话,我们不收钱!")
  1075.   end
  1076.   #--------------------------------------------------------------------------
  1077.   # ● 设置物品
  1078.   #     item : 新的物品
  1079.   #--------------------------------------------------------------------------
  1080.   def item=(item)
  1081.     if @item != item
  1082.       @item = item
  1083.       refresh
  1084.     end
  1085.   end
  1086. end
复制代码

评分

参与人数 2星屑 +67 收起 理由
天地有正气 + 60 认可答案
欧买歌 + 7 谢谢,但是我那个游戏已经损坏了,.

查看全部评分

回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
33071
在线时间
5103 小时
注册时间
2012-11-19
帖子
4878

开拓者

7
发表于 2014-5-19 11:36:51 | 只看该作者
谢谢,但是我那个游戏已经损坏了,.

搞了半天,俺们白忙活了。
xp vx va mv  va mz 各类型脚本/插件定制
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-22 01:50

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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