Sujet n°5675
Posté par Ace Attorney Man le 23 Déc - 20:02 (2009)
Titre : [Moitié OK]Bug POKéDEX
Salut à tous !
J'ai le POKéDEX de base de 4G+ en mode régional (interrupteur pokédex régionnal activé) et j'ai ce bug-
 
bug

Code:

--------- Erreur de script : Pokemon_Pokedex ----------
----- Type
NoMethodError

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

----- Position dans Pokemon_Pokedex
Ligne 676

----- Backtrace
Script : Pokemon_Pokedex | Ligne : 676 | Méthode : in `initialize'
Script : Pokemon_Pokedex | Ligne : 52 | Méthode : in `new'
Script : Pokemon_Pokedex | Ligne : 52 | Méthode : in `main'
Script : Main | Ligne : 46
 

Quand j'ouvre le POKéDEX.
Lignes qui bugs
        
 
Code:

 if (string4 + word).length < limit and not(full4)
            string4 += word
            word = ""
          else
            full4 = true
          end
        end
      end
      return [string1, string2, string3, string4]
    end
   
   
  end
 
 
  class Pokemon_List < Window_Selectable
    def initialize(table, id_list = [], menu_index = 0, show = true)
      # show montre les pokémons intermédiaires
      # id_list liste des pokémons vu/attrapés
      #super(50-16, 48-16, 560+32, 387+32, 43)
      @hauteur = 35
      super(340, 32, 560+32, 384+32, @hauteur)#(640 - 320, 48-16, 560+32, 387+32, 43)
      @index = menu_index
      @table = table
      @id_list = id_list
      @last = id_list[-1] <= Ligne qui bug
      @show = show
      self.opacity = 0
      if @show
        value = @table.index(@last)
        value += 1 if value != nil
      else
        value = id_list.length
      end 

La ligne qui bug est :     
 
Code:

@last = id_list[-1] 

Merci d'avance pour votre aide =).

Posté par Lén le 23 Déc - 21:14 (2009)
Cette ligne bug quand le pokédex est vide.

  1. @last = id_list[-1]  
cherche dans la liste des pokémons vus/capturés le dernier de la liste.
-1 signifie en fait le dernier, -2 l'avant dernier etc ...

Donc ton pokédex est vide.

Posté par Ace Attorney Man le 23 Déc - 21:16 (2009)
Etrange, j'ai fais
Code:
ajouter_pokemon("starter",niveaudustarter)
Ca ne devrait pas le compter ajouté ?

Posté par Lén le 23 Déc - 21:19 (2009)
Si ><
et si tu fait
  1. ajouter_pokemon(1,1) 
Ça donne quoi ?

Posté par Ace Attorney Man le 23 Déc - 21:20 (2009)
Je l'ai fait avec le numéro, donc non.

Posté par Empire1601 le 23 Déc - 21:20 (2009)
Essaye ce script à la place de ton pokemon_pokedex :


 
Spoiler
Code:



 

#==============================================================================
# ■ Pokemon_Pokedex

# 05/10/09 -  par Slash et sphinx
#-----------------------------------------------------------------------------
# Scène modifiable
#-----------------------------------------------------------------------------
# Pokédex
#-----------------------------------------------------------------------------

module POKEMON_S
  
#---------------------------------------------------------------------------------
# Class Pokedex Pokedex
# Cette class gere la page d'acceuil du pokedex
#---------------------------------------------------------------------------------  
  class Pokemon_Pokedex #(Numérique)
    def initialize(index = 0, show = true)
      @index = index
      @show = show
      @table = []
      @commande = []
      # Regional
      if POKEMON_S._DEXREG
        for id in 1..$data_pokedex.length-1
          @table[Pokemon_Info.id_bis(id)] = id
        end
        @table.shift # débarasser l'élément 0
        @table.compact!
      else
      # National
        for id in 1..$data_pokedex.length-1
          @table.push(id)
        end
      end
    end
    
    def main
      # Fenêtre principale
      # Fond
      @background = Sprite.new
      @background.bitmap = RPG::Cache.picture("COAA_pokedex.png")
      @background.z = 5
      
      # Liste
      @list = []
      for i in 0..@table.length-1
        if $data_pokedex[@table[i]][0]
          @list.push(@table[i]) # liste des ID vus
        end
      end   
      # Vu/Capture
      @pokemon_amount = Window_Base.new(27 - 16, 306, 640, 400)
      @pokemon_amount.contents = Bitmap.new(640, 400-32)
      @pokemon_amount.contents.font.name = $fontface
      @pokemon_amount.contents.font.size = $fontsize
      @pokemon_amount.contents.font.bold = true
      @pokemon_amount.opacity = 0
      viewed = @list.length.to_s
      captured = 0
      for element in @list
        if $data_pokedex[element][1]
          captured += 1
        end
      end

      @pokemon_amount.contents.draw_text(-40, 10, 300, 35, "POKEMONS APERCUS", 2)
      @pokemon_amount.contents.draw_text(250, 10, 300, 35, "POKEMONS ATTRAPES", 2)
      @pokemon_amount.contents.draw_text(-40, 22, 300, 35, ". . . . . . . . . . . . . . . . . .", 2)
      @pokemon_amount.contents.draw_text(250, 22, 300, 35, ". . . . . . . . . . . . . . . . . .", 2)
      string_viewed = sprintf("%03d", viewed)
      string_captured = sprintf("%03d", captured)
      @pokemon_amount.contents.draw_text(-40, 47, 300, 35, "[ "+ string_viewed +" ]", 2)
      @pokemon_amount.contents.draw_text(250, 47, 300, 35, "[ "+ string_captured +" ]", 2)
      
      Graphics.transition
      loop do
        Graphics.update
        Input.update
        update
        if $scene != self
          break
        end
      end
      Graphics.freeze
      @background.dispose
      @pokemon_amount.dispose
    end
    
    def update
     
      if Input.trigger?(Input::B)
        $game_system.se_play($data_system.cancel_se)
        $scene = POKEMON_S::Pokemon_Menu.new(0)
        return
      end
      if Input.trigger?(Input::C)
        @pokemon_amount.dispose
        @pokemon_amount = Window_Base.new(27 - 16, 306, 640, 400)
        @pokemon_amount.contents = Bitmap.new(640, 400-32)
        @pokemon_amount.contents.font.name = $fontface
        @pokemon_amount.contents.font.size = $fontsize
        @pokemon_amount.contents.font.bold = true
        @pokemon_amount.opacity = 0
        @pokemon_amount.contents.draw_text(120, 10, 300, 35, "CHARGEMENT DU POKEDEX", 2)
        @pokemon_amount.contents.draw_text(112, 47, 300, 35, "PATIENTEZ UN INSTANT", 2)
        $game_system.se_play($data_system.cancel_se)
        $scene = POKEMON_S::Pokemon_Pokedex_List.new(@table, @list,true)
        return
      end
    end
  end
  
#---------------------------------------------------------------------------------
# Class Pokedex Pokedex List
# Cette class gere l'affichage de la page principale du pokédex
#---------------------------------------------------------------------------------  
  class Pokemon_Pokedex_List
    def initialize (table, id_list = [],show = true,index = 0)
      @index = index
      @table = table
      @list = id_list
      @pokelist = []
      @show = show
      if show == true
        n = 0 
        for i in 0..@table.length-1  
          if $data_pokedex[@table.length-1-i][0] 
            n=@table.length-1-i 
            break 
          end  
        end 
        for i in 0..n-1
          if POKEMON_S._DEXREG
            ida = "   " + sprintf("%03d",Pokemon_Info.id_bis(@table[i]))
          else
            ida = "   " + sprintf("%03d",@table[i])
          end
          @pokelist.push(ida)
        end
      else
        for i in 0..@table.length-1
          if POKEMON_S._DEXREG
            ida = "   " + sprintf("%03d",Pokemon_Info.id_bis(@table[i]))
          else
            ida = "   " + sprintf("%03d",@table[i])
          end
          @pokelist.push(ida)
        end
      end
      
    end
    
    def main
      #affichage du background du pokedex
      @back = Sprite.new
      @back.bitmap = RPG::Cache.picture("Pokedexsl.png")
      @back.x = 0
      @back.y = 0
      @back.z = 5
      #affichage de l'avant du pokedex
      @front = Sprite.new
      @front.bitmap = RPG::Cache.picture("Pokedex_list.png")
      @front.x = 0
      @front.y = 0
      @front.z = 10007      
      #affichage des pokemon ds le pokedex
      @pokemon_window = POKEMON_S::Pokedex_Command.new(520, @table, @pokelist, $fontsize, 5, 104)
      @pokemon_window.x = 54
      @pokemon_window.y = -20
      @pokemon_window.z = 6
      @pokemon_window.height = 440
      @pokemon_window.opacity  = 0
      #affichage du nom des pokemon ds le pokedex
      idn = @table[@pokemon_window.index]
      @pokemonname = POKEMON_S::Pokedex_Name.new(idn)
      @pokemonname.x = 145
      @pokemonname.y = 337
      @pokemonname.z = 10008
      @pokemonname.opacity = 0
      @pokemon_window.index = @index
      Graphics.transition
      loop do
        Graphics.update
        Input.update        
        @pokemon_window.update
        #affichage du nom des pokemon ds le pokedex
        @pokemonname.dispose
        idn = @table[@pokemon_window.index]
        @pokemonname = POKEMON_S::Pokedex_Name.new(idn)
        @pokemonname.x = 145
        @pokemonname.y = 337
        @pokemonname.z = 10008
        @pokemonname.opacity = 0
        update
        if $scene != self
          break
        end
      end
      @pokemonname.dispose
      @pokemon_window.dispose
      @back.dispose
      @front.dispose
      
    end
    def update
      if Input.trigger?(Input::C)
        @index = @pokemon_window.index
        pokemon_id = @table[@index]
        seen = $data_pokedex[pokemon_id][0]
        if seen == false
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        $scene = Pokemon_Detail.new(pokemon_id, @show)
        return
      end  
      
      #si j'appuis sur ECHAP je retourne a la page de garde du pokedex
      if Input.trigger?(Input::B)
        $game_system.se_play($data_system.cancel_se)
        $scene = POKEMON_S::Pokemon_Pokedex.new
        return
      end
      #si j'appuis sur SHIFT je tronque ou détronque le pokedex
      if Input.trigger?(Input::A)
        $game_system.se_play($data_system.cancel_se)
        if @show == true
        $scene = POKEMON_S::Pokemon_Pokedex_List.new(@list,@table, false,0)
        else
        $scene = POKEMON_S::Pokemon_Pokedex_List.new(@list,@table, true,0)
        end
        return
      end
    end  
  end
  
#---------------------------------------------------------------------------------
# Class Pokedex Name
# Cette class gere l'affichage du nom des pokémon ds le pokedex
#---------------------------------------------------------------------------------

  class Pokedex_Name < Window_Base
    def initialize(index)
      super(0, 0, 350,100)
      @idn = index
      self.contents = Bitmap.new(width - 32, height - 32)
      self.contents.font.name = $fontface
      self.contents.font.size = $fontsize
      refresh
    end

    def refresh
      if $data_pokedex[@idn][0]
        name = $data_pokemon[@idn][0]
      else
        name = " "
      end
      x = self.contents.text_size(name).width / 2
      self.contents.clear
      self.contents.font.color = Color.new(107,107,107,255)
      self.contents.draw_text(162-x, 0, 300, 32,name)
      self.contents.draw_text(160-x, 2, 300, 32,name)
      self.contents.draw_text(162-x, 2, 300, 32,name)
      self.contents.font.color = Color.new(251,251,251,255)
      self.contents.draw_text(160-x, 0, 300, 32,name)
    end
  end
  
#---------------------------------------------------------------------------------
# Class Pokedex Command
# Cette class gere l'affichage des pokémon ds le pokedex
#---------------------------------------------------------------------------------
  class Pokedex_Command < Window_Selectable
    attr_reader :item_max
    attr_reader :commands
  
    def initialize(width,table, commands, size = $fontsize, column = 1, height = nil)
      @table = table
      if size == $fontsize
        @heightsize = 32
      elsif size == $fontsizebig
        @heightsize = 43
      else
        @heightsize = 32
      end
      if height != nil
        @height = height
      else
        @height = @heightsize
      end
      super(0, 0, width, commands.size * @height + 32, @height)
      @item_max = commands.size
      @commands = commands
      @column_max = column
      self.contents = Bitmap.new(width, @item_max * @height)
      self.contents.font.name = $fontface
      self.contents.font.size = size
      refresh
      self.index = 0
    end
  
    def refresh
      self.contents.clear
      for i in 0...@item_max
        draw_item(i, normal_color)
      end
    end    

    def draw_item(index, color = normal_color)
      self.contents.font.color = color
      # Modification pour le tracé du texte
      rect = Rect.new(4 + 8 + (index % @column_max) * (width/@column_max), 
        @height * (index/@column_max) + (@height-@heightsize)/2, self.contents.width/@column_max, @heightsize)
      self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
      id = @table[index]
      if $data_pokedex[id][0]
        self.contents.font.color = Color.new(107, 107, 107, 255)
      else
        self.contents.font.color = Color.new(173, 173, 173, 255)
      end  
      self.contents.font.bold = true
      self.contents.draw_text(rect, @commands[index])
      if $data_pokedex[id][0]
        string = sprintf("%03d",id)
        bitmap = RPG::Cache.battler("Icon/#{sprintf('%03d', id)}.png", 0)
        self.contents.blt(8 + (index % @column_max) * (width/@column_max), 
         @height * (index/@column_max) + (@height-@heightsize)/2 + 24, bitmap, Rect.new(0, 0, 64, 64),128)
      end        
      if $data_pokedex[id][1]
        bitmap = RPG::Cache.picture("Pokedexball.png")
        self.contents.blt(8 + (index % @column_max) * (width/@column_max), 
         @height * (index/@column_max) + (@height-@heightsize)/2 + 4, bitmap, Rect.new(0, 0, 24, 24))
        string = sprintf("%03d",id)
        bitmap = RPG::Cache.battler("Icon/#{sprintf('%03d', id)}.png", 0)
        self.contents.blt(8 + (index % @column_max) * (width/@column_max), 
         @height * (index/@column_max) + (@height-@heightsize)/2 + 24, bitmap, Rect.new(0, 0, 64, 64))
      end
    end

    def disable_item(index)
      draw_item(index, disabled_color)
    end
  
    def enable_item(index)
      # Nouvelle fonction
      draw_item(index, normal_color)

    end
  end
  
#---------------------------------------------------------------------------------
# Class Pokedex Detail
# Cette class gere l'affichage des infos sur les pokemons
#---------------------------------------------------------------------------------
  class Pokemon_Detail
    def initialize(id, show, mode = 0)
      @id = id
      @show = show
      @mode = mode
      @table = []
      # Regional
      if POKEMON_S._DEXREG
        for id in 1..$data_pokedex.length-1
          @table[Pokemon_Info.id_bis(id)] = id
        end
        @table.shift # débarasser l'élément 0
        @table.compact!
      else
      # National
        for id in 1..$data_pokedex.length-1
          @table.push(id)
        end
      end
    end
   
    def main
      # Fenêtre détail
      @background = Sprite.new
      @background.bitmap = RPG::Cache.picture("PokedexShfond1.png")
      @background.z = 0
     
      # Sprite
      @pokemon_sprite = Sprite.new
      @pokemon_sprite.x = 26
      @pokemon_sprite.y = 71
      @pokemon_sprite.z = 10
      @pokemon_sprite.visible = false
     
      # Identité
      @data_window = Window_Base.new(233-16, 76-16, 370+32, 196+32)
      @data_window.contents = Bitmap.new(370, 196)
      color = Color.new(60,60,60)
      @data_window.contents.font.name = $fontface
      @data_window.contents.font.size = $fontsizebig
      @data_window.contents.font.color = color
      @data_window.opacity = 0
      @data_window.z = 10
      @data_window.visible = false
     
      # Descr
      @text_window = Window_Base.new(60 - 16, 252 - 16 + 51, 550 + 32, 160 + 32)
      @text_window.contents = Bitmap.new(550 , 160)
      @text_window.contents.font.name = $fontface
      @text_window.contents.font.size = $fontsize
      @text_window.contents.font.color = color
      @text_window.opacity = 0
      @text_window.z = 10
      @text_window.visible = false
     
      @list = []
      for i in 0..@table.length-1
        if $data_pokedex[@table[i]][0]
          @list.push(@table[i])
        end
      end
     
      if @mode == 0
        filename = "Audio/SE/Cries/" + sprintf("%03d", @id) + "Cry.wav"
        if FileTest.exist?(filename)
          Audio.se_play(filename)
        end
      end
     
      data_refresh
      @background.visible = false
      @pokemon_sprite.visible = false
      @data_window.visible = false
      @text_window.visible = false
      case @mode
      when 0
        @background.visible = true
        @pokemon_sprite.visible = true
        @data_window.visible = true
        @text_window.visible = true
      when 1
        refresh_zone
      when 2
        refresh_cri
      when 3
        refresh_tail
      end
       
      Graphics.transition
      loop do
        Graphics.update
        Input.update
        update
        if $scene != self
          break
        end
      end
      Graphics.freeze
      @background.dispose
      @data_window.dispose
      @pokemon_sprite.dispose
      @text_window.dispose
    end
   
    def update
      if Input.trigger?(Input::B)
        $game_system.se_play($data_system.cancel_se)
        Graphics.freeze
        hide
        if @show == true
          index = @table.index(@id)
          $scene = POKEMON_S::Pokemon_Pokedex_List.new(@table,@list, @show, index)
        else
          index = @list.index(@id)
          $scene = POKEMON_S::Pokemon_Pokedex_List.new(@list,@table, @show, index)
        end
        return
      end
     
      if Input.trigger?(Input::C) and @mode == 1
        Graphics.freeze
        hide
        $game_system.se_play($data_system.decision_se)
        $game_temp.map_temp = ["PKDX", false, $game_map.map_id, $game_player.x,
          $game_player.y, $game_player.direction, $game_player.character_name,
          $game_player.character_hue, $game_player.step_anime,
          $game_system.menu_disabled, POKEMON_S::_MAPLINK, @id, @show]
        $game_temp.transition_processing = true
        $game_temp.transition_name = ""
        POKEMON_S::_MAPLINK = false
       
        $scene = Scene_Map.new
        $game_map.setup(POKEMON_S::_WMAPID)
        $game_player.moveto(9, 7)
        $game_map.autoplay
        $game_map.update
        return
      end
     
      if Input.trigger?(Input::C) and @mode == 2
        filename = "Audio/SE/Cries/" + sprintf("%03d", @id) + "Cry.wav"
        if FileTest.exist?(filename)
          Audio.se_play(filename)
        end
      end
     
      if Input.trigger?(Input::DOWN)
        Graphics.freeze
        index = @list.index(@id)
        if @id == @list.last
          @id = @list.first
        else
          @id = @list[index+1]
        end
        hide
        Graphics.transition(5)
        Graphics.freeze
        @mode = 0
        data_refresh
        Graphics.transition
        filename = "Audio/SE/Cries/" + sprintf("%03d", @id) + "Cry.wav"
        if FileTest.exist?(filename)
          Audio.se_play(filename)
        end
      end
     
      if Input.trigger?(Input::UP)
        Graphics.freeze
        index = @list.index(@id)
        if @id == @list.first
          @id = @list.last
        else
          @id = @list[index-1]
        end
        hide
        Graphics.transition(5)
        Graphics.freeze
        @mode = 0
        data_refresh
        Graphics.transition
        filename = "Audio/SE/Cries/" + sprintf("%03d", @id) + "Cry.wav"
        if FileTest.exist?(filename)
          Audio.se_play(filename)
        end
      end
     
      if Input.trigger?(Input::LEFT)
        if @mode > 0
          Graphics.freeze
          hide
          #Graphics.transition(1)
          @mode -= 1
          #Graphics.freeze
          case @mode
          when 0
            data_refresh
          when 1
            refresh_zone
          when 2
            refresh_cri
          when 3
            refresh_tail
          end
          Graphics.transition(1)
        end
      end
     
      if Input.trigger?(Input::RIGHT)
        if @mode < 3
          Graphics.freeze
          hide
          #Graphics.transition(1)
          @mode += 1
          #Graphics.freeze
          case @mode
          when 0
            data_refresh
          when 1
            refresh_zone
          when 2
            refresh_cri
          when 3
            refresh_tail
          end
          Graphics.transition(1)
        end
      end
    end
   
    def hide
      @background.visible = false
      @pokemon_sprite.visible = false
      case @mode
      when 0
        @data_window.visible = false
        @text_window.visible = false
      when 1
        @text.dispose
      when 2
        @data_window.visible = false
        @text_window.visible = false
      when 3
        @trainer.dispose
        @pokemon_new_sprite.dispose
        @text.dispose
      end
    end
       
   
    def data_refresh
      @background.bitmap = RPG::Cache.picture("PokedexShfond1.png")
      @pokemon_sprite.x = 26
      @pokemon_sprite.y = 71
      @data_window.x = 233-16
      @data_window.y = 76-16
      @pokemon_sprite.visible = true
      @background.visible = true
      @data_window.visible = true
      @text_window.visible = true
     
      @pokemon = $data_pokemon[@id]
      show = $data_pokedex[@id][1]
      ida = sprintf("%03d", @id)
      @pokemon_sprite.bitmap = RPG::Cache.battler("Front_Male/" + ida + ".png", 0)

      if POKEMON_S._DEXREG
        name = "N." + sprintf("%03d", Pokemon_Info.id_bis(@id)) + "  " + @pokemon[0]
      else
        name = "N." + ida + "  " + @pokemon[0]
      end

      if show # Descr accessible
        species = @pokemon[9][1]
        height_data = @pokemon[9][2]
        weight = @pokemon[9][3]
      else
        species = "???"
        height_data = "???"
        weight = "???  "
      end
     
      @data_window.contents.clear
      @data_window.contents.draw_text(15, 0, 370, 47, name)
      @data_window.contents.draw_text(15, 41, 370, 47, "Pokémon " + species)
      @data_window.contents.draw_text(41, 95, 230, 47, "Taille: ")
      @data_window.contents.draw_text(41, 95, 212, 47, height_data, 2)
      @data_window.contents.draw_text(41, 148, 230, 47, "Poids: ")
      @data_window.contents.draw_text(41, 148, 230, 47, weight, 2)
     
      @text_window.contents.clear
      if show
        text = @pokemon[9][0]
        string = string_builder(text, 51)
        string1 = string[0]
        string2 = string[1]
        string3 = string[2]
        string4 = string[3]
        @text_window.contents.draw_text(0, 0, 550, 40, string1)
        @text_window.contents.draw_text(0, 40, 550, 40, string2)
        @text_window.contents.draw_text(0, 80, 550, 40, string3)
        @text_window.contents.draw_text(0, 120, 550, 40, string4)
      end
    end
   
    def refresh_zone
      @background.bitmap = RPG::Cache.picture("PokedexShfond2.png")
      @background.visible = true
      @text = Window_Base.new(32-16, 223-16, 576+32, 47+32)
      @text.contents = Bitmap.new(576, 47)
      @text.contents.font.name = $fontface
      @text.contents.font.size = $fontsizebig
      @text.contents.font.color = Color.new(60,60,60)
      @text.contents.draw_text(0, 0, 576, 47, "OUVRIR LA CARTE", 1)
      @text.opacity = 0
    end
   
    def refresh_cri
      @background.bitmap = RPG::Cache.picture("PokedexShfond3.png")
      @pokemon_sprite.visible = true
      @background.visible = true
      @data_window.visible = true
      @pokemon_sprite.x = 26
      @pokemon_sprite.y = 75
      @data_window.x = 211 - 16
      @data_window.y = 75 - 5
      @data_window.contents.clear
      @data_window.contents.draw_text(50, 27, 339, 47, "CRI DE")
      @data_window.contents.draw_text(50, 68, 339, 47, @pokemon[0])
    end
   
    def refresh_tail
      @background.bitmap = RPG::Cache.picture("PokedexShfond4.png")
      @background.visible = true
      @pokemon_new_sprite = Sprite.new
      ida = sprintf("%03d", @id)
      @pokemon_new_sprite.bitmap = RPG::Cache.battler("Front_Male/" + ida + ".png", 0)
      @pokemon_new_sprite.color = Color.new(0, 0, 0, 255)
     
      @trainer = Sprite.new
      @trainer.bitmap = RPG::Cache.battler("trainer000.png", 0)
      @trainer.color = Color.new(0, 0, 0, 255)
     
      sizes = []
      for sprite in [@trainer, @pokemon_new_sprite]
        i = j = 0
        while sprite.bitmap.get_pixel(i,j).alpha == 0
          i += 1
          if i > sprite.bitmap.width
            i = 0
            j += 1
          end
        end
        up_pix = j
        i = 0
        j = sprite.bitmap.height
        while sprite.bitmap.get_pixel(i,j).alpha == 0
          i += 1
          if i > sprite.bitmap.width
            i = 0
            j -= 1
          end
        end
        down_pix = j
        sizes.push( down_pix-up_pix + 0.0 )
        sizes.push( down_pix )
      end
     
      if $data_pokemon[@id][9][2].to_f > 1.50
        zoom_pok = 1.00
        zoom_dre = 1.50 / $data_pokemon[@id][9][2].to_f * sizes[2] / sizes[0]
      else
        zoom_pok = $data_pokemon[@id][9][2].to_f/1.50 * sizes[0] / sizes[2]
        zoom_dre = 1.00
      end
     
      @pokemon_new_sprite.ox = @pokemon_new_sprite.bitmap.width/2
      @pokemon_new_sprite.oy = sizes[3]#@pokemon_new_sprite.bitmap.height
      @pokemon_new_sprite.x = 141 + @pokemon_new_sprite.ox
      @pokemon_new_sprite.y = 92 + 160#@pokemon_new_sprite.oy
     
      @trainer.ox = @trainer.bitmap.width/2
      @trainer.oy = sizes[1]#@trainer.bitmap.height
      @trainer.x = 339 + @trainer.ox
      @trainer.y = 92 + 160 #@trainer.oy
     
      @pokemon_new_sprite.zoom_x = @pokemon_new_sprite.zoom_y = zoom_pok
      @trainer.zoom_x = @trainer.zoom_y = zoom_dre
     
      @text = Window_Base.new(32-16, 367-16, 576+32, 47+32)
      @text.contents = Bitmap.new(576, 47)
      @text.contents.font.name = $fontface
      @text.contents.font.size = $fontsizebig
      @text.contents.font.color = Color.new(60,60,60)
      @text.contents.draw_text(0, 0, 576, 47, "TAILLE COMPARE A #{Player.name}", 1)
      @text.opacity = 0
    end
   
    def string_builder(text, limit)
      length = text.length
      full1 = false
      full2 = false
      full3 = false
      full4 = false
      string1 = ""
      string2 = ""
      string3 = ""
      string4 = ""
      word = ""
      for i in 0..length
        letter = text[i..i]
        if letter != " " and i != length
          word += letter.to_s
        else
          word = word + " "
          if (string1 + word).length < limit and not(full1)
            string1 += word
            word = ""
          else
            full1 = true
          end
         
          if (string2 + word).length < limit and not(full2)
            string2 += word
            word = ""
          else
            full2 = true
          end
         
          if (string3 + word).length < limit and not(full3)
            string3 += word
            word = ""
          else
            full3 = true
          end
         
          if (string4 + word).length < limit and not(full4)
            string4 += word
            word = ""
          else
            full4 = true
          end
        end
      end
      return [string1, string2, string3, string4]
    end
   
   
  end
  
end








Posté par Ace Attorney Man le 23 Déc - 21:44 (2009)
Cette fois-ci, j'ai encore un autre bug.
log
---------- Erreur de script : Pokemon_Pokedex ----------
----- Type
NoMethodError

----- Message
- ARGS - [0]
undefined method `[]' for true:TrueClass

