Sujet n°10998
Posté par Maxime le 22 Fév - 13:00 (2012)
Titre : Script menu mal modifié. (Honte à moi ><)
Bonjour, j'ai voulu modifier le script du menu pour remettre les "onglets" dans le bon ordre mais le problème c'est que j'ai un peu réussit à modifier la position des images comme ceci (
Spoiler
http://static.gamesradar.com/images/mb/GamesRadar/us/Games/P/Pokemon Black …
) mais quand je clique sur la carte dresseur par exemple je tombe sur l'endroit pour sauvegarder. (><)
Et c'est pour ça que je demande à quelqu'un qu'il puisse modifier le script pour que tout soit correct.
voici le script :
Pokemon_Menu
Code:
module POKEMON_S
  class Pokemon_Menu
   
    def initialize(menu_index = 0)
      @menu_index = menu_index
    end
 
    def main
      Graphics.freeze
      @z_level = 10000
      # Image de fond du menu
      @spriteset = Spriteset_Map.new
      @background = Sprite.new
      @background.bitmap = RPG::Cache.picture("menu echap.PNG")
      @background.x = 13
      @background.y = 13
      @background.z = @z_level
      @command = POKEMON_S::Window_Menu.new
      @command.x = 0
      @command.y = 0
      @command.z = @z_level + 2
      @command.opacity = 0
      @img0 = Sprite.new
      @img0.bitmap = RPG::Cache.picture("menu_noselect.PNG")
      @img0.y = 251
      @img0.x = 16
      @img0.z = @z_level
      if not($data_pokedex[0])
        @img0.opacity = 0
      end
      @img1 = Sprite.new
      @img1.bitmap = RPG::Cache.picture("menu_noselect.PNG")
      @img1.y = 251
      @img1.x = 144
      @img1.z = @z_level
      @img2 = Sprite.new
      @img2.bitmap = RPG::Cache.picture("menu_noselect.PNG")
      @img2.y = 299
      @img2.x = 16
      @img2.z = @z_level
      if $pokemon_party.size == 0
        @img2.opacity = 0
      end
      @img3 = Sprite.new
      @img3.bitmap = RPG::Cache.picture("menu_noselect.PNG")
      @img3.y = 299
      @img3.x = 144
      @img3.z = @z_level
      @img4 = Sprite.new
      @img4.bitmap = RPG::Cache.picture("menu_noselect.PNG")
      @img4.y = 347
      @img4.x = 16
      @img4.z = @z_level
      @img5 = Sprite.new
      @img5.bitmap = RPG::Cache.picture("menu_noselect.PNG")
      @img5.y = 347
      @img5.x = 144
      @img5.z = @z_level
     
     
      @cde0 = Sprite.new
      @cde0.bitmap = RPG::Cache.picture("Menu0.PNG")
      @cde0.y = 256
      @cde0.x = 155
      @cde0.z = @z_level + 2
      if not($data_pokedex[0])
        @cde0.opacity = 0
      end
      @cde1 = Sprite.new
      @cde1.bitmap = RPG::Cache.picture("Menu1.PNG")
      @cde1.y = 257
      @cde1.x = 27
      @cde1.z = @z_level + 2
      if $pokemon_party.size == 0
        @cde1.opacity = 0
      end
      @cde2 = Sprite.new
      @cde2.bitmap = RPG::Cache.picture("Menu2.PNG")
      @cde2.y = 307
      @cde2.x = 27
      @cde2.z = @z_level + 2
      @cde3 = Sprite.new
      @cde3.bitmap = RPG::Cache.picture("Menu3.PNG")
      @cde3.y = 303
      @cde3.x = 155
      @cde3.z = @z_level + 2
      @cde4 = Sprite.new
      @cde4.bitmap = RPG::Cache.picture("Menu4.PNG")
      @cde4.y = 354
      @cde4.x = 24
      @cde4.z = @z_level + 2
      @cde5 = Sprite.new
      @cde5.bitmap = RPG::Cache.picture("Menu5.PNG")
      @cde5.y = 353
      @cde5.x = 155
      @cde5.z = @z_level + 2
      if not($data_pokedex[0]) and @menu_index == 0
        @menu_index = 1
      end
      if $pokemon_party.size == 0 and @menu_index == 1
        @menu_index = 2
      end
      @curseur = Sprite.new
      @curseur.bitmap = RPG::Cache.picture("menu_select.PNG")
      @curseur.y = 251+ 48 *(@menu_index % 3)
      @curseur.x = 16 + 128*(@menu_index / 3)
      @curseur.z = @z_level + 1
     
      Graphics.transition
      loop do
        Graphics.update
        Input.update
        update
        @curseur.dispose
        @curseur = Sprite.new
        @curseur.bitmap = RPG::Cache.picture("menu_select.PNG")
        @curseur.y = 251+ 48 *(@menu_index % 3)
        @curseur.x = 16 + 128*(@menu_index / 3)
        @curseur.z = @z_level + 1
        @command.refresh
        if $scene != self
          break
        end
      end
      Graphics.freeze
      @curseur.dispose
      @command.dispose
      @background.dispose
      @spriteset.dispose
      @command.dispose
      @cde0.dispose
      @cde1.dispose
      @cde2.dispose
      @cde3.dispose
      @cde4.dispose
      @cde5.dispose
      @img0.dispose
      @img1.dispose
      @img2.dispose
      @img3.dispose
      @img4.dispose
      @img5.dispose
    end
   
  def update
    @spriteset.update
    a = 0
    if Input.trigger?(Input::UP) and @menu_index>0
      @menu_index -= 1
      if @menu_index == 2
        @menu_index = 3
        a = 1
      end
      if not($data_pokedex[0]) and @menu_index == 0
        @menu_index = 1
        a = 1
      end
      if $pokemon_party.size == 0 and @menu_index == 1
        @menu_index = 2
        a = 1
      end

      if a == 0
        $game_system.se_play($data_system.decision_se)
      end
    end
    if Input.trigger?(Input::DOWN) and @menu_index<5
      @menu_index += 1
      if @menu_index == 3
        @menu_index = 2
        a = 1
      end
      if a == 0
        $game_system.se_play($data_system.decision_se)
      end
    end
    if Input.trigger?(Input::LEFT) and @menu_index>2
      $game_system.se_play($data_system.decision_se)
      @menu_index -= 3
      if not($data_pokedex[0]) and @menu_index == 0
        @menu_index = 1
      end
      if $pokemon_party.size == 0 and @menu_index == 1
        @menu_index = 2
      end
    end
    if Input.trigger?(Input::RIGHT) and @menu_index<3
      $game_system.se_play($data_system.decision_se)
      @menu_index += 3
    end 
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end
    if Input.trigger?(Input::C)
      if @menu_index == 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
      end 
      if @menu_index == 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
      end
      if @menu_index == 2 # Sac
        $game_system.se_play($data_system.decision_se)
        $scene = Pokemon_Item_Bag.new
      end
      if @menu_index == 3 # Carte dresseur
        $game_system.se_play($data_system.decision_se)
        $game_temp.common_event_id = 19
        $scene = Scene_Map.new
      end
      if @menu_index == 4 # 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
      end     
      if @menu_index == 5 # Options
        $game_system.se_play($data_system.decision_se)
        $scene = OPTIONS.new
      end
      return
    end
  end     
