Sujet n°12181
Posté par Fudo Fuyouki le 10 Nov - 21:50 (2012)
Titre : [Resolu]Bug dans le menu sur certaines maps
Bonjour

Je me sert de ce script : ./4476.html
cependant, dans mon jeu, les joueurs plantent dans les maps ajoutées pour la derniere version (Soit la route 9 et jusqu'a Celadopole) mais PAS avant

L'erreur est dans le script "Pokemon_menu" a la ligne 204

Spoiler
Citation:
#==============================================================================
# ■ Pokemon_Menu
# Pokemon Script Project - Krosk
# 18/07/07
# Modifier par Slash le 15/07/09
#-----------------------------------------------------------------------------
# Scène modifiable
#-----------------------------------------------------------------------------
# Menu principal accessible par échap
#-----------------------------------------------------------------------------

module POKEMON_S
class Pokemon_Menu
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------

def main
Graphics.freeze
@z_level = 10000
@background = Sprite.new
if $game_variables[1000] == 1 or 0
if $game_variables[3000] == 0
@background.bitmap = RPG::Cache.picture("MenuG.PNG")
elsif $game_variables[3000] == 1
@background.bitmap = RPG::Cache.picture("MenuG2.PNG")
end
end
if $game_variables[1000] == 2
if $game_variables[3000] == 0
@background.bitmap = RPG::Cache.picture("MenuF.PNG")
elsif $game_variables[3000] == 1
@background.bitmap = RPG::Cache.picture("MenuF2.PNG")
end
end
@background.x = 0
@background.y = 0
@background.z = @z_level
@location = Window_Location.new
@location.x = 0
@location.y = 394
@location.z = @z_level + 2
@location.opacity = 0
@argent = Window_Argent.new
@argent.x = 480
@argent.y = 424
@argent.z = @z_level + 2
@argent.opacity = 0
@pokemon = Window_Pokemon.new
@pokemon.x = -2
@pokemon.y = 0
@pokemon.z = @z_level + 2
@pokemon.opacity = 0
@spriteset = Spriteset_Map.new
s1 = " POKéDEX"
s2 = " POKéMON"
s3 = " SAC"
if $game_variables[3000] == 0
s4 = " ???"
elsif $game_variables[3000] == 1
s4 = " TRANSFER"
end
s5 = " " + Player.name
s6 = " SAUVER"
s7 = " QUITTER"
@command_window = Window_Command.new(180, [s1, s2, s3, s4, s5, s6, s7])
@command_window.index = @menu_index
@command_window.x = 467 - 3
@command_window.y = 105
@command_window.z = @z_level + 2
@command_window.opacity = 0

if $pokemon_party.size == 0
# Enlève accès Equipe
@command_window.disable_item(1)
end
if not($data_pokedex[0])
# Enlève accès Pokédex si non possédé
@command_window.disable_item(0)
end
if $game_system.save_disabled
@command_window.disable_item(4)
end

Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@pokemon.dispose
@location.dispose
@argent.dispose
@command_window.dispose
@background.dispose
@spriteset.dispose
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def update
# ウィンドウを更新
@command_window.update
@spriteset.update
# コマンドウィンドウがアクティブの場合: update_command を呼ぶ
if @command_window.active
update_command
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (コマンドウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_command
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# マップ画面に切り替え
$scene = Scene_Map.new
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# パーティ人数が 0 人で、セーブ、ゲーム終了以外のコマンドの場合
if $game_party.actors.size == 0 and @command_window.index < 4
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# コマンドウィンドウのカーソル位置で分岐
case @command_window.index
when 0 # Pokédex
if not($data_pokedex[0])
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = POKEMON_S::Pokemon_Pokedex.new
when 1 # Menu
if $pokemon_party.size == 0
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = POKEMON_S::Pokemon_Party_Menu.new
when 2 # Sac
$game_system.se_play($data_system.decision_se)
$scene = Pokemon_Item_Bag.new
when 3 # Carte
$game_system.se_play($data_system.decision_se)
if $game_variables[3000] == 1
$game_temp.common_event_id = 52
$scene = Scene_Map.new
end
when 4 # Carte dresseur
$game_system.se_play($data_system.decision_se)
#$game_temp.common_event_id = 19
$scene = Scene_T_Card.new
when 5 # Sauvegarde
if $game_system.save_disabled
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = POKEMON_S::Pokemon_Save.new
when 6 # Quitter le menu
$game_system.se_play($data_system.decision_se)
$scene = Scene_Map.new
end
return
end
end
end
end

#===================================================
#Window_Location
#===================================================

class Window_Location < Window_Base
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
refresh
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32,$data_mapzone[$game_map.map_id][1], 2)
end
end
#===================================================
#Window_Argent
#===================================================
class Window_Argent < Window_Base

#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
refresh
end

#--------------------------------------------------------------------------
def refresh
self.contents.clear
cx = contents.text_size($data_system.words.gold).width
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120-cx-2, 32, $pokemon_party.money.to_s + "$", 2)
end
end
#===================================================
#Window_Pokémon
#===================================================
class Window_Pokemon < Window_Base
#--------------------------------------------------------------------------
def initialize
super(0, 0, 470, 480)
self.contents = Bitmap.new(width - 0, height - 0)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
refresh
end