----- Position dans Pokemon_Pokedex
Ligne 131

----- Backtrace
Script : Pokemon_Pokedex | Ligne : 131 | Méthode : in `initialize'
Script : Pokemon_Pokedex | Ligne : 130 | Méthode : in `each'
Script : Pokemon_Pokedex | Ligne : 130 | Méthode : in `initialize'
Script : Pokemon_Pokedex | Ligne : 111 | Méthode : in `new'
Script : Pokemon_Pokedex | Ligne : 111 | Méthode : in `update'
Script : Pokemon_Pokedex | Ligne : 83 | Méthode : in `main'
Script : Pokemon_Pokedex | Ligne : 80 | Méthode : in `loop'
Script : Pokemon_Pokedex | Ligne : 87 | Méthode : in `main'
Script : Main | Ligne : 46




EDIT :
En fait, j'ai trouvé, il faut avoir vu au moins deux POKéMON pour qu'il fonctionne...
Etrange, si quelqu'un à une idée, qu'il n'hésite pas.

Posté par Lén le 23 Déc - 21:50 (2009)
Mmmm possible ... puisqu'en général on donne le pokédex aprés avoir été dans les hautes herbes ....

Mais chez moi ca marche avec 1 pokémon :shock:

Posté par Ace Attorney Man le 23 Déc - 22:30 (2009)
Peut-être parce que j'en ai rajouté des nouveaux...
J'ai trouvé un moyen de le contourner, merci.

