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

Project1

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

[已经解决] 问个小白问题!关于主站上无冲突版人物仓库指令应用!

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
284 小时
注册时间
2012-9-9
帖子
24
跳转到指定楼层
1
发表于 2013-6-13 16:37:58 | 显示全部楼层 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 亿万星辰 于 2013-6-14 06:59 编辑

本人接触RM时间不久……更是彻彻底底的脚本盲……
是在是不会调用脚本中的指令……研究N就不是冲突就是错误……求教的说!!!
用的是主站上的人物仓库脚本,Scene_Menu增加了更换队伍指令……游戏初期就可以调换队友……
可是接着就出问题了……才刚选择开始应该就主角一人在队伍中,没有其他队友……但是调整队伍哪里却是数据库中设置的所有角色都存在并可以调换……求解……
顺便由于实在脚本晕,所以想了解一下确切的指令比如类似怎么加入多余的角色入仓库(4人满了以后调换用),怎么删除离队的仓库角色……以上!!!
这是哪个脚本……
  1. #party转换
  2. #这是简易的party转换的脚本。


  3. class Game_Party
  4. attr_accessor :party_max
  5. attr_accessor :party_min
  6. alias party_select_initialize initialize
  7. def initialize
  8.    party_select_initialize
  9.    @party_max = 4
  10.    @party_min = 1
  11. end
  12. def add_actor(actor_id)
  13.    # 获取角色
  14.    actor = $game_actors[actor_id]
  15.    # 同伴人数未满 4 人、本角色不在队伍中的情况下
  16.    if @actors.size < 4 and not @actors.include?(actor)
  17.      # 添加角色
  18.      @actors.push(actor)
  19.      # 还原主角
  20.      $game_player.refresh
  21.    end
  22.   #--------------------------------------------------------------------------
  23.   # ● 角色离开
  24.   #     actor_id : 角色 ID
  25.   #--------------------------------------------------------------------------
  26.   def remove_actor(actor_id)
  27.     # 删除觉得
  28.     @actors.delete($game_actors[actor_id])
  29.     # 还原主角
  30.     $game_player.refresh
  31.   end
  32. end
  33. end

  34. class Window_Party_Select < Window_Selectable
  35. #--------------------------------------------------------------------------
  36. # ● オブジェクト初期化
  37. #--------------------------------------------------------------------------
  38. def initialize
  39.    super(324, 24, 304, 384)
  40.    @party_in_ok_menber = party_in_menber
  41.    @item_max = party_in_menber.size
  42.    self.contents = Bitmap.new(width - 32, row_max * 32)
  43.    self.index = 0
  44. #==============================================================================
  45.    self.opacity = 0
  46.    refresh
  47. end
  48. #--------------------------------------------------------------------------
  49. # ● アクターの取得
  50. #--------------------------------------------------------------------------
  51. def menber
  52.    return @party_in_ok_menber[self.index]
  53. end
  54. #--------------------------------------------------------------------------
  55. # ● パーティーin可能なメンバー取得
  56. #--------------------------------------------------------------------------
  57. def party_in_menber
  58.    menber = []
  59.    menber.push($game_actors[1])  
  60.    menber.push($game_actors[2])
  61.    menber.push($game_actors[3])
  62.    menber.push($game_actors[4])
  63.    menber.push($game_actors[5])
  64.    menber.push($game_actors[6])
  65.    menber.push($game_actors[7])
  66.    menber.push($game_actors[8])
  67.    menber.push($game_actors[9])
  68.    menber.push($game_actors[10])
  69.    menber.push($game_actors[11])
  70.    menber.push($game_actors[12])
  71.    menber.push($game_actors[13])
  72.    menber.push($game_actors[14])
  73.    menber.delete($game_actors[6])  if $game_switches[984]
  74.    menber.delete($game_actors[12])  if $game_switches[985]
  75.    return menber
  76. end
  77. #--------------------------------------------------------------------------
  78. # ● リフレッシュ
  79. #--------------------------------------------------------------------------
  80. def refresh
  81.    self.contents.clear
  82.    for i in [email]0...@party_in_ok_menber.size[/email]
  83.      draw_menber(i)
  84.    end
  85. end
  86. #--------------------------------------------------------------------------
  87. # ● アクター描画
  88. #--------------------------------------------------------------------------
  89. def draw_menber(index)
  90.    actor = @party_in_ok_menber[index]
  91.    text = @party_in_ok_menber[index].name
  92.    lv = @party_in_ok_menber[index].level.to_s + " "
  93.    x = 4 + index % @column_max
  94.    y = index / @column_max * 32
  95.    if $game_party.actors.include?(actor)
  96.      color = normal_color
  97.      opacity = 255
  98.    else
  99.      color = disabled_color
  100.      opacity = 128
  101.    end
  102.    self.contents.font.color = color
  103.    self.contents.draw_text(x, y, 120, 32, actor.name)
  104.    self.contents.draw_text(8, index * 32+2, 262, 32,  "Level:   ", 2)
  105.    self.contents.draw_text(8, index * 32+2, 262, 32,  lv, 2)
  106.    self.contents.font.color = normal_color
  107.    self.contents.font.size = 19
  108. #==============================================================================
  109. end
  110. #--------------------------------------------------------------------------
  111. # ● カーソルの矩形更新
  112. #--------------------------------------------------------------------------
  113.   def update_cursor_rect
  114.     if @index < 0
  115.       self.cursor_rect.empty
  116.       return
  117.     end
  118.     row = @index / @column_max
  119.     if row < self.top_row
  120.       self.top_row = row
  121.     end
  122.     if row > self.top_row + (self.page_row_max - 1)
  123.       self.top_row = row - (self.page_row_max - 1)
  124.     end
  125.     cursor_width = 270
  126.     x = @index % @column_max * (cursor_width + 32)
  127.     y = @index / @column_max * 32 - self.oy
  128.     self.cursor_rect.set(x, y, cursor_width, 32)
  129.   end
  130.   def item_max
  131.     return @item_max
  132.   end
  133.   def actor?(index)
  134.     return @actors[index] == nil ? false : true
  135.   end
  136.   def set_index(x)
  137.     @index = x
  138.   end
  139. end

  140. class Window_Party_Select_Menber < Window_Base
  141. #--------------------------------------------------------------------------
  142. # ● オブジェクト初期化
  143. #--------------------------------------------------------------------------
  144.   def initialize
  145.     super(8, 12, 304, 224)
  146.     self.contents = Bitmap.new(width - 32, height - 32)
  147. #==============================================================================
  148.     self.opacity = 0
  149.     refresh
  150.   end
  151.   def actor
  152.     return @actors[self.index]
  153.   end
  154.   def refresh
  155.     if self.contents != nil
  156.       self.contents.dispose
  157.       self.contents = nil
  158. #==============================================================================
  159.       self.opacity = 0
  160.     end
  161.     @actors = []
  162.     for i in 0...$game_party.actors.size
  163.       @actors.push($game_party.actors[i])
  164.     end
  165.    
  166.     @item_max = 4
  167.     if @item_max > 0
  168.       self.contents = Bitmap.new(width - 32, height - 32)
  169.       for i in 0...@item_max
  170. #==============================================================================
  171.       self.opacity = 0
  172.         draw_item(i)
  173.       end
  174.     end
  175.   end
  176.   def draw_item(index)
  177.     if @actors[index] != nil
  178.       actor = @actors[index]
  179.       text = @actors[index].name
  180.       lv = @actors[index].level.to_s + " "
  181.       self.contents.font.color = Color.new(255, 255, 128, 255) #可以被移动的颜色
  182.       self.contents.draw_text(8, index * 32 + 32, 262, 32, text)
  183.       self.contents.font.color = normal_color
  184.       self.contents.font.size = 16
  185.       self.contents.draw_text(8, index * 32 + 32, 262, 32, "Level:   ", 2)
  186.       colorx = [255.0000 - 255.0000/60 * @actors[index].level,0].max
  187.       colory = [255.0000 / 60 * @actors[index].level,255].min
  188.       self.contents.font.color = Color.new(colorx, colory, 0)
  189.       self.contents.draw_text(8, index * 32 + 32, 262, 32,  lv, 2)
  190.       self.contents.font.color = Color.new(0, 255, 0)
  191.       self.contents.font.size = 19
  192. #==============================================================================
  193.       self.opacity = 0
  194.     else
  195.       self.contents.draw_text(8, index * 32 + 32, 262, 32,  "没有角色")
  196.     end
  197.   end
  198.   def update_cursor_rect
  199.     if @index < 0
  200.       self.cursor_rect.empty
  201.       return
  202.     end
  203.     row = @index / @column_max
  204.     if row < self.top_row
  205.       self.top_row = row
  206.     end
  207.     if row > self.top_row + (self.page_row_max - 1)
  208.       self.top_row = row - (self.page_row_max - 1)
  209.     end
  210.     cursor_width = self.width / @column_max - 32
  211.     x = @index % @column_max * (cursor_width + 32)
  212.     y = @index / @column_max * 32 - self.oy + 32
  213.     self.cursor_rect.set(x, y, cursor_width, 32)
  214.   end
  215.   def item_max
  216.     return @item_max
  217.   end
  218.   def actor?(index)
  219.     return @actors[index] == nil ? false : true
  220.   end
  221.   def set_index(x)
  222.     @index = x
  223.   end
  224. end

  225. class Window_Party_Select_Menber_Status < Window_Base
  226. #--------------------------------------------------------------------------
  227. # ● オブジェクト初期化
  228. #--------------------------------------------------------------------------
  229. def initialize
  230.    super(8, 232, 304, 256)
  231.    self.contents = Bitmap.new(width - 32, height - 32)
  232. #==============================================================================
  233.    self.opacity = 0
  234. end
  235. #--------------------------------------------------------------------------
  236. # ● リフレッシュ
  237. #--------------------------------------------------------------------------
  238. def refresh(actor)
  239.    self.contents.clear
  240.    draw_actor_name(actor, 24, 16)
  241.    draw_actor_state(actor, 132, 48)
  242.    draw_actor_hp(actor, 116, 80)
  243.    draw_actor_sp(actor, 116, 112)
  244.    draw_actor_level(actor, 24, 48)
  245.    draw_actor_class(actor, 132, 16)
  246.    draw_actor_graphic(actor, 40, 138)
  247.    [url=home.php?mod=space&uid=95897]@actor[/url] = actor
  248. end
  249. end

  250. class Scene_Party_in
  251. #--------------------------------------------------------------------------
  252. # ● メイン処理
  253. #--------------------------------------------------------------------------
  254. def main
  255. #######################################
  256.    @background = Sprite.new
  257.    @background.bitmap = RPG::Cache.picture("ckbj")
  258.    @background.x = 0
  259.    @background.y = 0
  260. #######################################
  261.    @main_window = Window_Party_Select.new
  262.    @menber_window = Window_Party_Select_Menber.new
  263.    @status_window = Window_Party_Select_Menber_Status.new
  264.    @status_window.opacity = 0
  265.    @status_window.z += 0
  266.    @show_index = 0
  267.    status_window_position
  268.    @status_window.refresh(@main_window.menber)
  269.    @status_window.visible = true
  270.    @show_index = @main_window.index
  271.    # トランジション実行
  272.    Graphics.transition
  273.    # メインループ
  274.    loop do
  275.      # ゲーム画面を更新
  276.      Graphics.update
  277.      # 入力情報を更新
  278.      Input.update
  279.      # フレーム更新
  280.      update
  281.      # 画面が切り替わったらループを中断
  282.      if $scene != self
  283.        break
  284.      end
  285.    end
  286.    # トランジション準備
  287.    Graphics.freeze
  288.    # ウィンドウを解放
  289.    @background.dispose
  290.    @main_window.dispose
  291.    @menber_window.dispose
  292.    @status_window.dispose
  293. end
  294. #--------------------------------------------------------------------------
  295. # ● フレーム更新
  296. #--------------------------------------------------------------------------
  297. def update
  298.    # コマンドウィンドウを更新
  299.    @background.update
  300.    @main_window.update
  301.    if @status_window.visible and @show_index != @main_window.index
  302.      status_window_position
  303.      @status_window.refresh(@main_window.menber)
  304.      @show_index = @main_window.index
  305.    end
  306.    # B ボタンが押された場合
  307.    if Input.trigger?(Input::B)
  308.      if $game_party.actors.size < 1
  309.        # ブザー SE を演奏
  310.        $game_system.se_play($data_system.buzzer_se)
  311.        return
  312.      end
  313.      # キャンセル SE を演奏
  314.      $game_system.se_play($data_system.cancel_se)
  315.      # メニュー画面に切り替え
  316.      $scene = Scene_Menu.new(5)
  317.      return
  318.    end
  319.    # C ボタンが押された場合
  320.    if Input.trigger?(Input::C)
  321.      # 選択したアクターが強制加入アクターの場合入れ替え不可
  322.      if $game_party.actors.include?(@main_window.menber)
  323.        $game_party.remove_actor(@main_window.menber.id)
  324.      else
  325.        if $game_party.actors.size == $game_party.party_max
  326.          # ブザー SE を演奏
  327.          $game_system.se_play($data_system.buzzer_se)
  328.          return
  329.        end
  330.        $game_party.add_actor(@main_window.menber.id)
  331.      end
  332.      # 決定 SE を演奏
  333.      $game_system.se_play($data_system.decision_se)
  334.      @main_window.refresh
  335.      @menber_window.refresh
  336.      return
  337.    end
  338.     # A ボタンが押された場合
  339.    #if Input.trigger?(Input::A)
  340.      # 決定 SE を演奏
  341.      #$game_system.se_play($data_system.decision_se)
  342.      #if @status_window.visible
  343.         #@status_window.visible = false

  344.      #else
  345.         #status_window_position
  346.         #@status_window.refresh(@main_window.menber)
  347.         #@status_window.visible = true
  348.         #@show_index = @main_window.index
  349.      #end
  350.      #return
  351.    #end
  352. end
  353. def status_window_position
  354.    if @main_window.cursor_rect.y < 176
  355.      @status_window.y = 232
  356.    else
  357.      @status_window.y = 232
  358.    end
  359. end
  360. end
  361.   
