Sujet n°378
Posté par
rinoukiji le
20 Fév - 00:49 (2008)Titre :
ok - problem aux demarage du jeubon voila j'ai un probleme voila ce ke sa m'affiche kan je lance un teste de mon jeu
scripte secne_map ne fonctionne pas en 296 a la ligne nomethoderror undefinied methode 'name' for nil /nilclass
Posté par
Speed le
20 Fév - 01:05 (2008)Tu es sûr de ça ? Car les deux scripts Scene_Map s'arrêtent avant la ligne 296... Tu peux montrer un screen s'il te plaît ?
Posté par
rinoukiji le
20 Fév - 01:30 (2008)oui je suis sur mais tu peut me donner ton scripte car enfaite maintenant j'ai un autre problem c'est avec le scripte map link apres ca devien autre chose c parceque j'ai ajouter des scripte pour mettre les pannaue en haut a gauche
code scene_map :
#==============================================================================
# ■ Scene_Map
#------------------------------------------------------------------------------
# マップ画面の処理を行うクラスです。
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
# スプライトセットを作成
@spriteset = Spriteset_Map.new
# メッセージウィンドウを作成
attr_accessor :board
@message_window = Window_Message.new
# トランジション実行
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# スプライトセットを解放
@spriteset.dispose
# メッセージウィンドウを解放
@message_window.dispose
# タイトル画面に切り替え中の場合
if $scene.is_a?(Scene_Title)
# 画面をフェードアウト
Graphics.transition
Graphics.freeze
end
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# ループ
loop do
# マップ、インタプリタ、プレイヤーの順に更新
# (この更新順序は、イベントを実行する条件が満たされているときに
# プレイヤーに一瞬移動する機会を与えないなどの理由で重要)
$game_map.update
$game_system.map_interpreter.update
$game_player.update
# システム (タイマー)、画面を更新
$game_system.update
$game_screen.update
# プレイヤーの場所移動中でなければループを中断
unless $game_temp.player_transferring
break
end
# 場所移動を実行
transfer_player
# トランジション処理中の場合、ループを中断
if $game_temp.transition_processing
break
end
end
# スプライトセットを更新
@spriteset.update
# メッセージウィンドウを更新
@message_window.update
# ゲームオーバーの場合
if $game_temp.gameover
# ゲームオーバー画面に切り替え
$scene = Scene_Gameover.new
return
end
# タイトル画面に戻す場合
if $game_temp.to_title
# タイトル画面に切り替え
$scene = Scene_Title.new
return
end
# トランジション処理中の場合
if $game_temp.transition_processing
# トランジション処理中フラグをクリア
$game_temp.transition_processing = false
# トランジション実行
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# メッセージウィンドウ表示中の場合
if $game_temp.message_window_showing
return
end
# エンカウント カウントが 0 で、エンカウントリストが空ではない場合
if $game_player.encounter_count == 0 and $game_map.encounter_list != []
# イベント実行中かエンカウント禁止中でなければ
unless $game_system.map_interpreter.running? or
$game_system.encounter_disabled
# トループを決定
n = rand($game_map.encounter_list.size)
troop_id = $game_map.encounter_list[n]
# トループが有効なら
if $data_troops[troop_id] != nil
# バトル呼び出しフラグをセット
$game_temp.battle_calling = true
$game_temp.battle_troop_id = troop_id
$game_temp.battle_can_escape = true
$game_temp.battle_can_lose = false
$game_temp.battle_proc = nil
end
end
end
# B ボタンが押された場合
if Input.trigger?(Input::B)
# イベント実行中かメニュー禁止中でなければ
unless $game_system.map_interpreter.running? or
$game_system.menu_disabled
# メニュー呼び出しフラグと SE 演奏フラグをセット
$game_temp.menu_calling = true
$game_temp.menu_beep = true
end
end
# デバッグモードが ON かつ F9 キーが押されている場合
if $DEBUG and Input.press?(Input::F9)
# デバッグ呼び出しフラグをセット
$game_temp.debug_calling = true
end
# プレイヤーの移動中ではない場合
unless $game_player.moving?
# 各種画面の呼び出しを実行
if $game_temp.battle_calling
call_battle
elsif $game_temp.shop_calling
call_shop
elsif $game_temp.name_calling
call_name
elsif $game_temp.menu_calling
call_menu
elsif $game_temp.save_calling
call_save
elsif $game_temp.debug_calling
call_debug
end
end
end
#--------------------------------------------------------------------------
# ● バトルの呼び出し
#--------------------------------------------------------------------------
def call_battle
# バトル呼び出しフラグをクリア
$game_temp.battle_calling = false
# メニュー呼び出しフラグをクリア
$game_temp.menu_calling = false
$game_temp.menu_beep = false
# エンカウント カウントを作成
$game_player.make_encounter_count
# マップ BGM を記憶し、BGM を停止
$game_temp.map_bgm = $game_system.playing_bgm
$game_system.bgm_stop
# バトル開始 SE を演奏
$game_system.se_play($data_system.battle_start_se)
# バトル BGM を演奏
$game_system.bgm_play($game_system.battle_bgm)
# プレイヤーの姿勢を矯正
$game_player.straighten
# バトル画面に切り替え
$scene = Scene_Battle.new
end
#--------------------------------------------------------------------------
# ● ショップの呼び出し
#--------------------------------------------------------------------------
def call_shop
# ショップ呼び出しフラグをクリア
$game_temp.shop_calling = false
# プレイヤーの姿勢を矯正
$game_player.straighten
# ショップ画面に切り替え
$scene = Scene_Shop.new
end
#--------------------------------------------------------------------------
# ● 名前入力の呼び出し
#--------------------------------------------------------------------------
def call_name
# 名前入力呼び出しフラグをクリア
$game_temp.name_calling = false
# プレイヤーの姿勢を矯正
$game_player.straighten
# 名前入力画面に切り替え
$scene = Scene_Name.new
end
#--------------------------------------------------------------------------
# ● メニューの呼び出し
#--------------------------------------------------------------------------
def call_menu
# メニュー呼び出しフラグをクリア
$game_temp.menu_calling = false
# メニュー SE 演奏フラグがセットされている場合
if $game_temp.menu_beep
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# メニュー SE 演奏フラグをクリア
$game_temp.menu_beep = false
end
# プレイヤーの姿勢を矯正
$game_player.straighten
# メニュー画面に切り替え
$scene = Scene_Menu.new
end
#--------------------------------------------------------------------------
# ● セーブの呼び出し
#--------------------------------------------------------------------------
def call_save
# プレイヤーの姿勢を矯正
$game_player.straighten
# セーブ画面に切り替え
$scene = Scene_Save.new
end
#--------------------------------------------------------------------------
# ● デバッグの呼び出し
#--------------------------------------------------------------------------
def call_debug
# デバッグ呼び出しフラグをクリア
$game_temp.debug_calling = false
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# プレイヤーの姿勢を矯正
$game_player.straighten
# デバッグ画面に切り替え
$scene = Scene_Debug.new
end
#--------------------------------------------------------------------------
# ● プレイヤーの場所移動
#--------------------------------------------------------------------------
def transfer_player
# プレイヤー場所移動フラグをクリア
$game_temp.player_transferring = false
# 移動先が現在のマップと異なる場合
if $game_map.map_id != $game_temp.player_new_map_id
# 新しいマップをセットアップ
$game_map.setup($game_temp.player_new_map_id)
end
# プレイヤーの位置を設定
$game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
# プレイヤーの向きを設定
case $game_temp.player_new_direction
when 2 # 下
$game_player.turn_down
when 4 # 左
$game_player.turn_left
when 6 # 右
$game_player.turn_right
when 8 # 上
$game_player.turn_up
end
# プレイヤーの姿勢を矯正
$game_player.straighten
# マップを更新 (並列イベント実行)
$game_map.update
# スプライトセットを再作成
@spriteset.dispose
@spriteset = Spriteset_Map.new
# トランジション処理中の場合
if $game_temp.transition_processing
# トランジション処理中フラグをクリア
$game_temp.transition_processing = false
# トランジション実行
Graphics.transition(20)
end
# マップに設定されている BGM と BGS の自動切り替えを実行
$game_map.autoplay
if FileTest.exist?("Data/data_zone.txt")
$data_zone = []
file = File.open("Data/data_zone.txt", "rb")
file.readchar
file.readchar
file.readchar
file.each {|line| eval(line) }
file.close
end
map_tag = $game_map.name
data = (map_tag.split('/'))[0].to_s
map_tag = data.to_s
if map_tag.include?("[")
map_tag = (map_tag.split('['))[1].to_s
map_tag = (map_tag.split(']'))[0].to_s
map_tag = map_tag.to_i
string = $data_zone[map_tag][0]
picture = $data_zone[map_tag][1]
@board = Window_Base.new(0, 0, 250, 150)
@board.contents = Bitmap.new("Graphics/Pictures/" + picture)
@board.contents.font.name = $fontface
@board.contents.font.size = $fontsize
@board.contents.font.color = Color.new(0,0,0,255)
@board.contents.draw_text(23, 32, 160, 32, string, 1)
@board.visible = true
@board.z = 9998
@board.opacity = 0
@board.contents_opacity = 255
$game_screen.set_board_duration(80)
end
# フレームリセット
Graphics.frame_reset
# 入力情報を更新
Input.update
end
end
ca va jusqua la ligne 316
Posté par
Speed le
20 Fév - 01:41 (2008)Ha, si tu as rajouté le truc des panneaux, faudrait voir ça avec Sphinx ^^
Mon script :
Code: |
#============================================================================== # ■ Scene_Map #------------------------------------------------------------------------------ # マップ画面の処理を行うクラスです。 #==============================================================================
class Scene_Map #-------------------------------------------------------------------------- # ● メイン処理 #-------------------------------------------------------------------------- def main # スプライトセットを作成 @spriteset = Spriteset_Map.new # メッセージウィンドウを作成 @message_window = Window_Message.new # トランジション実行 Graphics.transition # メインループ loop do # ゲーム画面を更新 Graphics.update # 入力情報を更新 Input.update # フレーム更新 update # 画面が切り替わったらループを中断 if $scene != self break end end # トランジション準備 Graphics.freeze # スプライトセットを解放 @spriteset.dispose # メッセージウィンドウを解放 @message_window.dispose # タイトル画面に切り替え中の場合 if $scene.is_a?(Scene_Title) # 画面をフェードアウト Graphics.transition Graphics.freeze end end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update # ループ loop do # マップ、インタプリタ、プレイヤーの順に更新 # (この更新順序は、イベントを実行する条件が満たされているときに # プレイヤーに一瞬移動する機会を与えないなどの理由で重要) $game_map.update $game_system.map_interpreter.update $game_player.update # システム (タイマー)、画面を更新 $game_system.update $game_screen.update # プレイヤーの場所移動中でなければループを中断 unless $game_temp.player_transferring break end # 場所移動を実行 transfer_player # トランジション処理中の場合、ループを中断 if $game_temp.transition_processing break end end # スプライトセットを更新 @spriteset.update # メッセージウィンドウを更新 @message_window.update # ゲームオーバーの場合 if $game_temp.gameover # ゲームオーバー画面に切り替え $scene = Scene_Gameover.new return end # タイトル画面に戻す場合 if $game_temp.to_title # タイトル画面に切り替え $scene = Scene_Title.new return end # トランジション処理中の場合 if $game_temp.transition_processing # トランジション処理中フラグをクリア $game_temp.transition_processing = false # トランジション実行 if $game_temp.transition_name == "" Graphics.transition(20) else Graphics.transition(40, "Graphics/Transitions/" + $game_temp.transition_name) end end # メッセージウィンドウ表示中の場合 if $game_temp.message_window_showing return end # エンカウント カウントが 0 で、エンカウントリストが空ではない場合 if $game_player.encounter_count == 0 and $game_map.encounter_list != [] # イベント実行中かエンカウント禁止中でなければ unless $game_system.map_interpreter.running? or $game_system.encounter_disabled # トループを決定 n = rand($game_map.encounter_list.size) troop_id = $game_map.encounter_list[n] # トループが有効なら if $data_troops[troop_id] != nil # バトル呼び出しフラグをセット $game_temp.battle_calling = true $game_temp.battle_troop_id = troop_id $game_temp.battle_can_escape = true $game_temp.battle_can_lose = false $game_temp.battle_proc = nil end end end # B ボタンが押された場合 if Input.trigger?(Input::B) # イベント実行中かメニュー禁止中でなければ unless $game_system.map_interpreter.running? or $game_system.menu_disabled # メニュー呼び出しフラグと SE 演奏フラグをセット $game_temp.menu_calling = true $game_temp.menu_beep = true end end # デバッグモードが ON かつ F9 キーが押されている場合 if $DEBUG and Input.press?(Input::F9) # デバッグ呼び出しフラグをセット $game_temp.debug_calling = true end # プレイヤーの移動中ではない場合 unless $game_player.moving? # 各種画面の呼び出しを実行 if $game_temp.battle_calling call_battle elsif $game_temp.shop_calling call_shop elsif $game_temp.name_calling call_name elsif $game_temp.menu_calling call_menu elsif $game_temp.save_calling call_save elsif $game_temp.debug_calling call_debug end end end #-------------------------------------------------------------------------- # ● バトルの呼び出し #-------------------------------------------------------------------------- def call_battle # バトル呼び出しフラグをクリア $game_temp.battle_calling = false # メニュー呼び出しフラグをクリア $game_temp.menu_calling = false $game_temp.menu_beep = false # エンカウント カウントを作成 $game_player.make_encounter_count # マップ BGM を記憶し、BGM を停止 $game_temp.map_bgm = $game_system.playing_bgm $game_system.bgm_stop # バトル開始 SE を演奏 $game_system.se_play($data_system.battle_start_se) # バトル BGM を演奏 $game_system.bgm_play($game_system.battle_bgm) # プレイヤーの姿勢を矯正 $game_player.straighten # バトル画面に切り替え $scene = Scene_Battle.new end #-------------------------------------------------------------------------- # ● ショップの呼び出し #-------------------------------------------------------------------------- def call_shop # ショップ呼び出しフラグをクリア $game_temp.shop_calling = false # プレイヤーの姿勢を矯正 $game_player.straighten # ショップ画面に切り替え $scene = Scene_Shop.new end #-------------------------------------------------------------------------- # ● 名前入力の呼び出し #-------------------------------------------------------------------------- def call_name # 名前入力呼び出しフラグをクリア $game_temp.name_calling = false # プレイヤーの姿勢を矯正 $game_player.straighten # 名前入力画面に切り替え $scene = Scene_Name.new end #-------------------------------------------------------------------------- # ● メニューの呼び出し #-------------------------------------------------------------------------- def call_menu # メニュー呼び出しフラグをクリア $game_temp.menu_calling = false # メニュー SE 演奏フラグがセットされている場合 if $game_temp.menu_beep # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # メニュー SE 演奏フラグをクリア $game_temp.menu_beep = false end # プレイヤーの姿勢を矯正 $game_player.straighten # メニュー画面に切り替え $scene = Scene_Menu.new end #-------------------------------------------------------------------------- # ● セーブの呼び出し #-------------------------------------------------------------------------- def call_save # プレイヤーの姿勢を矯正 $game_player.straighten # セーブ画面に切り替え $scene = Scene_Save.new end #-------------------------------------------------------------------------- # ● デバッグの呼び出し #-------------------------------------------------------------------------- def call_debug # デバッグ呼び出しフラグをクリア $game_temp.debug_calling = false # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # プレイヤーの姿勢を矯正 $game_player.straighten # デバッグ画面に切り替え $scene = Scene_Debug.new end #-------------------------------------------------------------------------- # ● プレイヤーの場所移動 #-------------------------------------------------------------------------- def transfer_player # プレイヤー場所移動フラグをクリア $game_temp.player_transferring = false # 移動先が現在のマップと異なる場合 if $game_map.map_id != $game_temp.player_new_map_id # 新しいマップをセットアップ $game_map.setup($game_temp.player_new_map_id) end # プレイヤーの位置を設定 $game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y) # プレイヤーの向きを設定 case $game_temp.player_new_direction when 2 # 下 $game_player.turn_down when 4 # 左 $game_player.turn_left when 6 # 右 $game_player.turn_right when 8 # 上 $game_player.turn_up end # プレイヤーの姿勢を矯正 $game_player.straighten # マップを更新 (並列イベント実行) $game_map.update # スプライトセットを再作成 @spriteset.dispose @spriteset = Spriteset_Map.new # トランジション処理中の場合 if $game_temp.transition_processing # トランジション処理中フラグをクリア $game_temp.transition_processing = false # トランジション実行 Graphics.transition(20) end # マップに設定されている BGM と BGS の自動切り替えを実行 $game_map.autoplay # フレームリセット Graphics.frame_reset # 入力情報を更新 Input.update end end
|
Posté par
rinoukiji le
20 Fév - 01:45 (2008)merci ouai mais marche pas alor j'attendrai un tit peu avant mais la j'ai prob avec le script maplink
Posté par
rinoukiji le
20 Fév - 01:49 (2008)tu pourrai me passer ton scripte game_ screen car c'est ke celui la ke j'ai modifier stp merci
Posté par
Sphinx le
20 Fév - 06:52 (2008)^^' les panneaux, c'est pas moi, c'est drakh ^^"
=> par contre, je peux tout de même te répondre, enfin je crois xD
tu as fait les ajouts dans le mauvais script Scene_Map ^^
par contre, je ne sais pas d'où viennent tes 30 lignes supplémentaires ^^' moi il ne fait que 285 lignes xD
Posté par
rinoukiji le
20 Fév - 09:15 (2008)a ok merci bocoup je vai pouvoire mettre des affichage sur mes map
Posté par
Speed le
20 Fév - 10:55 (2008)Sphinx >> Rah je me gourre tout le temps xD Y'a trois scripteurs : Louro, Drakh et toi, donc c'est dur de se souvenir ^^'
Posté par
Sphinx le
20 Fév - 13:49 (2008)@ speed : xD moi scripteur ? :shock: xD j'aimerais bien... les seuls "cours" d'initiation que g trouvé : en anglais ou en je ne sais trop quoi... xD (google n'a pas été un bon ami xD)
c'est louro qui m'a filé un coup de main pour la quasi totalité dmes modifs ^^
en scripteur : krosk (
évidement...) drakh et louro, mais c'est tout pour les scripteurs déclarés comme tel ici ^^ (enfin je crois
pardon aux éventuels oubliés)
Posté par
Speed le
20 Fév - 13:52 (2008)Rah, j'me gourre encore... Ca doit être las vacances, ça me réussit pas... >> Enfin bref.
Attendont donc Drakhaine qui pourra peut être nous éclairer sur ce problème.
Posté par
Drakhaine le
20 Fév - 14:48 (2008)Bah la méthode .name n'existe que pour $game_map et @board.contents.font ici, donc j'pense qu'il y a un problème avec l'un des deux...
Maintenant, si tu pouvais m'indiquer laquelle c'est la ligne 296 ça simplifierait les choses ^^'
EDIT :
Citation: |
tu pourrai me passer ton scripte game_ screen car c'est ke celui la ke j'ai modifier stp merci
|
Mais j'ai pas dit de le modifier celui-là !! oO
J'ai écris Créez un nouveau script...
Tiens, le Game_Screen de départ sans ta modif :
Code: |
#============================================================================== # ■ Game_Screen #------------------------------------------------------------------------------ # 色調変更やフラッシュなど、画面全体に関係する処理のデータを保持するクラスで # す。このクラスのインスタンスは $game_screen で参照されます。 #==============================================================================
class Game_Screen #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :tone # 色調 attr_reader :flash_color # フラッシュ色 attr_reader :shake # シェイク位置 attr_reader :pictures # ピクチャ attr_reader :weather_type # 天候 タイプ attr_reader :weather_max # 天候 画像の最大数 #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize @tone = Tone.new(0, 0, 0, 0) @tone_target = Tone.new(0, 0, 0, 0) @tone_duration = 0 @flash_color = Color.new(0, 0, 0, 0) @flash_duration = 0 @shake_power = 0 @shake_speed = 0 @shake_duration = 0 @shake_direction = 1 @shake = 0 @pictures = [nil] for i in 1..100 @pictures.push(Game_Picture.new(i)) end @weather_type = 0 @weather_max = 0.0 @weather_type_target = 0 @weather_max_target = 0.0 @weather_duration = 0 end #-------------------------------------------------------------------------- # ● 色調変更の開始 # tone : 色調 # duration : 時間 #-------------------------------------------------------------------------- def start_tone_change(tone, duration) @tone_target = tone.clone @tone_duration = duration if @tone_duration == 0 @tone = @tone_target.clone end end #-------------------------------------------------------------------------- # ● フラッシュの開始 # color : 色 # duration : 時間 #-------------------------------------------------------------------------- def start_flash(color, duration) @flash_color = color.clone @flash_duration = duration end #-------------------------------------------------------------------------- # ● シェイクの開始 # power : 強さ # speed : 速さ # duration : 時間 #-------------------------------------------------------------------------- def start_shake(power, speed, duration) @shake_power = power @shake_speed = speed @shake_duration = duration end #-------------------------------------------------------------------------- # ● 天候の設定 # type : タイプ # power : 強さ # duration : 時間 #-------------------------------------------------------------------------- def weather(type, power, duration) @weather_type_target = type if @weather_type_target != 0 @weather_type = @weather_type_target end if @weather_type_target == 0 @weather_max_target = 0.0 else @weather_max_target = (power + 1) * 4.0 end @weather_duration = duration if @weather_duration == 0 @weather_type = @weather_type_target @weather_max = @weather_max_target end end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update if @tone_duration >= 1 d = @tone_duration @tone.red = (@tone.red * (d - 1) + @tone_target.red) / d @tone.green = (@tone.green * (d - 1) + @tone_target.green) / d @tone.blue = (@tone.blue * (d - 1) + @tone_target.blue) / d @tone.gray = (@tone.gray * (d - 1) + @tone_target.gray) / d @tone_duration -= 1 end if @flash_duration >= 1 d = @flash_duration @flash_color.alpha = @flash_color.alpha * (d - 1) / d @flash_duration -= 1 end if @shake_duration >= 1 or @shake != 0 delta = (@shake_power * @shake_speed * @shake_direction) / 10.0 if @shake_duration <= 1 and @shake * (@shake + delta) < 0 @shake = 0 else @shake += delta end if @shake > @shake_power * 2 @shake_direction = -1 end if @shake < - @shake_power * 2 @shake_direction = 1 end if @shake_duration >= 1 @shake_duration -= 1 end end if @weather_duration >= 1 d = @weather_duration @weather_max = (@weather_max * (d - 1) + @weather_max_target) / d @weather_duration -= 1 if @weather_duration == 0 @weather_type = @weather_type_target end end if $game_temp.in_battle for i in 51..100 @pictures[i].update end else for i in 1..50 @pictures[i].update end end end end
|