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

Project1

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

人口贩卖系统的BUG,雇佣兵全部买完就出错!?

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
35 小时
注册时间
2008-6-23
帖子
275
跳转到指定楼层
1
发表于 2008-6-30 23:34:08 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
雇佣兵如果全买光了就出错了,怎么办。。。






人口贩卖(雇佣兵系统)
http://rpg.blue/web/htm/news763.htm
此贴于 2008-7-16 12:31:27 被版主darkten提醒,请楼主看到后对本贴做出回应。
此贴于 2008-7-20 21:09:03 被版主darkten提醒,请楼主看到后对本贴做出回应。
HзO

Lv5.捕梦者

梦石
0
星屑
39973
在线时间
5810 小时
注册时间
2006-11-10
帖子
6683
2
发表于 2008-6-30 23:39:29 | 只看该作者
没用过该脚本,game_actors,猜那脚本是将队伍分为两队,然后进行替换吧。那队员当然不能为0,

试试更改原脚本,“>”改为“>=”试试
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
35 小时
注册时间
2008-6-23
帖子
275
3
 楼主| 发表于 2008-6-30 23:49:58 | 只看该作者
冲突的地方是Game_Actors的 if actor_id > 999 or $data_actors[actor_id] == nil 这一句啊,“>=”改在哪里呢?
HзO
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
35 小时
注册时间
2008-6-23
帖子
275
4
 楼主| 发表于 2008-7-1 20:08:11 | 只看该作者
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
35 小时
注册时间
2008-6-23
帖子
275
5
 楼主| 发表于 2008-7-2 18:44:18 | 只看该作者
一天一顶
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
35 小时
注册时间
2008-6-23
帖子
275
6
 楼主| 发表于 2008-7-3 21:06:42 | 只看该作者
我希望:如果雇佣兵全买完了,就显示空白的窗口,行不行?
HзO
回复 支持 反对

使用道具 举报

Lv2.观梦者

傻♂逼

梦石
0
星屑
374
在线时间
1606 小时
注册时间
2007-3-13
帖子
6562

烫烫烫开拓者

7
发表于 2008-7-3 21:59:33 | 只看该作者
if actor_id.to_i > 999 or $data_actors[actor_id.to_i] == nil
哎呀,蛋疼什么的最有爱了
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
35 小时
注册时间
2008-6-23
帖子
275
8
 楼主| 发表于 2008-7-3 22:15:06 | 只看该作者
以下引用yangff于2008-7-3 13:59:33的发言:

if actor_id.to_i > 999 or $data_actors[actor_id.to_i] == nil





替换原来 Game_Actors 下面的那句吗?但是买完雇佣兵后还是出错了{/gg}

HзO
回复 支持 反对

使用道具 举报

Lv2.观梦者

傻♂逼

梦石
0
星屑
374
在线时间
1606 小时
注册时间
2007-3-13
帖子
6562

烫烫烫开拓者