end
 
  class Window_Location < Window_Base
    #--------------------------------------------------------------------------
    def initialize
      super(0, 0, 300, 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 = Color.new(40,40,40,255)
      self.contents.draw_text(6, 0, 300, 32,$data_mapzone[$game_map.map_id][1])
      self.contents.draw_text(4, 2, 300, 32,$data_mapzone[$game_map.map_id][1])
      self.contents.draw_text(6, 2, 300, 32,$data_mapzone[$game_map.map_id][1])
      self.contents.font.color = Color.new(251,251,251,255)
      self.contents.draw_text(4, 0, 300, 32,$data_mapzone[$game_map.map_id][1])
    end
  end

  class Window_Argent < Window_Base

    #--------------------------------------------------------------------------
    def initialize
      super(0, 0, 900, 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 = Color.new(40,40,40,255)
      self.contents.draw_text(6, 0, 300, 32, $pokemon_party.money.to_s + "$", 2)
      self.contents.draw_text(4, 2, 300, 32, $pokemon_party.money.to_s + "$", 2)
      self.contents.draw_text(6, 2, 300, 32, $pokemon_party.money.to_s + "$", 2)
      self.contents.font.color = Color.new(251,251,251,255)
      self.contents.draw_text(4, 0, 300, 32,$pokemon_party.money.to_s + "$", 2)
    end
  end
 
  class Window_Menu < Window_Base
    #--------------------------------------------------------------------------
    def initialize
      super(0, 0, 640, 480)
      self.contents = Bitmap.new(width - 32, height - 32)
      self.contents.font.name = $fontface
      self.contents.font.size = $fontsize
      self.contents.clear
      refresh
    end
    #--------------------------------------------------------------------------
    def refresh
      s1 = "Pokédex"
      s2 = "Pokémon"
      s3 = "Sac"
      s4 = Player.name
      s5 = "Sauver"
      s6 = "Options"
      menu = [s2,s3,s5,s1,s4,s6]
      for i in 0..5
        if not($data_pokedex[0]) and i == 0
          i = 1
        end
        if $pokemon_party.size == 0 and i == 1
          i = 2
        end
        y = 251+ 48 *(i % 3) - 9
        x = 16 + 128*(i / 3) + 28
        text = menu[i].to_s
        self.contents.font.color = Color.new(107,107,107,255)
        self.contents.draw_text(x+1, y, 300, 32, text)
        self.contents.draw_text(x, y+1, 300, 32, text)
        self.contents.draw_text(x+1, y+1, 300, 32, text)
        self.contents.font.color = Color.new(251,251,251,255)
        self.contents.draw_text(x, y, 300, 32,text)
      end 
    end
    def dispose
      self.contents.clear
    end
  end

end



Merci d'avance pour votre aide. Imbécile heureux

Posté par Araceus le 22 Fév - 13:09 (2012)
Code:
if Input.trigger?(Input::C) 
      if @menu_index == 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 
      end   
      if @menu_index == 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 
      end 
      if @menu_index == 2 # Sac 
        $game_system.se_play($data_system.decision_se) 
        $scene = Pokemon_Item_Bag.new 
      end 
      if @menu_index == 3 # Carte dresseur 
        $game_system.se_play($data_system.decision_se) 
        $game_temp.common_event_id = 19 
        $scene = Scene_Map.new 
      end 
      if @menu_index == 4 # 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 
      end       
      if @menu_index == 5 # Options 
        $game_system.se_play($data_system.decision_se) 
        $scene = OPTIONS.new 


Je crois que cette partie est aussi à éditer.

Posté par Maxime le 22 Fév - 13:13 (2012)
Désoler, mais c'est toujours pareil...

Posté par Araceus le 22 Fév - 13:14 (2012)
Change le:
Code:
  if @menu_index == 3 # Carte dresseur

      if @menu_index == 4 # Sauvegarde   
   

par
Code:
  if @menu_index == 4 # Carte dresseur

      if @menu_index == 3 # Sauvegarde   
   


Juste pour voir ce que ça donne.

Posté par Maxime le 22 Fév - 13:23 (2012)
Celà marche mais quand je vais dans l'onglet "sauvegarder", je tombe sur le sac...
Sinon si tu a PSPDS5G, essaye le script pour voir.

Posté par Laito' le 22 Fév - 13:24 (2012)
Bah tu retélécharges PSP5G et tu remet le même script.

Posté par Araceus le 22 Fév - 13:30 (2012)
Et quand tu clique sur la carte dresseur, ça fait comme avant?

Posté par Maxime le 22 Fév - 13:33 (2012)
Non, la carte est de nouveaux normal ! Clin d'œil foireux

Posté par Araceus le 22 Fév - 13:45 (2012)
Okey, bah il faut continuer a changer ce script^^.