EDIT : Ah mais j'ai compris, tout con, en fait, le truc c'est que le POKéMON a l'id 001, et que ça fait planter, donc quand j'en rencontre un deuxième, il est de l'id 20, et donc il va combler des trous manquants...
=)

Posté par GT.Onizuka le 25 Déc - 12:37 (2009)
Il y a eu déjà le meme topic,moi aussi j'ai eu le meme probléme: ./4200.html?q=résolut…


EDIT:
Tu dois remplacer le script du pokedex par celui-là(ton vrai script copie colle dans le bloc notes au cas ou Clin d'œil foireux ):

 
Spoiler
 
  1.  #==============================================================================  
  2. # ■ Pokemon_Pokedex  
  3. # Pokemon Script Project - Krosk  
  4. # 18/07/07  
  5. # 07/09/08 - révision v0.7, Pokédex de Shaolan (PSP4G) simplifié et optimisé  
  6. #             (crédits : Shaolan, Slash)  
  7. # 03/01/09 - révision  
  8. #-----------------------------------------------------------------------------  
  9. # Scène modifiable  
  10. #-----------------------------------------------------------------------------  
  11. # Pokédex  
  12. #-----------------------------------------------------------------------------  
  13.   
  14. module POKEMON_S  
  15.   class Pokemon_Pokedex #(Numérique)  
  16.     def initialize(index = 0, show = true, z_level = 100)  
  17.       @index = index  
  18.       @show = show  
  19.       @table = []  
  20.       @z_level = z_level  
  21.       # Regional  
  22.       if POKEMON_S._DEXREG  
  23.         for id in 1..$data_pokedex.length-1  
  24.           @table[Pokemon_Info.id_bis(id)] = id  
  25.         end  
  26.         @table.shift # débarasser l'élément 0  
  27.         @table.compact!  
  28.       else  
  29.       # National  
  30.         for id in 1..$data_pokedex.length-1  
  31.           @table.push(id)  
  32.         end  
  33.       end  
  34.     end  
  35.      
  36.     def main  
  37.       # Fenêtre principale  
  38.       # Fond  
  39.       @background = Sprite.new  
  40.       @background.bitmap = RPG::Cache.picture("PokedexSh.png")  
  41.       @background.z = 5 + @z_level  
  42.       @backbackground = Sprite.new  
  43.       @backbackground.bitmap = RPG::Cache.picture("PokedexShback.png")  
  44.       @backbackground.z = @z_level  
  45.        
  46.       # Liste  
  47.       @list = []  
  48.       $game_variables[5000]["pokedex"]["vus"] = 0  
  49.       $game_variables[5000]["pokedex"]["captures"] = 0  
  50.       for i in 0.. @table.length-1  
  51.         if $data_pokedex[@table[i]][0]  
  52.           @list.push(@table[i]) # liste des ID vus  
  53.           $game_variables[5000]["pokedex"]["vus"] += 1  
  54.         end  
  55.         if $data_pokedex[@table[i]][1]  
  56.           $game_variables[5000]["pokedex"]["captures"] += 1  
  57.         end  
  58.       end  
  59.       @pokemon_list = POKEMON_S::Pokemon_List.new(@table, @list, @index, @show)  
  60.       @pokemon_list.active = true  
  61.        
  62.       # Vu/Capture  
  63.       #@pokemon_amount = Window_Base.new(27 - 16, 432 - 16, 420 + 32, 48 + 32)  
  64.       @pokemon_amount = Window_Base.new(27 - 16, 70, 155, 400)  
  65.       @pokemon_amount.z = 100 + @z_level  
  66.       @pokemon_amount.contents = Bitmap.new(155-32, 400-32)  
  67.       #@pokemon_amount.contents = Bitmap.new(420, 48)  
  68.       @pokemon_amount.contents.font.name = $fontface  
  69.       @pokemon_amount.contents.font.size = $fontsize  
  70.       @pokemon_amount.contents.font.italic = true  
  71.       @pokemon_amount.opacity = 0  
  72.       #@pokemon_amount.contents.draw_text(0, 0, 420, 48, "VUS " + viewed, 0)  
  73.       #@pokemon_amount.contents.draw_text(0, 0, 420, 48, "CAPTURéS " + captured.to_s, 2)  
  74.       @pokemon_amount.contents.draw_text(0, 0, 155-32, 35, "VUS", 1)# + viewed, 1)  
  75.       @pokemon_amount.contents.draw_text(0, 78, 155-32, 35, "PRIS", 1)# + captured.to_s, 1)  
  76.       rect = Rect.new (32, 35, 120, 3)  
  77.       @pokemon_amount.contents.fill_rect(rect, Color.new(0, 0, 0))  
  78.       rect = Rect.new (30, 33, 120, 3)  
  79.       @pokemon_amount.contents.fill_rect(rect, Color.new(255, 255, 255))  
  80.       rect = Rect.new (32, 78 + 35, 120, 3)  
  81.       @pokemon_amount.contents.fill_rect(rect, Color.new(0, 0, 0))  
  82.       rect = Rect.new (30, 78 + 33, 120, 3)  
  83.       @pokemon_amount.contents.fill_rect(rect, Color.new(255, 255, 255))  
  84.       string_viewed = sprintf("% 3s", $game_variables[5000]["pokedex"]["vus"].to_s)  
  85.       string_captured = sprintf("% 3s", $game_variables[5000]["pokedex"]["captures"].to_s)  
  86.       @pokemon_amount.contents.draw_text(0, 37, 155-32, 35, string_viewed, 1)  
  87.       @pokemon_amount.contents.draw_text(0, 78 + 37, 155-32, 35, string_captured, 1)  
  88.        
  89.       @pokemon_list.update  
  90.       @pokemon_list.refresh  
  91.       # Fin Fenêtre principale  
  92.   
  93.        
  94.       Graphics.transition  
  95.       loop do  
  96.         Graphics.update  
  97.         Input.update  
  98.         update  
  99.         if $scene != self  
  100.           break  
  101.         end  
  102.       end  
  103.       Graphics.freeze  
  104.       @pokemon_list.dispose  
  105.       @pokemon_amount.dispose  
  106.       @background.dispose  
  107.       @backbackground.dispose  
  108.     end  
  109.      
  110.     def update  
  111.       @pokemon_list.update  
  112.       @index = @pokemon_list.index  
  113.        
  114.       if Input.trigger?(Input::B)  
  115.         $game_system.se_play($data_system.cancel_se)  
  116.         $scene = POKEMON_S::Pokemon_Menu.new(0)  
  117.         return  
  118.       end  
  119.        
  120.       if Input.trigger?(Input::C)  
  121.         if @show  
  122.           pokemon_id = @table[@index]  
  123.         else  
  124.           pokemon_id = @list[@index]  
  125.         end  
  126.         seen = $data_pokedex[pokemon_id][0]  
  127.         if seen == false  
  128.           $game_system.se_play($data_system.buzzer_se)  
  129.           return  
  130.         end  
  131.         $scene = Pokemon_Detail.new(pokemon_id, @show)  
  132.         return  
  133.       end  
  134.        
  135.       if Input.trigger?(Input::A)  
  136.         @show = @show ? false : true  
  137.         @index = 0  
  138.         @pokemon_list.dispose  
  139.         @pokemon_list = POKEMON_S::Pokemon_List.new(@table, @list, @index, @show)  
  140.         @pokemon_list.active = true  
  141.         @pokemon_list.update  
  142.         @pokemon_list.refresh  
  143.       end  
  144.     end  
  145.   end  
  146.    
  147.    
  148.   class Pokemon_Detail  
  149.     def initialize(id, show, mode = 0, appel = "pkdx", z_level = 100)  
  150.       @id = id  
  151.       @show = show  
  152.       @mode = mode  
  153.       @appel = appel  
  154.       @z_level = z_level  
  155.       @table = []  
  156.       # Regional  
  157.       if POKEMON_S._DEXREG  
  158.         for id in 1..$data_pokedex.length-1  
  159.           @table[Pokemon_Info.id_bis(id)] = id  
  160.         end  
  161.         @table.shift # débarasser l'élément 0  
  162.         @table.compact!  
  163.       else  
  164.       # National  
  165.         for id in 1..$data_pokedex.length-1  
  166.           @table.push(id)  
  167.         end  
  168.       end  
  169.     end  
  170.      
  171.     def main  
  172.       # Fenêtre détail  
  173.       @background = Sprite.new  
  174.       @background.bitmap = RPG::Cache.picture("PokedexShfond1.png")  
  175.       @background.z = @z_level  
  176.        
  177.       # Sprite  
  178.       @pokemon_sprite = Sprite.new  
  179.       @pokemon_sprite.x = 26  
  180.       @pokemon_sprite.y = 71  
  181.       @pokemon_sprite.z = 10 + @z_level  
  182.       @pokemon_sprite.visible = false  
  183.        
  184.       # Identité  
  185.       @data_window = Window_Base.new(233-16, 76-16, 370+32, 196+32)  
  186.       @data_window.contents = Bitmap.new(370, 196)  
  187.       color = Color.new(60,60,60)  
  188.       @data_window.contents.font.name = $fontface  
  189.       @data_window.contents.font.size = $fontsizebig  
  190.       @data_window.contents.font.color = color  
  191.       @data_window.opacity = 0  
  192.       @data_window.z = 10 + @z_level  
  193.       @data_window.visible = false  
  194.        
  195.       # Descr  
  196.       @text_window = Window_Base.new(60 - 16, 252 - 16 + 51, 550 + 32, 160 + 32)  
  197.       @text_window.contents = Bitmap.new(550 , 160)  
  198.       @text_window.contents.font.name = $fontface  
  199.       @text_window.contents.font.size = $fontsize  
  200.       @text_window.contents.font.color = color  
  201.       @text_window.opacity = 0  
  202.       @text_window.z = 10 + @z_level  
  203.       @text_window.visible = false  
  204.        
  205.       @list = []  
  206.       for i in <a href="mailto:0..@table.length">0..@table.length[/url]-1  
  207.         if $data_pokedex[@table[i]][0]  
  208.           @list.push(@table[i])  
  209.         end  
  210.       end  
  211.        
  212.       if @mode == 0  
  213.         filename = "Audio/SE/Cries/" + sprintf("%03d", @id) + "Cry.wav"  
  214.         if FileTest.exist?(filename)  
  215.           Audio.se_play(filename)  
  216.         end  
  217.       end  
  218.        
  219.       data_refresh  
  220.       @background.visible = false  
  221.       @pokemon_sprite.visible = false  
  222.       @data_window.visible = false  
  223.       @text_window.visible = false  
  224.       case @mode  
  225.       when 0  
  226.         @background.visible = true  
  227.         @pokemon_sprite.visible = true  
  228.         @data_window.visible = true  
  229.         @text_window.visible = true  
  230.       when 1  
  231.         refresh_zone  
  232.       when 2  
  233.         refresh_cri  
  234.       when 3  
  235.         refresh_tail  
  236.       end  
  237.          
  238.       Graphics.transition  
  239.       loop do  
  240.         Graphics.update  
  241.         Input.update  
  242.         update  
  243.         if $scene != self  
  244.           break  
  245.         end  
  246.       end  
  247.       Graphics.freeze  
  248.       @background.dispose  
  249.       @data_window.dispose  
  250.       @pokemon_sprite.dispose  
  251.       @text_window.dispose  
  252.     end  
  253.      
  254.     def update  
  255.       case @appel  
  256.       when "pkdx"  
  257.         if Input.trigger?(Input::B)  
  258.           $game_system.se_play($data_system.cancel_se)  
  259.           Graphics.freeze  
  260.           hide  
  261.           if @show  
  262.             index = @table.index(@id)  
  263.           else  
  264.             index = @list.index(@id)  
  265.           end  
  266.           $scene = Pokemon_Pokedex.new(index, @show)  
  267.           return  
  268.         end  
  269.          
  270.         if Input.trigger?(Input::C) and @mode == 1  
  271.           Graphics.freeze  
  272.           hide  
  273.           $game_system.se_play($data_system.decision_se)  
  274.           $game_temp.map_temp = ["PKDX", false, $game_map.map_id, $game_player.x,  
  275.             $game_player.y, $game_player.direction, $game_player.character_name,  
  276.             $game_player.character_hue, $game_player.step_anime,  
  277.             $game_system.menu_disabled, POKEMON_S::_MAPLINK, @id, @show]  
  278.           $game_temp.transition_processing = true  
  279.           $game_temp.transition_name = ""  
  280.           POKEMON_S::_MAPLINK = false  
  281.           $scene = Scene_Map.new  
  282.           $game_map.setup(POKEMON_S::_WMAPID)  
  283.           $game_player.moveto(9, 7)  
  284.           $game_map.autoplay  
  285.           $game_map.update  
  286.           return  
  287.         end  
  288.          
  289.         if Input.trigger?(Input::C) and @mode == 2  
  290.           filename = "Audio/SE/Cries/" + sprintf("%03d", @id) + "Cry.wav"  
  291.           if FileTest.exist?(filename)  
  292.             Audio.se_play(filename)  
  293.           end  
  294.         end  
  295.          
  296.         if Input.trigger?(Input::DOWN)  
  297.           Graphics.freeze  
  298.           index = @list.index(@id)  
  299.           if @id == @list.last  
  300.             @id = @list.first  
  301.           else  
  302.             @id = @list[index+1]  
  303.           end  
  304.           hide  
  305.           Graphics.transition(5)  
  306.           Graphics.freeze  
  307.           @mode = 0  
  308.           data_refresh  
  309.           Graphics.transition  
  310.           filename = "Audio/SE/Cries/" + sprintf("%03d", @id) + "Cry.wav"  
  311.           if FileTest.exist?(filename)  
  312.             Audio.se_play(filename)  
  313.           end  
  314.         end  
  315.          
  316.         if Input.trigger?(Input::UP)  
  317.           Graphics.freeze  
  318.           index = @list.index(@id)  
  319.           if @id == @list.first  
  320.             @id = @list.last  
  321.           else  
  322.             @id = @list[index-1]  
  323.           end  
  324.           hide  
  325.           Graphics.transition(5)  
  326.           Graphics.freeze  
  327.           @mode = 0  
  328.           data_refresh  
  329.           Graphics.transition  
  330.           filename = "Audio/SE/Cries/" + sprintf("%03d", @id) + "Cry.wav"  
  331.           if FileTest.exist?(filename)  
  332.             Audio.se_play(filename)  
  333.           end  
  334.         end  
  335.          
  336.         if Input.trigger?(Input::A) and @pokemon_sprite.visible == false  
  337.           @show = @show ? false : true  
  338.           @index = 0  
  339.           @pokemon_list.dispose  
  340.           @pokemon_list = POKEMON_S::Pokemon_List.new(@list, @index, @show)  
  341.           @pokemon_list.active = true  
  342.           @pokemon_list.update  
  343.           @pokemon_list.refresh  
  344.         end  
  345.          
  346.         if Input.trigger?(Input::LEFT)  
  347.           if @mode > 0  
  348.             Graphics.freeze  
  349.             hide  
  350.             #Graphics.transition(1)  
  351.             @mode -= 1  
  352.             #Graphics.freeze  
  353.             case @mode  
  354.             when 0  
  355.               data_refresh  
  356.             when 1  
  357.               refresh_zone  
  358.             when 2  
  359.               refresh_cri  
  360.             when 3  
  361.               refresh_tail  
  362.             end  
  363.             Graphics.transition(1)  
  364.           end  
  365.         end  
  366.          
  367.         if Input.trigger?(Input::RIGHT)  
  368.           if @mode < 3  
  369.             Graphics.freeze  
  370.             hide  
  371.             #Graphics.transition(1)  
  372.             @mode += 1  
  373.             #Graphics.freeze  
  374.             case @mode  
  375.             when 0  
  376.               data_refresh  
  377.             when 1  
  378.               refresh_zone  
  379.             when 2  
  380.               refresh_cri  
  381.             when 3  
  382.               refresh_tail  
  383.             end  
  384.             Graphics.transition(1)  
  385.           end  
  386.         end  
  387.       when "map"  
  388.         if Input.trigger?(Input::B)  
  389.           $game_system.se_play($data_system.buzzer_se)  
  390.         end  
  391.          
  392.         if Input.trigger?(Input::C)  
  393.           $game_system.se_play($data_system.cancel_se)  
  394.           Graphics.freeze  
  395.           $scene = Scene_Map.new  
  396.           return  
  397.         end  
  398.           
  399.         if Input.trigger?(Input::DOWN)  
  400.           $game_system.se_play($data_system.buzzer_se)  
  401.         end  
  402.          
  403.         if Input.trigger?(Input::UP)  
  404.           $game_system.se_play($data_system.buzzer_se)  
  405.         end  
  406.          
  407.         if Input.trigger?(Input::A)  
  408.           $game_system.se_play($data_system.buzzer_se)  
  409.         end  
  410.          
  411.         if Input.trigger?(Input::LEFT)  
  412.           $game_system.se_play($data_system.buzzer_se)  
  413.         end  
  414.          
  415.         if Input.trigger?(Input::RIGHT)  
  416.           $game_system.se_play($data_system.buzzer_se)  
  417.         end  
  418.       when "combat"  
  419.         if Input.trigger?(Input::B)  
  420.           $game_system.se_play($data_system.buzzer_se)  
  421.         end  
  422.          
  423.         if Input.trigger?(Input::C)  
  424.           $game_system.se_play($data_system.cancel_se)  
  425.           Graphics.freeze  
  426.           self.dispose  
  427.           Graphics.transition  
  428.           return  
  429.         end  
  430.           
  431.         if Input.trigger?(Input::DOWN)  
  432.           $game_system.se_play($data_system.buzzer_se)  
  433.         end  
  434.          
  435.         if Input.trigger?(Input::UP)  
  436.           $game_system.se_play($data_system.buzzer_se)  
  437.         end  
  438.          
  439.         if Input.trigger?(Input::A)  
  440.           $game_system.se_play($data_system.buzzer_se)  
  441.         end  
  442.          
  443.         if Input.trigger?(Input::LEFT)  
  444.           $game_system.se_play($data_system.buzzer_se)  
  445.         end  
  446.          
  447.         if Input.trigger?(Input::RIGHT)  
  448.           $game_system.se_play($data_system.buzzer_se)  
  449.         end  
  450.       end  
  451.     end  
  452.      
  453.     def hide  
  454.       @background.visible = false  
  455.       @pokemon_sprite.visible = false  
  456.       case @mode  
  457.       when 0  
  458.         @data_window.visible = false  
  459.         @text_window.visible = false  
  460.       when 1  
  461.         @text.dispose  
  462.       when 2  
  463.         @data_window.visible = false  
  464.         @text_window.visible = false  
  465.       when 3  
  466.         @trainer.dispose  
  467.         @pokemon_new_sprite.dispose  
  468.         @text.dispose  
  469.       end  
  470.     end  
  471.          
  472.      
  473.     def data_refresh  
  474.       @background.bitmap = RPG::Cache.picture("PokedexShfond1.png")  
  475.       @pokemon_sprite.x = 26  
  476.       @pokemon_sprite.y = 71  
  477.       @data_window.x = 233-16  
  478.       @data_window.y = 76-16  
  479.       @pokemon_sprite.visible = true  
  480.       @background.visible = true  
  481.       @data_window.visible = true  
  482.       @text_window.visible = true  
  483.        
  484.       @pokemon = $data_pokemon[@id]  
  485.       show = $data_pokedex[@id][1]  
  486.       ida = sprintf("%03d", @id)  
  487.       @pokemon_sprite.bitmap = RPG::Cache.battler("Front_Male/" + ida + ".png", 0)  
  488.   
  489.       if POKEMON_S._DEXREG  
  490.         name = "N." + sprintf("%03d", Pokemon_Info.id_bis(@id)) + "  " + @pokemon[0]  
  491.       else  
  492.         name = "N." + ida + "  " + @pokemon[0]  
  493.       end  
  494.   
  495.       if show # Descr accessible  
  496.         species = @pokemon[9][1]  
  497.         height_data = @pokemon[9][2]  
  498.         weight = @pokemon[9][3]  
  499.       else  
  500.         species = "???"  
  501.         height_data = "???"  
  502.         weight = "???  "  
  503.       end  
  504.        
  505.       @data_window.contents.clear  
  506.       @data_window.contents.draw_text(15, 0, 370, 47, name)  
  507.       @data_window.contents.draw_text(15, 41, 370, 47, "Pokémon " + species)  
  508.       @data_window.contents.draw_text(41, 95, 230, 47, "Taille: ")  
  509.       @data_window.contents.draw_text(41, 95, 212, 47, height_data, 2)  
  510.       @data_window.contents.draw_text(41, 148, 230, 47, "Poids: ")  
  511.       @data_window.contents.draw_text(41, 148, 230, 47, weight, 2)  
  512.        
  513.       @text_window.contents.clear  
  514.       if show  
  515.         text = @pokemon[9][0]  
  516.         string = string_builder(text, 51)  
  517.         string1 = string[0]  
  518.         string2 = string[1]  
  519.         string3 = string[2]  
  520.         string4 = string[3]  
  521.         @text_window.contents.draw_text(0, 0, 550, 40, string1)  
  522.         @text_window.contents.draw_text(0, 40, 550, 40, string2)  
  523.         @text_window.contents.draw_text(0, 80, 550, 40, string3)  
  524.         @text_window.contents.draw_text(0, 120, 550, 40, string4)  
  525.       end  
  526.     end  
  527.      
  528.     def refresh_zone  
  529.       @background.bitmap = RPG::Cache.picture("PokedexShfond2.png")  
  530.       @background.visible = true  
  531.       @text = Window_Base.new(32-16, 223-16, 576+32, 47+32)  
  532.       @text.contents = Bitmap.new(576, 47)  
  533.       @text.contents.font.name = $fontface  
  534.       @text.contents.font.size = $fontsizebig  
  535.       @text.contents.font.color = Color.new(60,60,60)  
  536.       @text.contents.draw_text(0, 0, 576, 47, "OUVRIR LA CARTE", 1)  
  537.       @text.opacity = 0  
  538.     end  
  539.      
  540.     def refresh_cri  
  541.       @background.bitmap = RPG::Cache.picture("PokedexShfond3.png")  
  542.       @pokemon_sprite.visible = true  
  543.       @background.visible = true  
  544.       @data_window.visible = true  
  545.       @pokemon_sprite.x = 51  
  546.       @pokemon_sprite.y = 75  
  547.       @data_window.x = 211 - 16  
  548.       @data_window.y = 75 - 5  
  549.       @data_window.contents.clear  
  550.       @data_window.contents.draw_text(0, 0, 339, 47, "CRI DE")  
  551.       @data_window.contents.draw_text(0, 41, 339, 47, @pokemon[0])  
  552.     end  
  553.      
  554.     def refresh_tail  
  555.       @background.bitmap = RPG::Cache.picture("PokedexShfond4.png")  
  556.       @background.visible = true  
  557.       @pokemon_new_sprite = Sprite.new  
  558.       ida = sprintf("%03d", @id)  
  559.       @pokemon_new_sprite.bitmap = RPG::Cache.battler("Front_Male/" + ida + ".png", 0)  
  560.       @pokemon_new_sprite.color = Color.new(0, 0, 0, 255)  
  561.        
  562.       @trainer = Sprite.new  
  563.       @trainer.bitmap = RPG::Cache.battler("trainer000.png", 0)  
  564.       @trainer.color = Color.new(0, 0, 0, 255)  
  565.        
  566.       sizes = []  
  567.       for sprite in [@trainer, @pokemon_new_sprite]  
  568.         i = j = 0  
  569.         while sprite.bitmap.get_pixel(i,j).alpha == 0  
  570.           i += 1  
  571.           if i > sprite.bitmap.width  
  572.             i = 0  
  573.             j += 1  
  574.           end  
  575.         end  
  576.         up_pix = j  
  577.         i = 0  
  578.         j = sprite.bitmap.height  
  579.         while sprite.bitmap.get_pixel(i,j).alpha == 0  
  580.           i += 1  
  581.           if i > sprite.bitmap.width  
  582.             i = 0  
  583.             j -= 1  
  584.           end  
  585.         end  
  586.         down_pix = j  
  587.         sizes.push( down_pix-up_pix + 0.0 )  
  588.         sizes.push( down_pix )  
  589.       end  
  590.        
  591.       if $data_pokemon[@id][9][2].to_f > 1.50  
  592.         zoom_pok = 1.00  
  593.         zoom_dre = 1.50 / $data_pokemon[@id][9][2].to_f * sizes[2] / sizes[0]  
  594.       else  
  595.         zoom_pok = $data_pokemon[@id][9][2].to_f/1.50 * sizes[0] / sizes[2]  
  596.         zoom_dre = 1.00  
  597.       end  
  598.        
  599.       @pokemon_new_sprite.ox = @pokemon_new_sprite.bitmap.width/2  
  600.       @pokemon_new_sprite.oy = sizes[3]#@pokemon_new_sprite.bitmap.height  
  601.       @pokemon_new_sprite.x = 141 + @pokemon_new_sprite.ox  
  602.       @pokemon_new_sprite.y = 92 + 160#@pokemon_new_sprite.oy  
  603.        
  604.       @trainer.ox = @trainer.bitmap.width/2  
  605.       @trainer.oy = sizes[1]#@trainer.bitmap.height  
  606.       @trainer.x = 339 + @trainer.ox  
  607.       @trainer.y = 92 + 160 #@trainer.oy  
  608.        
  609.       @pokemon_new_sprite.zoom_x = @pokemon_new_sprite.zoom_y = zoom_pok  
  610.       @trainer.zoom_x = @trainer.zoom_y = zoom_dre  
  611.        
  612.       @text = Window_Base.new(32-16, 367-16, 576+32, 47+32)  
  613.       @text.contents = Bitmap.new(576, 47)  
  614.       @text.contents.font.name = $fontface  
  615.       @text.contents.font.size = $fontsizebig  
  616.       @text.contents.font.color = Color.new(60,60,60)  
  617.       @text.contents.draw_text(0, 0, 576, 47, "TAILLE COMPARE A #{Player.name}", 1)  
  618.       @text.opacity = 0  
  619.     end  
  620.      
  621.     def string_builder(text, limit)  
  622.       length = text.length  
  623.       full1 = false  
  624.       full2 = false  
  625.       full3 = false  
  626.       full4 = false  
  627.       string1 = ""  
  628.       string2 = ""  
  629.       string3 = ""  
  630.       string4 = ""  
  631.       word = ""  
  632.       for i in 0..length  
  633.         letter = text[i..i]  
  634.         if letter != " " and i != length  
  635.           word += letter.to_s  
  636.         else  
  637.           word = word + " "  
  638.           if (string1 + word).length < limit and not(full1)  
  639.             string1 += word  
  640.             word = ""  
  641.           else  
  642.             full1 = true  
  643.           end  
  644.            
  645.           if (string2 + word).length < limit and not(full2)  
  646.             string2 += word  
  647.             word = ""  
  648.           else  
  649.             full2 = true  
  650.           end  
  651.            
  652.           if (string3 + word).length < limit and not(full3)  
  653.             string3 += word  
  654.             word = ""  
  655.           else  
  656.             full3 = true  
  657.           end  
  658.            
  659.           if (string4 + word).length < limit and not(full4)  
  660.             string4 += word  
  661.             word = ""  
  662.           else  
  663.             full4 = true  
  664.           end  
  665.         end  
  666.       end  
  667.       return [string1, string2, string3, string4]  
  668.     end  
  669.      
  670.      
  671.   end  
  672.    
  673.    
  674.   class Pokemon_List < Window_Selectable  
  675.     def initialize(table, id_list = [], menu_index = 0, show = true, z_level = 100)  
  676.       # show montre les pokémons intermédiaires  
  677.       # id_list liste des pokémons vu/attrapés  
  678.       #super(50-16, 48-16, 560+32, 387+32, 43)  
  679.       @hauteur = 35  
  680.       super(340, 32, 560+32, 384+32, @hauteur)#(640 - 320, 48-16, 560+32, 387+32, 43)  
  681.       @index = menu_index  
  682.       @table = table  
  683.       @id_list = id_list  
  684.       @last = id_list[-1]  
  685.       @show = show  
  686.       @z_level = z_level  
  687.       self.z = @z_level + 100  
  688.       self.opacity = 0  
  689.       if @show  
  690.         value = @table.index(@last)  
  691.         value += 1 if value != nil  
  692.       else  
  693.         value = id_list.length  
  694.       end  
  695.       if value == nil  
  696.         value = 1  
  697.         @last = 1  
  698.       end  
  699.       @flag_up = 0  
  700.       @flag_down = 0  
  701.       @item_max = value  
  702.       @pokeball = Sprite.new  
  703.       @pokeball.bitmap = RPG::Cache.picture("PokedexShBall.png")  
  704.       @pokeball.ox = 150  
  705.       @pokeball.oy = 150  
  706.       @pokeball.y = 240  
  707.       @pokeball.z = 6 + @z_level  
  708.       self.contents = Bitmap.new(width - 32, value * @hauteur)  
  709.       self.contents.font.name = $fontface  
  710.       self.contents.font.size = $fontsize  
  711.       @sprite_array = []  
  712.       for i in 1..5  
  713.         sprite = Sprite.new  
  714.         sprite.z = 4 + @z_level  
  715.         sprite.x = 185  
  716.         sprite.y = -4 + 160*(i-2)  
  717.         @sprite_array.push(sprite)  
  718.       end  
  719.       sprite_refresh  
  720.       @pokeball.angle = - @index * 22.5  
  721.     end  
  722.      
  723.     def dispose  
  724.       super  
  725.       for sprite in @sprite_array  
  726.         sprite.dispose  
  727.       end  
  728.       @pokeball.dispose  
  729.     end  
  730.      
  731.     def update  
  732.       if @flag_up > 0  
  733.         @flag_up -= 1  
  734.         self.oy -= 7  
  735.         #self.oy += 1 if @flag_up == 0  
  736.         @pokeball.angle += 4.5  
  737.         for sprite in @sprite_array  
  738.           sprite.y += 32  
  739.         end  
  740.         if @flag_up == 0  
  741.           @sprite_array.unshift(@sprite_array.pop)  
  742.           @sprite_array[0].y -= 800  
  743.           sprite_refresh  
  744.         end  
  745.         return  
  746.       end  
  747.       if @flag_down > 0  
  748.         @flag_down -= 1  
  749.         self.oy += 7  
  750.         #self.oy -= 1 if @flag_down == 0  
  751.         @pokeball.angle -= 4.5  
  752.         for sprite in @sprite_array  
  753.           sprite.y -= 32  
  754.         end  
  755.         if @flag_down == 0  
  756.           @sprite_array.push(@sprite_array.shift)  
  757.           @sprite_array[4].y += 800  
  758.           sprite_refresh  
  759.         end  
  760.         return  
  761.       end  
  762.       if self.active and @item_max > 0 and @index >= 0  
  763.         if Input.repeat?(Input::DOWN)  
  764.           if (@column_max == 1 and Input.trigger?(Input::DOWN)) or  
  765.              @index < @item_max - @column_max  
  766.             $game_system.se_play($data_system.cursor_se)  
  767.             @index = (@index + @column_max) % @item_max  
  768.             @flag_down += 5  
  769.             return  
  770.           end  
  771.         end  
  772.          
  773.         if Input.repeat?(Input::UP)  
  774.           if (@column_max == 1 and Input.trigger?(Input::UP)) or  
  775.              @index >= @column_max  
  776.             $game_system.se_play($data_system.cursor_se)  
  777.             @index = (@index - @column_max + @item_max) % @item_max  
  778.             @flag_up += 5  
  779.             return  
  780.           end  
  781.         end  
  782.   
  783.         if Input.repeat?(Input::RIGHT)  
  784.           if @column_max >= 2 and @index < @item_max - 1  
  785.             $game_system.se_play($data_system.cursor_se)  
  786.             @index += 1  
  787.           end  
  788.         end  
  789.   
  790.         if Input.repeat?(Input::LEFT)  
  791.           if @column_max >= 2 and @index > 0  
  792.             $game_system.se_play($data_system.cursor_se)  
  793.             @index -= 1  
  794.           end  
  795.         end  
  796.   
  797.         if Input.repeat?(Input::R)  
  798.           if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)  
  799.             $game_system.se_play($data_system.cursor_se)  
  800.             @index = [@index + self.page_item_max - 2, @item_max - 1].min  
  801.             self.top_row += self.page_row_max  
  802.             sprite_refresh  
  803.           end  
  804.         end  
  805.   
  806.         if Input.repeat?(Input::L)  
  807.           if self.top_row > 0  
  808.             $game_system.se_play($data_system.cursor_se)  
  809.             @index = [@index - self.page_item_max + 2, 0].max  
  810.             self.top_row -= self.page_row_max  
  811.             sprite_refresh  
  812.           end  
  813.         end  
  814.       end  
  815.        
  816.       if self.active and @help_window != nil  
  817.         update_help  
  818.       end  
  819.        
  820.       update_cursor_rect  
  821.      
  822.       if @index < 6 and self.oy != 35 + (4-@index) * @hauteur  
  823.         self.oy = -(35 + (4-@index) * @hauteur)  
  824.       end  
  825.     end  
  826.      
  827.     def update_cursor_rect  
  828.       self.cursor_rect.empty  
  829.       row = @index / @column_max  
  830.       if row < self.top_row + 5  
  831.         self.top_row = row - 5  
  832.       end  
  833.       if row > self.top_row + (self.page_row_max - 5)  
  834.         self.top_row = row - (self.page_row_max - 5)  
  835.       end  
  836.     end  
  837.      
  838.     def sprite_refresh  
  839.       for i in 0..4  
  840.         if not @show and $data_pokedex[@id_list[(@index+i-2)%@id_list.length]][0]  
  841.           @sprite_array[i].bitmap = RPG::Cache.battler("Front_Male/#{sprintf('%03d', @id_list[(@index+i-2)%@id_list.length])}.png", 0)  
  842.         elsif @show  
  843.           if $data_pokedex[@table[(@index+i-2)%(@table.index(@last)+1)]][0] #(@index+i-2)%@last + 1)  
  844.             @sprite_array[i].bitmap = RPG::Cache.battler("Front_Male/#{sprintf('%03d', @table[(@index+i-2)%@last])}.png", 0)   
  845.           else  
  846.             @sprite_array[i].bitmap = RPG::Cache.battler("Front_Male/000.png", 0)  
  847.           end  
  848.         end  
  849.       end  
  850.     end  
  851.      
  852.     def refresh  
  853.       self.contents.clear  
  854.       normal_color = Color.new(60,60,60)  
  855.       self.contents.font.color = normal_color  
  856.       i = 0 # désigne l'entrée  
  857.        
  858.       for value in @table  
  859.         if @id_list.include?(value)  
  860.           i += 1  
  861.           ida = sprintf("%03d", @table.index(value) + 1)  
  862.           string = "  N." + ida  
  863.           self.contents.draw_text(10, @hauteur * (i-1), 480, @hauteur, string)  
  864.           string = Pokemon_Info.name(value)  
  865.           self.contents.draw_text(110, @hauteur * (i-1), 300, @hauteur, string)  
  866.           if $data_pokedex[value][1]  
  867.             bitmap = RPG::Cache.picture("Pokedexball.png")  
  868.             self.contents.blt(80, 5 + @hauteur * (i-1), bitmap, Rect.new(0, 0, 24, 24))  
  869.           end  
  870.         elsif @show and i < @table.index(@last) + 1  
  871.           i += 1  
  872.           ida = sprintf("%03d", @table.index(value) + 1)  
  873.           string = "  N." + ida  
  874.           self.contents.draw_text(10, @hauteur * (i-1), 480, @hauteur, string)  
  875.           string = "-------"  
  876.           self.contents.draw_text(110, @hauteur * (i-1), 300, @hauteur, string)  
  877.         elsif i >= @table.index(@last) + 1  
  878.           break  
  879.         else  
  880.           next  
  881.         end  
  882.          
  883.       end  
  884.     end  
  885.      
  886.   end  
  887. end  



voilà!!!

Posté par Ace Attorney Man le 25 Déc - 13:56 (2009)
BAKA, mets le en balise code ! :evil:

Posté par GT.Onizuka le 25 Déc - 21:05 (2009)
J'ai essaié mais ça marche pas ... :? Bahhh tampis...

Posté par Ace Attorney Man le 25 Déc - 21:09 (2009)
*se cogne la tête.*