赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 10106 |
最后登录 | 2016-7-27 |
在线时间 | 158 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 158 小时
- 注册时间
- 2016-1-7
- 帖子
- 129
|
2楼
楼主 |
发表于 2016-3-8 02:52:37
|
只看该作者
我就是,讓問題浮上來下求個解不是想賺經驗和發廢文QQ
然後補上面片段的整個腳本,就不讓大家輾轉透過連結去看了(因為連結裡的腳本還不是現在更動的那樣)。
上面的片段是在 229~240- #==============================================================================
- #----------人物選擇 1.00版----------#
- #─版權屬於Agoの軌道物語和RM咖啡館(先行者)所有─
- #Agoの軌道物語:https://sites.google.com/site/agonoguidaowuyu
- #RM咖啡館:https://sites.google.com/site/hoctorrmfactory
- #--------------------------------------------------------------------------
- # 可用來作為遊戲一開始的角色選擇和劇情分歧時的角色選擇,
- # 爲了不讓FPS下滑,所以幾乎都是在Scene場景類描繪,
- # 其實效果滿陽春的,自己可以操作看看。
- #--------------------------------------------------------------------------
- #Agoの軌道物語:https://sites.google.com/site/agonoguidaowuyu
- #RM咖啡館:https://sites.google.com/site/hoctorrmfactory
- #─版權屬於Agoの軌道物語和RM咖啡館(先行者)所有─
- #----------人物選擇 1.00版----------#
- #==============================================================================
- #--------------------------------------------------------------------------
- # ● 人物選擇自定義區
- #--------------------------------------------------------------------------
- # 設定參與選擇的角色ID,最多為四人
- ## 參考: 資料庫 >> 角色
- ACTORS = [1,2]
- # 顯示選擇角色的圖像,0為行走圖、1為戰鬥圖、2為自定義
- PICTRUE = 1
-
- # 角色說明,格式為ACTORS_HELP[角色ID] = "字串"
- ACTORS_HELP = [] # 初始化角色說明
- ACTORS_HELP[1] = "男"
- ACTORS_HELP[2] = "女"
- # 設定說明字串的大小
- ACTORS_HELP_FONT_SIZE = 18
-
- # 顯示背景,0為地圖、1為自定義
- BACK = 0
- # 若使用自訂義時設定圖片路徑
- #BACK_PICTRUE = RPG::Cache.picture("人物選擇[背景]")
- #==============================================================================
- class Scene_SelectActor_Start
- #--------------------------------------------------------------------------
- # ● 初始化目標
- # menu_index : 命令游標的初期位置
- #--------------------------------------------------------------------------
- def initialize(select_actor_index = 0)
- @select_actor_index = select_actor_index
- end
- #--------------------------------------------------------------------------
- # ● 主處理
- #--------------------------------------------------------------------------
- def main
- @actors_index = 0 # 初始化選項
- @pictrues = [] # 初始化圖像
- @actors_pic = [] # 初始化立繪
- @actors_help = [] # 初始化角色名稱
- # 描繪角色說明的外框
- @help = Sprite.new
- @help.bitmap = Bitmap.new(640,480)
- @help.y = 412
- @help.z = 9998
- for i in 0...164
- @help.bitmap.fill_rect(i*2,0,2,1,Color.new(255,255,255,5*i))
- @help.bitmap.fill_rect(652-i*2,0,2,1,Color.new(255,255,255,5*i))
- @help.bitmap.fill_rect(i*2,39,2,1,Color.new(255,255,255,5*i))
- @help.bitmap.fill_rect(652-i*2,39,2,1,Color.new(255,255,255,5*i))
- @help.bitmap.fill_rect(i*2,1,2,37,Color.new(0,0,0,5*i))
- @help.bitmap.fill_rect(652-i*2,1,2,37,Color.new(0,0,0,5*i))
- end
- # 判定BACK的數值做背景的描繪
- if BACK == 0
- @back = Spriteset_Map.new
- elsif BACK == 1
- @back = RPG::Sprite.new
- @back.bitmap = BACK_PICTRUE
- end
- # 初始化說明視窗
- @help_window = Window_Help.new
- @help_window.x = 0
- @help_window.y = 400
- @help_window.width = 640
- @help_window.z = 9999
- @help_window.opacity = 0
- @help_window.back_opacity = 0
- @help_window.contents.font.size = ACTORS_HELP_FONT_SIZE
- # 讀取使用者所設定的角色
- for i in 0...ACTORS.size
- # 處理角色名字顯示
- actor = $game_actors[ACTORS[i]]
- @actors_help[i] = RPG::Sprite.new
- @actors_help[i].bitmap = Bitmap.new(640,480)
- @actors_help[i].x = i * 160
- for c in 0...180
- @actors_help[i].bitmap.fill_rect(i, c*1,160 ,3 ,Color.new(0,0,0,255-c*1.5))
- @actors_help[i].bitmap.fill_rect(i, 300+c*1,160 ,3 ,Color.new(0,0,0,c*2))
- end
- @actors_help[i].z = 999
- @actors_help[i].bitmap.draw_text(0, 10,120, 32, actor.name, 2)
- # 偵測角色的圖像為何
- case PICTRUE
- # 設定的角色圖像為行走圖時
- when 0
- # 處理角色行走圖的內容
- @pictrues[i] = RPG::Sprite.new
- @pictrues[i].bitmap = Bitmap.new(640,480)
- bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
- @pictrues[i].bitmap.blt(75+i*160,230,bitmap,Rect.new(0,0,bitmap.width/4,bitmap.height/4),255)
- for b in 0...240
- @pictrues[i].bitmap.fill_rect(9+i*160,b*1,1,2,Color.new(255,255,255,b*5))
- @pictrues[i].bitmap.fill_rect(9+i*160,480-b*1,1,2,Color.new(255,255,255,b*5))
- @pictrues[i].bitmap.fill_rect(170+i*160,b*1,1,2,Color.new(255,255,255,b*5))
- @pictrues[i].bitmap.fill_rect(170+i*160,480-b*1,1,2,Color.new(255,255,255,b*5))
- end
- # 設定的角色圖像為戰鬥圖時
- when 1
- # 處理角色戰鬥圖的內容
- @pictrues[i] = RPG::Sprite.new
- @pictrues[i].bitmap = Bitmap.new(640,480)
- bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
- @pictrues[i].bitmap.blt(30+i*175,160,bitmap,Rect.new(0,0,bitmap.width,bitmap.height),255)
- for b in 0...240
- @pictrues[i].bitmap.fill_rect(9+i*160,b*1,1,2,Color.new(255,255,255,b*5))
- @pictrues[i].bitmap.fill_rect(9+i*160,480-b*1,1,2,Color.new(255,255,255,b*5))
- @pictrues[i].bitmap.fill_rect(170+i*160,b*1,1,2,Color.new(255,255,255,b*5))
- @pictrues[i].bitmap.fill_rect(170+i*160,480-b*1,1,2,Color.new(255,255,255,b*5))
- end
- # 設定的角色圖像為自定義時
- when 2
- # 處理角色自定義圖形的內容
- @pictrues[i] = RPG::Sprite.new
- @pictrues[i].bitmap = Bitmap.new(640,480)
- @pictrues[i].opacity = 100
- bitmap = RPG::Cache.picture(actor.name.to_s+"I")
- @pictrues[i].bitmap.blt(i*160,30,bitmap,Rect.new(0,0,bitmap.width,bitmap.height),255)
- for b in 0...240
- @pictrues[i].bitmap.fill_rect(i*160,b*1,1,2,Color.new(255,255,255,b*5))
- @pictrues[i].bitmap.fill_rect(i*160,480-b*1,1,2,Color.new(255,255,255,b*5))
- @pictrues[i].bitmap.fill_rect(160+i*160,b*1,1,2,Color.new(255,255,255,b*5))
- @pictrues[i].bitmap.fill_rect(160+i*160,480-b*1,1,2,Color.new(255,255,255,b*5))
- end
- # 處理角色人數若未超過 3 時的立繪
- @actors_pic[i] = RPG::Sprite.new
- @actors_pic[i].bitmap = Bitmap.new(640,480)
- bitmap = RPG::Cache.picture(actor.name.to_s)
- @actors_pic[i].bitmap.blt(i*160,30,bitmap,Rect.new(0,0,bitmap.width,bitmap.height),255)
- @actors_pic[i].x = 1200
- @actors_pic[i].y = 250
- @actors_pic[i].ox = @actors_pic[i].bitmap.width / 2
- @actors_pic[i].oy = @actors_pic[i].bitmap.height / 2
- end
- end
- # 執行過渡
- Graphics.transition
- # 主循環
- loop do
- # 更新遊戲畫面
- Graphics.update
- # 更新輸入訊息
- Input.update
- # 更新畫面
- update
- # 如果切換畫面就中斷循環
- if $scene != self
- break
- end
- end
- # 準備過渡
- Graphics.freeze
- # 釋放角色相關圖形
- for i in 0...ACTORS.size
- @actors_help[i].dispose
- @actors_help[i].bitmap.dispose
- @pictrues[i].dispose
- @pictrues[i].bitmap.dispose
- if PICTRUE == 2
- @actors_pic[i].dispose
- @actors_pic[i].bitmap.dispose
- end
- end
- # 釋放背景
- @back.dispose
- # 釋放說明視窗
- @help_window.dispose
- # 釋放描繪說明視窗圖形
- @help.dispose
- end
- #--------------------------------------------------------------------------
- # ● 更新畫面
- #--------------------------------------------------------------------------
- def update
- # 更新選項
- command_index
- # 更新說明視窗
- @help_window_update
- actor_id = ACTORS[@actors_index]
- # 沒被選中的角色
- unchose_actor_id = 0
- text = ACTORS_HELP[actor_id].to_s
- @help_window.set_text(text,1) if text != nil
- # 如果按上的情況
- if Input.trigger?(Input::C)
- # 播放確定音效
- $game_system.se_play($data_system.decision_se)
- # 讀取角色
- for i in 0...$game_party.actors.size
- id = $game_party.actors[i].id
-
- # 判斷選定角色id用以判斷 unchose_actor_id
- case i
- when 0
- unchose_actor_id = $game_party.actors[1].id
- when 1
- unchose_actor_id = $game_party.actors[0].id
- end
-
- actors_id = [] if actors_id == nil
- actors_id.push(id)
- end
- # 刪除角色
- #actors_id.each do |i|
- #$game_party.remove_actor(i)
- #end
- # 加入選擇的角色
- id = ACTORS[@actors_index]
- $game_party.add_actor(id)
-
- # 用來存放角色名字提供對話事件使用,51是日常,52是全名
- case id
- when 1 #阿萊查
- $game_variables[51] = 3
- $game_variables[52] = 1
- $game_variables[53] = "阿萊查‧尤雅波"
- $game_variables[54] = "立繪_阿萊查"
- when 2 #亞藍娃
- $game_variables[51] = 4
- $game_variables[52] = 2
- $game_variables[53] = "亞藍娃‧尤雅波"
- $game_variables[54] = "立繪_亞藍娃"
- end
-
-
- # 刪除另一隻主角
- $game_party.remove_actor(unchose_actor_id)
-
- $scene = Scene_Map.new
- end
- # 判定是否使用自訂角色圖
- if PICTRUE == 2
- # 如果角色人數小於 3 時
- if ACTORS.size < 3
- # 讀取選項
- case @actors_index
- when 0
- @actors_pic[0].x -= 20 if @actors_pic[0].x != 600
- @actors_pic[0].x = 600 if @actors_pic[0].x < 600
- @actors_pic[0].opacity += 30
- @actors_pic[1].x += 20 if @actors_pic[1].x != 1200
- @actors_pic[1].x = 1200 if @actors_pic[1].x > 1200
- @actors_pic[1].opacity -= 30
- when 1
- @actors_pic[1].x -= 20 if @actors_pic[1].x != 450
- @actors_pic[1].x = 450 if @actors_pic[1].x < 450
- @actors_pic[1].opacity += 30
- @actors_pic[0].x += 20 if @actors_pic[0].x != 1200
- @actors_pic[0].x = 1200 if @actors_pic[0].x > 1200
- @actors_pic[0].opacity -= 30
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 更新選項
- #--------------------------------------------------------------------------
- def command_index
- # 如果按取消時
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 切換到地圖畫面
- $scene = Scene_Map.new
- return
- end
- case ACTORS.size
- when 1
- @actors_index = 0
- when 2
- # 如果按←時
- if Input.trigger?(Input::LEFT)
- @actors_index -= 1
- if @actors_index < 0
- @actors_index = 1
- end
- $game_system.se_play($data_system.cursor_se)
- end
- # 如果按→時
- if Input.trigger?(Input::RIGHT)
- @actors_index += 1
- if @actors_index > 1
- @actors_index = 0
- end
- $game_system.se_play($data_system.cursor_se)
- end
- when 3
- # 如果按←時
- if Input.trigger?(Input::LEFT)
- @actors_index -= 1
- if @actors_index < 0
- @actors_index = 2
- end
- $game_system.se_play($data_system.cursor_se)
- end
- # 如果按→時
- if Input.trigger?(Input::RIGHT)
- @actors_index += 1
- if @actors_index > 2
- @actors_index = 0
- end
- $game_system.se_play($data_system.cursor_se)
- end
- when 4
- # 如果按←時
- if Input.trigger?(Input::LEFT)
- @actors_index -= 1
- if @actors_index < 0
- @actors_index = 3
- end
- $game_system.se_play($data_system.cursor_se)
- end
- # 如果按→時
- if Input.trigger?(Input::RIGHT)
- @actors_index += 1
- if @actors_index > 3
- @actors_index = 0
- end
- $game_system.se_play($data_system.cursor_se)
- end
- end
- case @actors_index
- when 0
- @pictrues[0].opacity = 255
- @pictrues[1].opacity = 100
- if ACTORS.size == 3
- @pictrues[2].opacity = 100
- elsif ACTORS.size == 4
- @pictrues[2].opacity = 100
- @pictrues[3].opacity = 100
- end
- when 1
- @pictrues[0].opacity = 100
- @pictrues[1].opacity = 255
- if ACTORS.size == 3
- @pictrues[2].opacity = 100
- elsif ACTORS.size == 4
- @pictrues[2].opacity = 100
- @pictrues[3].opacity = 100
- end
- when 2
- @pictrues[0].opacity = 100
- @pictrues[1].opacity = 100
- @pictrues[2].opacity = 255
- if ACTORS.size == 4
- @pictrues[3].opacity = 100
- end
- when 3
- @pictrues[0].opacity = 100
- @pictrues[1].opacity = 100
- @pictrues[2].opacity = 100
- @pictrues[3].opacity = 255
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 處理要選擇的人數大於 4 時
- #--------------------------------------------------------------------------
- if ACTORS.size > 4
- print "不好意思,本腳本設定的人數大於4,請刪除人數為5以下"
- exit
- end
复制代码 |
|