复制代码

点评

发布帖子的时候有个“<>”的图案,点下去吧,那是代码功能,贴脚本用的==  发表于 2013-6-14 00:31

Lv1.梦旅人

梦石
0
星屑
50
在线时间
284 小时
注册时间
2012-9-9
帖子
24
2
 楼主| 发表于 2013-6-14 11:35:44 | 显示全部楼层
512195574 发表于 2013-6-14 10:02
又见楼主了……
其实这个脚本是有大量注释的,我也用着这个脚本,不过你的这个好像没有。
强制角色(意思就 ...


哭……还是没搞懂……我试过结果每次在事件中插入指令都是冲突……这下更是脚本冲突了……只能先禁用更换队伍这个选项这个选项了……
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
284 小时
注册时间
2012-9-9
帖子
24
3
 楼主| 发表于 2013-6-14 11:54:43 | 显示全部楼层
本帖最后由 陌鸢 于 2013-6-14 12:34 编辑
512195574 发表于 2013-6-14 11:42
你试试这个,怀疑你那个缺少东西,我这边测试很正常……


刚刚那个冲突解决了……不过还是原来的问题……汗……我直接上截图吧表示我在测试菜单的时候,刚刚从标题画面进入地图……人物就给全了……这个怎么调……能写下具体指令吗~我估计我自己弄的指令很有问题……
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
284 小时
注册时间
2012-9-9
帖子
24
4
 楼主| 发表于 2013-6-14 12:21:23 | 显示全部楼层
512195574 发表于 2013-6-14 12:05
你大概改了窗口了,不知道脚本的定义部分你改没改,如果没改,按照原版的话就是从62行开始

   menber.push ...

非常感谢……终于解决……如果要加入特定人物直接在事件里插入脚本这指令可以吗~
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-14 12:15

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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