9
发表于 2008-7-5 04:15:36 | 只看该作者
  1. module Mercenaries
  2.   class Window_Help < ::Window_Base
  3.     def initialize
  4.       super(0, 0, 196, 256)
  5.       self.contents = Bitmap.new(width - 32, height - 32)
  6.       self.contents.font.size = 18
  7.       @actor = nil
  8.       self.z += 10
  9.     end
  10.     def draw_actor(actor)
  11.       if @actor != actor
  12.         self.contents.clear
  13.         bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
  14.         bx = (self.width / 2) - bitmap.width / 2
  15.         by = (self.height / 2) - bitmap.height / 2
  16.         self.contents.blt(bx, by, bitmap, bitmap.rect, 196)
  17.         self.contents.draw_text(4, 4 + 0, 196, 18, "价格:" + actor.price.to_s)
  18.         self.contents.draw_text(4, 4 + 20, 196, 18, "姓名:" + actor.name)
  19.         self.contents.draw_text(4, 4 + 40, 196, 18, "职业:" + actor.class_name)
  20.         self.contents.draw_text(4, 4 + 60, 196, 18, "武器:#{$data_weapons[actor.weapon_id].name}")
  21.         self.contents.draw_text(4, 4 + 80, 196, 18, "铠甲:#{$data_armors[actor.armor3_id].name}")
  22.         self.contents.draw_text(4, 4 + 100, 196, 18, "攻击力:#{actor.atk}")
  23.         self.contents.draw_text(4, 4 + 120, 196, 18, "防御力:#{actor.pdef}")
  24.         self.contents.draw_text(4, 4 + 140, 196, 18, "魔御力:#{actor.mdef}")
  25.         self.contents.draw_text(4, 4 + 160, 196, 18, "力量:#{actor.str}")
  26.         self.contents.draw_text(4, 4 + 180, 196, 18, "灵巧:#{actor.dex}")
  27.         self.contents.draw_text(4, 4 + 200, 196, 18, "速度:#{actor.agi}")
  28.         self.contents.draw_text(4, 4 + 220, 196, 18, "魔力:#{actor.int}")
  29.         @actor = actor
  30.       end
  31.     end
  32.   end
  33.   class Window_ShopCommand < Window_Selectable
  34.     #--------------------------------------------------------------------------
  35.     # ● 初始化对像
  36.     #--------------------------------------------------------------------------
  37.     def initialize
  38.       super(80, 90 - 64, 480, 64)
  39.       self.contents = Bitmap.new(width - 32, height - 32)
  40.       @item_max = 3
  41.       @column_max = 3
  42.       @commands = ["雇佣", "解除", "取消"]
  43.       refresh
  44.       self.index = 0
  45.     end
  46.     #--------------------------------------------------------------------------
  47.     # ● 刷新
  48.     #--------------------------------------------------------------------------
  49.     def refresh
  50.       self.contents.clear
  51.       for i in 0...@item_max
  52.         draw_item(i)
  53.       end
  54.     end
  55.     #--------------------------------------------------------------------------
  56.     # ● 描绘项目
  57.     #     index : 项目编号
  58.     #--------------------------------------------------------------------------
  59.     def draw_item(index)
  60.       x = 4 + index * 160
  61.       self.contents.draw_text(x, 0, 128, 32, @commands[index])
  62.     end
  63.   end
  64.   class Window_Mercenaries < ::Window_Selectable
  65.     attr_reader   :column_max
  66.     attr_reader   :item_max
  67.     attr_reader   :mercenaries
  68.     def initialize(mercenaries)
  69.       super(80, 90, 480, 320)
  70.       @mercenaries = mercenaries
  71.       @column_max = 7
  72.       refresh
  73.       self.index = 0
  74.     end
  75.     def set_mercenaries(mercenaries)
  76.       @mercenaries = mercenaries
  77.       refresh
  78.     end
  79.     def id
  80.       return if @mercenaries.to_s == ""
  81.       return @mercenaries[self.index]
  82.     end
  83.     def refresh
  84.       if self.contents != nil
  85.         self.contents.dispose
  86.         self.contents = nil
  87.       end
  88.       @item_max = @mercenaries.size
  89.       if @item_max > 0
  90.         self.contents = Bitmap.new(width - 32, row_max * 80)
  91.         for i in 0...@item_max
  92.           draw_actor(i)
  93.         end
  94.       end
  95.     end
  96.     def draw_actor(index)
  97.       return if @mercenaries.to_s == ""
  98.       x = 4 + (index % @column_max * 64)
  99.       y = 4 + (index / @column_max * 80)
  100.       actor = $game_actors[@mercenaries[index]]
  101.       bitmap = RPG::Cache.character(actor.character_name,actor.character_hue)
  102.       rect = bitmap.rect
  103.       rect.width /= 4
  104.       rect.height /= 4
  105.       self.contents.blt(x, y, bitmap, rect)
  106.       self.contents.font.size = 12
  107.       self.contents.draw_text(x, y + 64 - 8, 64, 16, actor.name)
  108.       self.contents.font.size = 9
  109.       self.contents.draw_text(x + 4, y + 64 - 16, 64, 9, "Lv."+sprintf("%02d", actor.level))
  110.     end
  111.     #--------------------------------------------------------------------------
  112.     # ● 更新光标举行
  113.     #--------------------------------------------------------------------------
  114.     def update_cursor_rect
  115.       # 光标位置不满 0 的情况下
  116.       if @index < 0
  117.         self.cursor_rect.empty
  118.         return
  119.       end
  120.       # 获取当前的行
  121.       row = @index / @column_max
  122.       # 当前行被显示开头行前面的情况下
  123.       if row < self.top_row
  124.         # 从当前行向开头行滚动
  125.         self.top_row = row
  126.       end
  127.       # 当前行被显示末尾行之后的情况下
  128.       if row > self.top_row + (self.page_row_max - 1)
  129.         # 从当前行向末尾滚动
  130.         self.top_row = row - (self.page_row_max - 1)
  131.       end
  132.       # 计算光标的宽
  133.       cursor_width = self.width / @column_max - 32
  134.       # 计算光标坐标
  135.       x = @index % @column_max * 64
  136.       y = @index / @column_max * 80 - self.oy
  137.       # 更新国标矩形
  138.       self.cursor_rect.set(x, y, 64, 80)
  139.     end
  140.   end
  141.   class Scene_Mercenaries
  142.     def initialize(mercenaries)
  143.       @mercenaries = mercenaries
  144.       for actor in $game_party.actors
  145.         if @mercenaries.include?(actor.id)
  146.           @mercenaries.delete(actor.id)
  147.         end
  148.       end
  149.       @windows = []
  150.       @temp = @mercenaries.dup
  151.       @type = -1
  152.     end
  153.     def main_start

  154.         make_window
  155.       
  156.       @spriteset = Spriteset_Map.new
  157.     end
  158.     def main_loop
  159.       while $scene == self
  160.         rm_update
  161.         input_update
  162.         update_window
  163.       end
  164.     end
  165.     def main_end
  166.       dispose_window
  167.       @spriteset.dispose
  168.     end
  169.     def main
  170.       main_start
  171.       Graphics.transition
  172.       main_loop
  173.       Graphics.freeze
  174.       main_end
  175.     end
  176.     def make_window
  177.       @window_shopcommand = Window_ShopCommand.new
  178.       @window_help = Window_Help.new
  179.       @window_mercenaries = Window_Mercenaries.new(@mercenaries)
  180.       @window_mercenaries.active = false
  181.       @window_mercenaries.index = -1
  182.       wx = (@window_mercenaries.index % @window_mercenaries.column_max * 64)
  183.       wy = (@window_mercenaries.index / @window_mercenaries.column_max * 80)
  184.       @window_help.x = wx + @window_mercenaries.x + 64
  185.       @window_help.y = wy + @window_mercenaries.y + 80
  186.       @window_gold = Window_Gold.new
  187.       @window_gold.x = 640 - @window_gold.width - 32
  188.       @window_gold.y = 480 - @window_gold.height - 32
  189.       @windows << @window_gold << @window_shopcommand << @window_mercenaries << @window_help
  190.       @window_help.visible = false
  191.     end
  192.     def update_window
  193.       @windows.each{ |window|window.update }
  194.       help_update
  195.     end
  196.     def dispose_window
  197.       @windows.each{ |window|window.dispose }
  198.     end
  199.     def help_update
  200.       if @window_mercenaries.active
  201.         @window_help.visible = true
  202.         wx = (@window_mercenaries.index % @window_mercenaries.column_max * 64)
  203.         wy = (@window_mercenaries.index / @window_mercenaries.column_max * 80)
  204.         @window_help.x = wx + @window_mercenaries.x + 64
  205.         @window_help.y = wy + @window_mercenaries.y + 80
  206.         if @window_help.x + @window_help.width > 640
  207.           @window_help.x = 640 - @window_help.width
  208.         end
  209.         if @window_help.y + @window_help.height > 480
  210.           @window_help.y = 480 - @window_help.height
  211.         end
  212.         @window_help.draw_actor($game_actors[@window_mercenaries.id])
  213.       else
  214.         @window_help.visible = false
  215.       end
  216.     end
  217.     def input_update
  218.       if Input.trigger?(Input::B)
  219.         @type = -1
  220.         @window_shopcommand.active = true
  221.         @window_mercenaries.active = false
  222.         @window_mercenaries.index = -1
  223.         return
  224.       end
  225.       if Input.trigger?(Input::C)
  226.         if @window_shopcommand.active
  227.           case @window_shopcommand.index
  228.           when 0
  229.             return if @temp == []
  230.             @window_mercenaries.set_mercenaries(@temp)
  231.             @type = 0
  232.             @window_shopcommand.active = false
  233.             @window_mercenaries.active = true
  234.             @window_mercenaries.index = 0
  235.             return
  236.           when 1
  237.             return if $game_party.actors == []
  238.             actors = []
  239.             for actor in $game_party.actors
  240.               actors << actor.id
  241.             end
  242.             
  243.             @window_mercenaries.set_mercenaries(actors)
  244.             @type = 1
  245.             @window_shopcommand.active = false
  246.             @window_mercenaries.active = true
  247.             @window_mercenaries.index = 0
  248.             return
  249.           when 2
  250.             $scene = Scene_Map.new
  251.             return
  252.           end
  253.         end
  254.         case @type
  255.         when 0
  256.           if $game_party.gold >= $game_actors[@window_mercenaries.id].price
  257.             if $game_party.actors.size < 4
  258.               $game_party.lose_gold($game_actors[@window_mercenaries.id].price)
  259.               $game_party.add_actor(@window_mercenaries.id)
  260.               @window_mercenaries.mercenaries.delete(@window_mercenaries.id)
  261.               @window_mercenaries.refresh
  262.               if @window_mercenaries.index > @window_mercenaries.mercenaries.size-1
  263.                 @window_mercenaries.index = @window_mercenaries.mercenaries.size-1
  264.               end
  265.             end
  266.           end
  267.         when 1
  268.           if @window_mercenaries.id != 1
  269.             $game_party.gain_gold($game_actors[@window_mercenaries.id].price / 2)
  270.             $game_party.remove_actor(@window_mercenaries.id)
  271.             @temp << @window_mercenaries.id
  272.             @window_mercenaries.mercenaries.delete(@window_mercenaries.id)
  273.             @window_mercenaries.refresh
  274.             if @window_mercenaries.index > @window_mercenaries.mercenaries.size-1
  275.               @window_mercenaries.index = @window_mercenaries.mercenaries.size-1
  276.             end
  277.           end
  278.         end
  279.         @window_gold.refresh
  280.       end
  281.     end
  282.     def rm_update
  283.       Graphics.update
  284.       Input.update
  285.     end
  286.   end
  287. end
  288. class Game_Actor
  289.   def price
  290.     price = @name.split(/,/)[1].nil? ? 0 : @name.split(/,/)[1].to_i
  291.     return price * self.level
  292.   end
  293.   def name
  294.     return @name.split(/,/)[0]
  295.   end
  296. end
  297. class Game_System
  298.   attr_reader   :mercenaries
  299.   alias old_initialize initialize
  300.   def initialize
  301.     old_initialize
  302.     @mercenaries = {}
  303.   end
  304. end
复制代码
哎呀,蛋疼什么的最有爱了
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
35 小时
注册时间
2008-6-23
帖子
275
10
 楼主| 发表于 2008-7-7 17:31:35 | 只看该作者
以下引用yangff于2008-7-4 20:15:36的发言:

module Mercenaries
class Window_Help < ::Window_Base
   def initialize
     super(0, 0, 196, 256)
     self.contents = Bitmap.new(width - 32, height - 32)
。。。。。。
attr_reader   :mercenaries
alias old_initialize initialize
def initialize
   old_initialize
   @mercenaries = {}
end
end




替换了原来的脚本,但是还是老毛病啊

HзO
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-8-9 02:02

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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