赞 | 0 |
VIP | 3 |
好人卡 | 0 |
积分 | 1 |
经验 | 5208 |
最后登录 | 2017-3-30 |
在线时间 | 284 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 284 小时
- 注册时间
- 2012-9-9
- 帖子
- 24
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 亿万星辰 于 2013-6-14 06:59 编辑
本人接触RM时间不久……更是彻彻底底的脚本盲……
是在是不会调用脚本中的指令……研究N就不是冲突就是错误……求教的说!!!
用的是主站上的人物仓库脚本,Scene_Menu增加了更换队伍指令……游戏初期就可以调换队友……
可是接着就出问题了……才刚选择开始应该就主角一人在队伍中,没有其他队友……但是调整队伍哪里却是数据库中设置的所有角色都存在并可以调换……求解……
顺便由于实在脚本晕,所以想了解一下确切的指令比如类似怎么加入多余的角色入仓库(4人满了以后调换用),怎么删除离队的仓库角色……以上!!!
这是哪个脚本……- #party转换
- #这是简易的party转换的脚本。
- class Game_Party
- attr_accessor :party_max
- attr_accessor :party_min
- alias party_select_initialize initialize
- def initialize
- party_select_initialize
- @party_max = 4
- @party_min = 1
- end
- def add_actor(actor_id)
- # 获取角色
- actor = $game_actors[actor_id]
- # 同伴人数未满 4 人、本角色不在队伍中的情况下
- if @actors.size < 4 and not @actors.include?(actor)
- # 添加角色
- @actors.push(actor)
- # 还原主角
- $game_player.refresh
- end
- #--------------------------------------------------------------------------
- # ● 角色离开
- # actor_id : 角色 ID
- #--------------------------------------------------------------------------
- def remove_actor(actor_id)
- # 删除觉得
- @actors.delete($game_actors[actor_id])
- # 还原主角
- $game_player.refresh
- end
- end
- end
- class Window_Party_Select < Window_Selectable
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- super(324, 24, 304, 384)
- @party_in_ok_menber = party_in_menber
- @item_max = party_in_menber.size
- self.contents = Bitmap.new(width - 32, row_max * 32)
- self.index = 0
- #==============================================================================
- self.opacity = 0
- refresh
- end
- #--------------------------------------------------------------------------
- # ● アクターの取得
- #--------------------------------------------------------------------------
- def menber
- return @party_in_ok_menber[self.index]
- end
- #--------------------------------------------------------------------------
- # ● パーティーin可能なメンバー取得
- #--------------------------------------------------------------------------
- def party_in_menber
- menber = []
- menber.push($game_actors[1])
- menber.push($game_actors[2])
- menber.push($game_actors[3])
- menber.push($game_actors[4])
- menber.push($game_actors[5])
- menber.push($game_actors[6])
- menber.push($game_actors[7])
- menber.push($game_actors[8])
- menber.push($game_actors[9])
- menber.push($game_actors[10])
- menber.push($game_actors[11])
- menber.push($game_actors[12])
- menber.push($game_actors[13])
- menber.push($game_actors[14])
- menber.delete($game_actors[6]) if $game_switches[984]
- menber.delete($game_actors[12]) if $game_switches[985]
- return menber
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- for i in [email]0...@party_in_ok_menber.size[/email]
- draw_menber(i)
- end
- end
- #--------------------------------------------------------------------------
- # ● アクター描画
- #--------------------------------------------------------------------------
- def draw_menber(index)
- actor = @party_in_ok_menber[index]
- text = @party_in_ok_menber[index].name
- lv = @party_in_ok_menber[index].level.to_s + " "
- x = 4 + index % @column_max
- y = index / @column_max * 32
- if $game_party.actors.include?(actor)
- color = normal_color
- opacity = 255
- else
- color = disabled_color
- opacity = 128
- end
- self.contents.font.color = color
- self.contents.draw_text(x, y, 120, 32, actor.name)
- self.contents.draw_text(8, index * 32+2, 262, 32, "Level: ", 2)
- self.contents.draw_text(8, index * 32+2, 262, 32, lv, 2)
- self.contents.font.color = normal_color
- self.contents.font.size = 19
- #==============================================================================
- end
- #--------------------------------------------------------------------------
- # ● カーソルの矩形更新
- #--------------------------------------------------------------------------
- def update_cursor_rect
- if @index < 0
- self.cursor_rect.empty
- return
- end
- row = @index / @column_max
- if row < self.top_row
- self.top_row = row
- end
- if row > self.top_row + (self.page_row_max - 1)
- self.top_row = row - (self.page_row_max - 1)
- end
- cursor_width = 270
- x = @index % @column_max * (cursor_width + 32)
- y = @index / @column_max * 32 - self.oy
- self.cursor_rect.set(x, y, cursor_width, 32)
- end
- def item_max
- return @item_max
- end
- def actor?(index)
- return @actors[index] == nil ? false : true
- end
- def set_index(x)
- @index = x
- end
- end
- class Window_Party_Select_Menber < Window_Base
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- super(8, 12, 304, 224)
- self.contents = Bitmap.new(width - 32, height - 32)
- #==============================================================================
- self.opacity = 0
- refresh
- end
- def actor
- return @actors[self.index]
- end
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- #==============================================================================
- self.opacity = 0
- end
- @actors = []
- for i in 0...$game_party.actors.size
- @actors.push($game_party.actors[i])
- end
-
- @item_max = 4
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, height - 32)
- for i in 0...@item_max
- #==============================================================================
- self.opacity = 0
- draw_item(i)
- end
- end
- end
- def draw_item(index)
- if @actors[index] != nil
- actor = @actors[index]
- text = @actors[index].name
- lv = @actors[index].level.to_s + " "
- self.contents.font.color = Color.new(255, 255, 128, 255) #可以被移动的颜色
- self.contents.draw_text(8, index * 32 + 32, 262, 32, text)
- self.contents.font.color = normal_color
- self.contents.font.size = 16
- self.contents.draw_text(8, index * 32 + 32, 262, 32, "Level: ", 2)
- colorx = [255.0000 - 255.0000/60 * @actors[index].level,0].max
- colory = [255.0000 / 60 * @actors[index].level,255].min
- self.contents.font.color = Color.new(colorx, colory, 0)
- self.contents.draw_text(8, index * 32 + 32, 262, 32, lv, 2)
- self.contents.font.color = Color.new(0, 255, 0)
- self.contents.font.size = 19
- #==============================================================================
- self.opacity = 0
- else
- self.contents.draw_text(8, index * 32 + 32, 262, 32, "没有角色")
- end
- end
- def update_cursor_rect
- if @index < 0
- self.cursor_rect.empty
- return
- end
- row = @index / @column_max
- if row < self.top_row
- self.top_row = row
- end
- if row > self.top_row + (self.page_row_max - 1)
- self.top_row = row - (self.page_row_max - 1)
- end
- cursor_width = self.width / @column_max - 32
- x = @index % @column_max * (cursor_width + 32)
- y = @index / @column_max * 32 - self.oy + 32
- self.cursor_rect.set(x, y, cursor_width, 32)
- end
- def item_max
- return @item_max
- end
- def actor?(index)
- return @actors[index] == nil ? false : true
- end
- def set_index(x)
- @index = x
- end
- end
- class Window_Party_Select_Menber_Status < Window_Base
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- super(8, 232, 304, 256)
- self.contents = Bitmap.new(width - 32, height - 32)
- #==============================================================================
- self.opacity = 0
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh(actor)
- self.contents.clear
- draw_actor_name(actor, 24, 16)
- draw_actor_state(actor, 132, 48)
- draw_actor_hp(actor, 116, 80)
- draw_actor_sp(actor, 116, 112)
- draw_actor_level(actor, 24, 48)
- draw_actor_class(actor, 132, 16)
- draw_actor_graphic(actor, 40, 138)
- [url=home.php?mod=space&uid=95897]@actor[/url] = actor
- end
- end
- class Scene_Party_in
- #--------------------------------------------------------------------------
- # ● メイン処理
- #--------------------------------------------------------------------------
- def main
- #######################################
- @background = Sprite.new
- @background.bitmap = RPG::Cache.picture("ckbj")
- @background.x = 0
- @background.y = 0
- #######################################
- @main_window = Window_Party_Select.new
- @menber_window = Window_Party_Select_Menber.new
- @status_window = Window_Party_Select_Menber_Status.new
- @status_window.opacity = 0
- @status_window.z += 0
- @show_index = 0
- status_window_position
- @status_window.refresh(@main_window.menber)
- @status_window.visible = true
- @show_index = @main_window.index
- # トランジション実行
- Graphics.transition
- # メインループ
- loop do
- # ゲーム画面を更新
- Graphics.update
- # 入力情報を更新
- Input.update
- # フレーム更新
- update
- # 画面が切り替わったらループを中断
- if $scene != self
- break
- end
- end
- # トランジション準備
- Graphics.freeze
- # ウィンドウを解放
- @background.dispose
- @main_window.dispose
- @menber_window.dispose
- @status_window.dispose
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- def update
- # コマンドウィンドウを更新
- @background.update
- @main_window.update
- if @status_window.visible and @show_index != @main_window.index
- status_window_position
- @status_window.refresh(@main_window.menber)
- @show_index = @main_window.index
- end
- # B ボタンが押された場合
- if Input.trigger?(Input::B)
- if $game_party.actors.size < 1
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # キャンセル SE を演奏
- $game_system.se_play($data_system.cancel_se)
- # メニュー画面に切り替え
- $scene = Scene_Menu.new(5)
- return
- end
- # C ボタンが押された場合
- if Input.trigger?(Input::C)
- # 選択したアクターが強制加入アクターの場合入れ替え不可
- if $game_party.actors.include?(@main_window.menber)
- $game_party.remove_actor(@main_window.menber.id)
- else
- if $game_party.actors.size == $game_party.party_max
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_party.add_actor(@main_window.menber.id)
- end
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- @main_window.refresh
- @menber_window.refresh
- return
- end
- # A ボタンが押された場合
- #if Input.trigger?(Input::A)
- # 決定 SE を演奏
- #$game_system.se_play($data_system.decision_se)
- #if @status_window.visible
- #@status_window.visible = false
- #else
- #status_window_position
- #@status_window.refresh(@main_window.menber)
- #@status_window.visible = true
- #@show_index = @main_window.index
- #end
- #return
- #end
- end
- def status_window_position
- if @main_window.cursor_rect.y < 176
- @status_window.y = 232
- else
- @status_window.y = 232
- end
- end
- end
-
复制代码 |
|