#--------------------------------------------------------------------------
def refresh

if $pokemon_party.size > 0
@order = [0,1,2,3,4,5]
self.contents.clear
cx = contents.text_size($data_system.words.gold).width
self.contents.font.color = normal_color
src_rect = Rect.new(0, 10, 64, 64)
for i in 0..($pokemon_party.size - 1)
@pokemon = $pokemon_party.actors[@order[i]]
if i < 3
if @pokemon.egg
self.contents.draw_text(56,64 + (i*106) , 120, 32,@pokemon.given_name )
else
self.contents.draw_text(56,64 + (i*106) , 120, 32,@pokemon.given_name )
self.contents.draw_text(62,95 + (i*106) , 120, 32,"Nv " + @pokemon.level.to_s )
draw_gender(149, 99 + (i*106), @pokemon.gender)
end
bitmap = RPG::Cache.battler(@pokemon.icon, 0)
self.contents.blt(-8, 67 + (i*107), bitmap, src_rect, 255)
else
if @pokemon.egg
self.contents.draw_text(283,64 + ((i-3)*106) , 120, 32,@pokemon.given_name )
else
self.contents.draw_text(283,64 + ((i-3)*106) , 120, 32,@pokemon.given_name )
self.contents.draw_text(289,95 + ((i-3)*106) , 120, 32,"Nv " + @pokemon.level.to_s )
draw_gender(376, 99 + ((i-3)*106), @pokemon.gender)
end
bitmap = RPG::Cache.battler(@pokemon.icon, 0)
self.contents.blt(219, 67 + ((i-3)*107), bitmap, src_rect, 255)
end
end
return
end
end

def draw_gender(x, y, gender)
if gender == 1
rect = Rect.new(0, 0, 18, 33)
bitmap = RPG::Cache.picture("Maleb.png")
self.contents.blt(x, y, bitmap, rect, 255)
end
if gender == 2
rect = Rect.new(0, 0, 18, 33)
bitmap = RPG::Cache.picture("Femaleb.png")
self.contents.blt(x, y, bitmap, rect, 255)
end
end
end


(La ligne en rouge etant la 204)

Log.Txt
---------- Erreur de script : Pokemon_Menu ----------
----- Type
NoMethodError

----- Message
- ARGS - [1]
undefined method `[]' for nil:NilClass

----- Position dans Pokemon_Menu
Ligne 204

----- Backtrace
Script : Pokemon_Menu | Ligne : 204 | Méthode : in `refresh'
Script : Pokemon_Menu | Ligne : 198 | Méthode : in `initialize'
Script : Pokemon_Menu | Ligne : 45 | Méthode : in `new'
Script : Pokemon_Menu | Ligne : 45 | Méthode : in `main'
Script : Main | Ligne : 49


Ainsi, cela bug uniquement sur le jeu crypté

Voila si quelqu'un sait quoi faire, merci d'avance ^^

Posté par Opale le 10 Nov - 21:53 (2012)
Salut.

As-tu paramétré les zones que tu as ajouté dans data_zone ? As tu bien ouvert le menu debug et fait compiler avant de crypter ton projet ?

Posté par Fudo Fuyouki le 10 Nov - 21:56 (2012)
Opale a écrit:
Salut.

As-tu paramétré les zones que tu as ajouté dans data_zone ? As tu bien ouvert le menu debug et fait compiler avant de crypter ton projet ?


Salut, j'ai bien paramtrer les zones, je vais compiler le jeu et j'te redis ça

EDIT : En effet, j'avait pas compiler le jeu, merci a toi, c'reglé ^^