Project1
标题:
自製選項窗口出現"Game.exe發生問題"該如何解決?
[打印本页]
作者:
nuitjean
时间:
2010-8-3 22:24
标题:
自製選項窗口出現"Game.exe發生問題"該如何解決?
本帖最后由 nuitjean 于 2010-8-4 11:19 编辑
選項窗口腳本
class Window_Choice < Window_Base
#快速定義2個名為index方法
attr_accessor :index
def initialize
#窗口(X座標, Y座標, 寬度, 高度) #資料庫變數"選項Max+1"
super(640/2-16-(25 *$game_variables[15]/2), 480/2-16 - (($game_variables[8] + 2)*32 / 2), 25 *$game_variables[15], ($game_variables[8] + 2)*32 )
self.contents = Bitmap.new(width - 32, height - 32)
#窗口不透明度 #不透明度
self.opacity = 0
#背景生成
#@sprite = Sprite.new
#@sprite.bitmap = RPG::Cache.picture("Menu-back")
#
#背景生成(以地圖當背景
@mapbg = Spriteset_Map.new
#定義名為index的實例變量代入數值0
@index = 0
#呼叫這個方法來顯示游標
refresh
end
#定義update_cursor_rect方法
def refresh
self.contents.clear
self.contents.font.color = normal_color #資料庫變數"選項1內容" #靠邊 0左邊1中央2右邊
self.contents.draw_text(0, 0, 160, 32, $game_variables[9] , 1)
self.contents.draw_text(0, 32, 160, 32, $game_variables[10] , 1)
if $game_variables[8] >= 2
self.contents.draw_text(0, 64, 160, 32, $game_variables[11] , 1)
end
if $game_variables[8] >= 3
self.contents.draw_text(0, 96, 160, 32, $game_variables[12] , 1)
end
if $game_variables[8] >= 4
self.contents.draw_text(0, 128, 160, 32, $game_variables[13] , 1)
end
if $game_variables[8] >= 5
self.contents.draw_text(0, 160, 160, 32, $game_variables[14] , 1)
end
#呼叫這個方法來顯示游標
update_cursor_rect
end
#定義update_cursor_rect方法
def update_cursor_rect
#(X座標, Y座標, 寬度, 高度)
self.cursor_rect.set(0, 32 * @index, 20 *$game_variables[15] , 32)
end
end
复制代码
選項腳本
class Scene_Choice
def main
@sword_window = Window_Choice.new
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@sword_window.dispose
end
def update
#更新選項游標
@sword_window.update
#條件分歧:當'按鍵 上'被按下時執行的場合
if Input.trigger?(Input::UP)
#當選項位置(@index) 等於 0(第1個選項)的場合時
if @sword_window.index == 0
#按下 上鍵 回到最後的選項
@sword_window.index = $game_variables[8]
else
@sword_window.index -= 1
Audio.se_play("Audio/SE/" + "001-System01", 100, 100)
end
#這個是當在第1個選項時按下上鍵時執行的內容...
@sword_window.update_cursor_rect
end
#條件分歧:當'按鍵 下'被按下時執行的場合
if Input.trigger?(Input::DOWN)
#當選項位置(@index) 等於 3(第3個選項)的場合時
if @sword_window.index == $game_variables[8]
#按下 下鍵 回到最初的選項
@sword_window.index = 0
else
@sword_window.index += 1
Audio.se_play("Audio/SE/" + "001-System01", 100, 100)
end
#這個是當在最後選項時按下下鍵時執行的內容...
@sword_window.update_cursor_rect
end
if Input.trigger?(Input::C)
case @sword_window.index
when 0
#p '你選擇了選項1'
$game_variables[8] = 1
$game_map.events[$game_variables[15]].start
$scene = Scene_Map.new
when 1
#p '你選擇了選項2'
$game_variables[8] = 2
when 2
if $game_variables[8] >= 2
$game_variables[8] = 3
#執行地圖事件
#$game_map.events[$game_variables[15]].start
#回到地圖
#$scene = Scene_Map.new
end
when 3
if $game_variables[8] >= 3
$game_variables[8] = 4
end
when 4
if $game_variables[8] >= 4
$game_variables[8] = 5
end
when 5
if $game_variables[8] >= 5
$game_variables[8] = 6
end
end
Audio.se_play("Audio/SE/" + "002-System02", 100, 100)
end
end
end
复制代码
事件設置
執行事件後,選擇第1個選項就出現
Game.exe發生問題
而強制關閉了......
請問該如何解決此問題呢?
作者:
zhixin1997
时间:
2010-8-4 09:17
您检查下“脚本编辑器”里脚本是否过多
或者是当前的脚本拼写哪里出错了?
作者:
nuitjean
时间:
2010-8-4 11:18
回复
zhixin1997
的帖子
謝謝.
我找到了...是這句出了問題
$game_map.events[$game_variables[15]].start
改成
i = 1
$game_map.events
.start
就ok了!
不過會和66rpg的真‧對話加強腳本1.12版沖突......
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1