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

Project1

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

[已经解决] 高手进来帮帮忙吖,看看脚本有啥错误??

 关闭 [复制链接]

Lv2.观梦者

梦石
0
星屑
344
在线时间
185 小时
注册时间
2007-9-2
帖子
168
跳转到指定楼层
1
发表于 2009-7-18 14:53:46 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 zhli667 于 2009-7-18 14:55 编辑

自己改的"人物仓库"脚本,换人时有错误.而且系统占用严重,似乎有死循环.......
http://rpg.blue/viewthread.php?tid=128920&extra=page%3D2
  1. #==============================================================================
  2. # ■ chaochao的人物仓库ver1.02正式版
  3. # 修改了Game_Party
  4. # 功能:
  5. # 用来存放角色的仓库……
  6. # 召唤画面用$scene = Chaochao_Scene_Party.new
  7. # 其它使用说明在代码里已经备注。
  8. #------------------------------------------------------------------------------
  9. # 作者:chaochao
  10. # http://zhuchao.go1.icpcn.com
  11. #==============================================================================
  12. class Chaochao_Window_PartyLeft < Window_Selectable

  13. def initialize
  14.     super(0, 0, 210, 352)
  15.     self.contents = Bitmap.new(width - 32, height - 32)
  16.     self.index = 0
  17.     refresh
  18.   end
  19.   #--------------------------------------------------------------------------
  20.   # ● 刷新
  21.   #--------------------------------------------------------------------------
  22.   def refresh
  23.     self.contents.clear
  24.     @item_max = $game_party.actors.size
  25.     for i in 0...$game_party.actors.size
  26.       x = 64
  27.       y = i * 80
  28.       actor = $game_party.actors[i]
  29.       bitmap = Bitmap.new("Graphics/System/menu/headp/" + actor.name + ".png")
  30.       src_rect = Rect.new(0, 0, 53, 66)
  31.       self.contents.blt(x - 64, y + 10, bitmap, src_rect)
  32.       self.draw_actor_state(actor, x - 50, y + 34 + 17)
  33.       # 我全写成散的!                  =。=
  34.    
  35.       self.contents.font.size = 16
  36.       #self.contents.draw_text(x - 10, y, 120, 32, actor.name)
  37.       self.contents.font.color = normal_color  
  38.       self.contents.font.color =Color.new(0,0, 0, 255)#黑色
  39.       self.contents.font.size = 25
  40.       self.contents.draw_text(x +7, y+8, 150, 32, actor.name)
  41.       
  42.      # bitmap = Bitmap.new("Graphics/system/menu/back/" + actor.name + "_name.png")
  43.       #bitmap = Bitmap.new(character_name)
  44.      # src_rect = Rect.new(0, 0, 120, 66)
  45.       #self.contents.blt(x - 10, y+10 , bitmap, src_rect)
  46.       
  47.       self.contents.font.color = system_color
  48.       self.contents.font.color = normal_color1
  49.       self.contents.font.size = 16
  50.       self.contents.font.color = system_color
  51.     #  self.contents.draw_text(x - 30, y + 17 + 17, 32, 32, $data_system.words.hp)
  52.      bitmap = Bitmap.new("Graphics/system/menu/back/命.png")
  53.       src_rect = Rect.new(0, 0, 120, 66)
  54.       self.contents.blt(x-6 , y+42 , bitmap, src_rect)
  55.       
  56.       self.contents.font.color = actor.hp <= 1 ? gray_color :
  57.         actor.hp <= actor.maxhp / 5 ? dead_color :
  58.         actor.hp <= actor.maxhp / 5*2 ? warn_color : gray_color
  59.       self.contents.draw_text(x +18, y + 17 + 17, 32, 32, actor.hp.to_s, 2)
  60.       
  61.       self.contents.font.color =Color.new(0,0, 0, 255)
  62.       self.contents.draw_text(x  + 48, y + 17 + 17, 12, 32, "/", 1)
  63.       # self.contents.font.color =n- 6ormal_color1
  64.       self.contents.font.color =Color.new(255,-255,-255,255)
  65.       self.contents.draw_text(x  + 58, y + 17 + 17, 32, 32, actor.maxhp.to_s)
  66.       self.contents.font.color = system_color
  67.       #self.contents.draw_text(x - 30, y + 34 +17, 32, 32, $data_system.words.sp)
  68.       bitmap = Bitmap.new("Graphics/system/menu/back/气.png")
  69.       src_rect = Rect.new(0, 0, 120, 66)
  70.       self.contents.blt(x-6 , y+57 , bitmap, src_rect)
  71.       
  72.       self.contents.font.color = actor.sp <= 1 ? gray_color :
  73.         actor.sp <= actor.maxsp / 5 ? dead_color :
  74.         actor.sp <= actor.maxsp / 5*2 ? warn_color : blue_color #normal_color1
  75.         
  76.       
  77.       self.contents.draw_text(x +18, y + 34 + 17, 32, 32, actor.sp.to_s, 2)
  78.        self.contents.font.color =Color.new(0,0, 0, 255)#黑色
  79.      
  80.       self.contents.draw_text(x  + 48, y + 34 + 17, 12, 32, "/", 1)
  81.        self.contents.font.color =Color.new(5, 5, 255, 255)#normal_color1 蓝条
  82.       self.contents.draw_text(x  + 58, y + 34 + 17, 32, 32, actor.maxsp.to_s)
  83.     end
  84.   end


  85.   
  86.   
  87.   #--------------------------------------------------------------------------
  88.   # ● 刷新光标矩形
  89.   #--------------------------------------------------------------------------
  90.   def update_cursor_rect
  91.     if @index <= -2
  92.       self.cursor_rect.empty
  93.     elsif @index == -1
  94.       self.cursor_rect.set(0, 0, self.width - 32, @item_max * 80)
  95.     else
  96.       self.cursor_rect.set(0, @index * 80, self.width - 32, 80)
  97.     end
  98.   end
  99. end

  100. #------------------------------------------------------------------------------

  101. class Chaochao_Window_PartyRight < Window_Selectable
  102.   def initialize
  103.     super(320, 270,280, 170)
  104.     self.windowskin = RPG::Cache.windowskin("../system/menu/windowskins/palskin")
  105.     self.opacity = 100
  106.     self.contents = Bitmap.new(width - 32, height - 32)
  107.     self.index = -1
  108.     refresh
  109.   end
  110.   def actor
  111.     return @actors[self.index]
  112.   end
  113.   def refresh
  114.     if self.contents != nil
  115.       self.contents.dispose
  116.       self.contents = nil
  117.     end
  118.     @actors = []
  119.     for i in 0...$game_party.actors2.size
  120.       @actors.push($game_party.actors2[i])
  121.     end
  122.    
  123.     @item_max = $game_party.actors2.size
  124.     if @item_max > 0
  125.       self.contents = Bitmap.new(width - 32, row_max * 32)
  126.       for i in 0...@item_max
  127.         draw_item(i)
  128.       end
  129.     elsif @item_max == 0
  130.       
  131.     end
  132.   end
  133.   def draw_item(index)
  134.     actor = @actors[index]
  135.     text = @actors[index].name
  136.     lv = @actors[index].level.to_s + " "
  137.     if $game_party.chaochao2.include?(actor.id) or $game_party.actors.size >= 4
  138.         self.contents.font.color = Color.new(255, 0, 0) #不能被移动的颜色
  139.       else
  140.         self.contents.font.color = Color.new(0, 255, 0) #可以被移动的颜色
  141.       end
  142.     self.contents.draw_text(4, index * 32, 288, 32, text)
  143.     self.contents.font.color = Color.new(0, 255, 0)
  144.     self.contents.font.size = 16
  145.     self.contents.draw_text(-30, index * 32 , 288, 32,  "Level:   ", 2)
  146.     colorx = [255.0000 - 255.0000/60 * @actors[index].level,0].max
  147.     colory = [255.0000 / 60 * @actors[index].level,255].min
  148.     self.contents.font.color = Color.new(colorx, colory, 0)
  149.     self.contents.draw_text(-30, index * 32 , 288, 32,  lv, 2)
  150.     self.contents.font.color = Color.new(0, 255, 0)
  151.     self.contents.font.size = 22
  152.   end
  153.   def update_cursor_rect
  154.     if @index < 0
  155.       self.cursor_rect.empty
  156.       return
  157.     end
  158.     row = @index / @column_max
  159.     if row < self.top_row
  160.       self.top_row = row
  161.     end
  162.     if row > self.top_row + (self.page_row_max - 1)
  163.       self.top_row = row - (self.page_row_max - 1)
  164.     end
  165.     cursor_width = self.width / @column_max - 32
  166.     x = @index % @column_max * (cursor_width + 32)
  167.     y = @index / @column_max * 32 - self.oy
  168.     self.cursor_rect.set(x, y, cursor_width, 32)
  169.   end
  170.   def item_max
  171.     return @item_max
  172.   end
  173.   def actor?(index)
  174.     return @actors[index] == nil ? false : true
  175.   end
  176.   def set_index(x)
  177.     @index = x
  178.   end
  179. end

  180. #------------------------------------------------------------------------------
  181. #--------------------------------------------------------------------------

  182. class Chaochao_Window_PartyData < Window_Base
  183.   
  184.   def initialize
  185.      super(320, 30,280, 245)
  186.      self.windowskin = RPG::Cache.windowskin("../system/menu/windowskins/palskin")
  187.     self.opacity = 100
  188.     self.contents = Bitmap.new(width - 32, height - 32)
  189.     @actor = nil
  190.   end
  191.   def set_actor(actor)
  192.     self.contents.clear
  193.     draw_actor_name(actor,103, 0)
  194.     self.contents.draw_text(97, 0, 96, 32, ":")
  195.     @actor = actor
  196.     src_rect = Rect.new(340, 70, 640,480)
  197.     self.contents.font.color =Color.new(255,255, 255, 255)
  198.     self.contents.font.size = 18
  199.     self.contents.font.bold = true
  200.     back_help = Bitmap.new("Graphics/system/menu/【菜单】状态背景")
  201.     self.contents.blt(0, 0, back_help, src_rect, 255)
  202.     draw_actor_graphic(@actor, 40, 135)
  203.     draw_actor_class(@actor, 60, 0)
  204.     draw_actor_level(@actor, 50, 62)
  205.     draw_actor_state(@actor, 96, 64)
  206.     self.contents.draw_text(10 + 40, 130, 84, 32, @actor.exp_s, 2)
  207.     self.contents.draw_text(10 + 40, 150, 84, 32, @actor.next_rest_exp_s, 2)
  208.     draw_actor_parameter(@actor, 80, 10, 0)
  209.     draw_actor_parameter(@actor, 80, 40, 1)
  210.     draw_actor_parameter(@actor, 80, 70, 2)
  211.     draw_actor_parameter(@actor, 80, 100, 3)
  212.     draw_actor_parameter(@actor, 80, 130, 4)
  213.     draw_actor_parameter(@actor, 80, 160, 5)
  214.     draw_actor_parameter(@actor, 80, 190, 6)
  215.     self.visible = true
  216.   end
  217.   def clear
  218.     self.contents.clear
  219.   end
  220. end

  221.   
  222.   

  223. #------------------------------------------------------------------------------

  224. class Game_Party
  225.   attr_reader   :actors2
  226.   attr_reader   :chaochao#不能从队伍向备用角色移动的角色ID
  227.   attr_reader   :chaochao2#不能从备用角色向队伍移动的角色ID
  228.   def initialize
  229.     @actors = []
  230.     @gold = 0
  231.     @steps = 0
  232.     @items = {}
  233.     @weapons = {}
  234.     @armors = {}
  235.     @actors2 = []
  236.     @chaochao = [1]
  237.     @chaochao2 = []
  238.   end
  239.   def add_actor(actor_id,type=1)#type为1是向队伍中添加,为2则相反。
  240.     case type
  241.     when 1
  242.       if $game_actors[actor_id] != nil
  243.         actor = $game_actors[actor_id]
  244.         #如果队伍没有满和队伍中没有此角色
  245.         if @actors.size < 4 and not @actors.include?(actor) and not @actors2.include?(actor)
  246.           @actors.push(actor)
  247.           $game_player.refresh
  248.         end
  249.       end
  250.     when 2
  251.       if $game_actors[actor_id] != nil
  252.         actor = $game_actors[actor_id]
  253.         #如果角色不在队伍中和不在备用角色队伍中的情况下
  254.         #向备用角色中添加角色
  255.         if not @actors.include?(actor) and not @actors2.include?(actor)
  256.           @actors2.push(actor)
  257.           $game_player.refresh
  258.         end
  259.       end
  260.     end
  261.   end
  262.   
  263.   def huanren(index,type=1)#type为1是从备用角色向队伍中移动,为2则相反。
  264.     actor = $game_actors[index]
  265.     case type
  266.     when 1
  267.       if @actors.size < 4 and @actors2.include?(actor) and not @chaochao2.include?(index) and not @actors.include?(actor)
  268.         @actors.push(actor)
  269.         @actors2.delete(actor)
  270.         $game_system.se_play($data_system.decision_se)
  271.         $game_player.refresh
  272.       end
  273.     when 2
  274.       if @actors.include?(actor) and not @chaochao.include?(index) and not @actors2.include?(actor)
  275.         @actors2.push(actor)
  276.         @actors.delete(actor)
  277.         $game_system.se_play($data_system.decision_se)
  278.         $game_player.refresh
  279.       end
  280.     end
  281.   end
  282.   
  283.   #type1,1是操作队伍中的角色能否向备用队伍移动,2则相反。
  284.   #type2,1是添加不能移动的,2是删除不能移动的。
  285.   def yidong(actor_id,type1,type2=1)
  286.     case type2
  287.     when 1
  288.       case type1
  289.       when 1
  290.         @chaochao.push(actor_id)
  291.       when 2
  292.         @chaochao2.push(actor_id)
  293.       end
  294.     when 2
  295.       case type1
  296.       when 1
  297.         @chaochao.delete(actor_id)
  298.       when 2
  299.         @chaochao2.delete(actor_id)
  300.       end
  301.     end
  302.   end
  303.   
  304.   #type,1从队伍中离开,2从备用角色中离开,3从队伍和备用角色中离开。
  305.   def remove_actor(actor_id,type=1)
  306.     actor = $game_actors[actor_id]
  307.     case type
  308.     when 1
  309.       @actors.delete(actor)
  310.       $game_player.refresh
  311.     when 2
  312.       @actors2.delete(actor)
  313.       $game_player.refresh
  314.     when 3
  315.       @actors.delete(actor)
  316.       @actors2.delete(actor)
  317.       $game_player.refresh
  318.     end
  319.   end
  320.   
  321.   def refresh
  322.     new_actors = []
  323.     new_actors2 = []
  324.     for i in [email protected]
  325.       if $data_actors[@actors[i].id] != nil
  326.         new_actors.push($game_actors[@actors[i].id])
  327.       end
  328.     end
  329.     @actors = new_actors
  330.     for i in [email protected]
  331.       if $data_actors[@actors2[i].id] != nil
  332.         new_actors2.push($game_actors[@actors2[i].id])
  333.       end
  334.     end
  335.     @actors2 = new_actors2
  336.   end
  337. end

  338. #------------------------------------------------------------------------------

  339. class Chaochao_Scene_Party
  340.   def main
  341.     @left_temp_command = 0
  342.     @right_temp_command = 0
  343.     @temp = 0
  344.     @left_window = Chaochao_Window_PartyLeft.new
  345.     @left_window.active = true
  346.     @right_window = Chaochao_Window_PartyRight.new
  347.     @right_window.active = false
  348.     @data_window = Chaochao_Window_PartyData.new
  349.     update_data
  350.     Graphics.transition
  351.     loop do
  352.       Graphics.update
  353.       Input.update
  354.       update
  355.       if $scene != self
  356.         break
  357.       end
  358.     end
  359.     Graphics.freeze
  360.     @left_window.dispose
  361.     @right_window.dispose
  362.     @data_window.dispose
  363.   end
  364.   
  365.   def update
  366.     @left_window.update
  367.     @right_window.update
  368.     @data_window.update
  369.     update_command
  370.     update_data
  371.   end
  372.   
  373.   def update_command
  374.     if Input.trigger?(Input::B)
  375.       $game_system.se_play($data_system.cancel_se)
  376.       #画面切换
  377.       $scene = Scene_Map.new
  378.       return
  379.     end
  380.     if @left_window.active
  381.       update_left
  382.       return
  383.     end
  384.     if @right_window.active
  385.       update_right
  386.       return
  387.     end
  388.   end
  389.   
  390.   def update_left
  391.     if Input.trigger?(Input::RIGHT)
  392.       if @right_window.item_max > 0
  393.         @left_temp_command = @left_window.index
  394.         @left_window.set_index(-1)
  395.         $game_system.se_play($data_system.cursor_se)
  396.         @left_window.active = false
  397.         @right_window.active = true
  398.         @left_window.refresh
  399.         @right_window.refresh
  400.         @right_window.set_index(@right_temp_command)
  401.         return
  402.       else
  403.         $game_system.se_play($data_system.buzzer_se)
  404.         return
  405.       end
  406.     end
  407.     if Input.trigger?(Input::C)
  408.       if @left_window.active and @left_window.actor?(@left_window.index) and $game_party.actors.size > 1 and not $game_party.chaochao.include?($game_party.actors[@left_window.index].id)
  409.         $game_party.huanren($game_party.actors[@left_window.index].id,2)#type为1是从备用角色向队伍中移动,为2则相反。
  410.         @left_window.refresh
  411.         @right_window.refresh
  412.       else
  413.         $game_system.se_play($data_system.buzzer_se)
  414.       end
  415.     end
  416.     return
  417.   end
  418.   
  419.   def update_right
  420.     if Input.trigger?(Input::LEFT)
  421.       if @left_window.item_max > 0
  422.         @right_temp_command = @right_window.index
  423.         @right_window.set_index(-1)
  424.         $game_system.se_play($data_system.cursor_se)
  425.         @left_window.active = true
  426.         @right_window.active = false
  427.         @left_window.refresh
  428.         @right_window.refresh
  429.         @left_window.set_index(@left_temp_command)
  430.         return
  431.       else
  432.         $game_system.se_play($data_system.buzzer_se)
  433.         return
  434.       end
  435.     end
  436.     if Input.trigger?(Input::C)
  437.       if $game_party.actors.size >= 4
  438.         $game_system.se_play($data_system.buzzer_se)
  439.         return
  440.       end
  441.       if @right_window.active and @right_window.actor?(@right_window.index) and not $game_party.chaochao2.include?($game_party.actors2[@right_window.index].id)
  442.         $game_party.huanren($game_party.actors2[@right_window.index].id,1)#type为1是从备用角色向队伍中移动,为2则相反。
  443.         if $game_party.actors2.size == 0
  444.           @right_temp_command = @right_window.index
  445.           @right_window.set_index(-1)
  446.           $game_system.se_play($data_system.cursor_se)
  447.           @left_window.active = true
  448.           @right_window.active = false
  449.           @left_window.refresh
  450.           @right_window.refresh
  451.           @left_window.set_index(@left_temp_command)
  452.         end
  453.         if @right_window.index > 0
  454.           @right_window.set_index(@right_window.index-1)
  455.         end
  456.         @left_window.refresh
  457.         @right_window.refresh
  458.       else
  459.         $game_system.se_play($data_system.buzzer_se)
  460.       end
  461.     end
  462.     return
  463.   end
  464. end
  465.   def update_data
  466.     if @left_window.active
  467.       if $game_party.actors[@left_window.index] != nil
  468.         @data_window.set_actor($game_party.actors[@left_window.index])
  469.       else
  470.         @data_window.clear
  471.       end
  472.       return
  473.     end
  474.     if @right_window.active
  475.       if $game_party.actors2[@right_window.index] != nil
  476.         @data_window.set_actor($game_party.actors2[@right_window.index])
  477.       else
  478.         @data_window.clear
  479.       end
  480.       return
  481.     end
  482.   end

复制代码

Lv2.观梦者

梦石
0
星屑
344
在线时间
185 小时
注册时间
2007-9-2
帖子
168
2
 楼主| 发表于 2009-7-18 22:45:10 | 只看该作者
:Q:dizzy::curse::@:'(
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-1-11 16:51

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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