Sujet n°14085
Posté par Schneitizel le 24 Aoû - 01:56 (2014)
Titre : Echanges entre PNJ détaillés
Salut à toutes et à tous !

Je viens vous présenter mon script d'échange internet, à quoi sert-il ? A faire des échanges avec les autres PNJ !

GroNeuNeu a écrit:
Ui mé y a gold ki a déja fé 1 scirt pour sa !!!!!


Tu as raison, cependant le script de Gold peut être dur d'utilisation pour les débutants, et dispose de fonction un peu plus réduites... Comme le manque d'ajout du pokémon au pokédex

Comment ça marche ? C'est très simple !
Copier/coller déjà ce script au dessus de main, appelez le comme vous voulez

Code:
#==============================================================================
# ■ Echange_interne
# Schneitizel - Crédits obligatoires
# 24/08/2014
#
# - Permet de faire des échanges internes, avec un PNJ etc...
#-----------------------------------------------------------------------------
# - Utilisation :
#
#    Dans un appel de script, mettez
#
#  echange_interne(1, 2, 50, [...])
#
#  où :
#    1 = Index du pokémon dans l'équipe (1er pokemon = 0, 2eme pokemon = 1 etc...)
#    2 = ID ou nom entre "" du pokémon reçu
#    50 = Niveau du pokémon qui va être reçu, pour mettre le niveau du pokemon que vous donnez, mettez -1
#    [...] suis une syntaxe en plus :
#
#    ["DO", "Onche"] remplace le Dresseur D'origine du pokemon par Onche
#    ["IDo", "00000"] remplace le n°Dresseur D'origine du pokemon par 00000
#    ["NIVEAU", 100] remplace le niveau du pokemon par 100
#    ["SURNOM", "Palbolsky"] remplace le surnom du pokemon par Palbolsky
#    ["SHINY", true] true = Le pokemon est shiny / False = Non shiny
#    ["ATTAQUES", [1, 2, 3, nil]] remplace les attaques par les id respectifs, mettre nil pour aucune attaque
#    ["TALENT", 100] remplace la cap spé/talent par son ID (Voir Pokemon_Data)
#    ["OBJET", 1] Fais tenir au pokemon l'objet n°1
#    ["NATURE", 1] remplace la nature du pokemon par son id (Voir Pokemon)
#    ["EV", [0, 255, 255, 0, 0, 0]] Remplace les EV par ceux renseignés, dans l'ordre : PV - Attaque - Defense - Vitesse - Attaque Speciale - Defense Specale
#    ["IV", [31, 31, 31, 31, 31, 31]] Pareil que EV
#    ["GENRE", 0] Modifie le sexe du pokémon : 0 sans genre - 1 male - 2 femelle
#    ["BONHEUR", 255] Modifie le bonheur du pokemon (0 - 255)
#    ["BALL", 1] Change l'ID de la ball avec laquelle le pokemon a été capturé (Voir Data_ball.txt)
#    ["FORM", 02] Change la forme du pokemon (Zarbi etc...)
#    ["OEUF", true] True donne un oeuf / False pas dans un oeuf
#
#    Donc si je veux crée un Tortkank, je peux mettre :

#  appel_menu_equipe
#  echange_interne(var(4), "TORTANK", -1, [["DO", "Schneitizel"], ["IDo", "00001"], ["SHINY", true], ["ATTAQUES", ["HYDROCANON", "SURF", 2, 4]], ["IV", [31, 31, 31, 31, 31, 31]]])
#
#
#    va me generer un Tortkank de niveau du pokemon que je propose à l'echange, avec Schneitizel comme
#    dresseur d'origine, avec un ID dresseur de 00001 (utile pour les gains d'exp), qui connait forcément
#    les attaques Hydrocanon et Surf, ainsi que les attaques d'ID 2 et 4 de mon projet et qui a 31 IV partout !
#
#-----------------------------------------------------------------------------

class Interpreter
  def echange_interne(index, id_pokemon, id_niveau = 1, plus = [])
    if index <= -1
      p "Aucun pokemon choisit ou le pokemon choisit n'est pas valide."
      return
    end
    if id_niveau == -1
      id_niveau = $pokemon_party.actors[index].level
      end
    pokemon = Pokemon.new(id_pokemon, id_niveau)
    if plus != []
    for a in 0..plus.size-1
      if plus[a][0] == "DO"
        pokemon.trainer_name = plus[a][1]
      elsif plus[a][0] == "IDo"
        pokemon.trainer_id = plus[a][1].to_s
      elsif plus[a][0] == "NIVEAU"
        pokemon.level = plus[a][1]
      elsif plus[a][0] == "SURNOM"
        pokemon.given_name = plus[a][1].to_s
      elsif plus[a][0] == "SHINY"
        pokemon.shiny = plus[a][1]
      elsif plus[a][0] == "ATTAQUES"
        for b in 0..plus[a][1].size-1
        pokemon.replace_skill_index(b, plus[a][1][b])
        end
      elsif plus[a][0] == "TALENT"
        pokemon.ability = plus[a][1]
      elsif plus[a][0] == "OBJET"
        if plus[a][1].type == String
        pokemon.item_name = plus[a][1]
          else
        pokemon.item_hold = plus[a][1]
        end
      elsif plus[a][0] == "NATURE"
        pokemon.nature_modifier(plus[a][1])
      elsif plus[a][0] == "EV"
        pokemon.ev_modifier(plus[a][1])
      elsif plus[a][0] == "IV"
        pokemon.iv_modifier(plus[a][1])
      elsif plus[a][0] == "GENRE"
      pokemon.gender = plus[a][1]
      elsif plus[a][0] == "BONHEUR"
        pokemon.loyalty = plus[a][1]
      elsif plus[a][0] == "BALL"
        pokemon.ball_data = $data_ball[plus[a][1]]
      elsif plus[a][0] == "FORME"
        pokemon.form = plus[a][1]
      elsif plus[a][0] == "OEUF"
        pokemon.egg = plus[a][1]
      end
    end
  end
  id = nil
  $pokemon_party.actors[index] = pokemon
  if id_pokemon.type == String
    $data_pokedex[id_conversion(id_pokemon)] = [true, true]
    else
  $data_pokedex[id_pokemon] = [true, true]
end

for i in 0..$pokemon_party.actors[index].evolve_list.size-1 
    for j in 0..$pokemon_party.actors[index].evolve_list[i].size-1
      if $pokemon_party.actors[index].evolve_list[i][j] == "trade"
        id = id_conversion($pokemon_party.actors[index].evolve_list[i][0])
        break
      end
    end
  end
  if id != nil
    Graphics.freeze 
    scene = POKEMON_S::Pokemon_Evolve.new($pokemon_party.actors[index], id, 5000, false)
    scene.main 
   Graphics.transition 
   $data_pokedex[id] = [true, true]
   $pokemon_party.actors[index].evolve(id)
   id = nil
 end
 
  end
end


Maintenant, passons à l'event, faites un PNJ qui demande tel pokémon, appelez le choix d'équipe via "appel_menu_equipe" et selectionnez le pokémon, faites une condition toute simple pour savoir si le pokémon dans la variable 4 est l'id du pokémon cherché par le PNJ, et si oui, faites l'échange ! Dans ce cas, il faudra appeller via un script :

Code:
echange_interne(index, id_pokemon, id_niveau = 1, plus = [])


GroNeuNeu a écrit:
Popopo C du chinoi sa jme tire


Non, reste la, car c'est à la portée du premiere venu Imbécile heureux
Et oui, dis comme ça, on peut se dire qu'on y comprend rien, mais c'est simple :

Index est le numéro du pokemon dans l'équipe, si vous avez fait un appel_menu_equipe avant, mettre "var(4)" (Sans les "") suffit)
id_pokemon est l'ID nationnal OU le nom entre "" du pokémon que le joueur va recevoir
id_niveau correspond au niveau du pokémon que va recevoir le joueur, vous pouvez mettre -1 directement pour que le pokémon reçu ai le niveau du pokémon donné (Comme dans les originaux !)
Et plus est different, car il s'agit d'un tableau complet ! Il faut mettre :

Code:
 ["DO", "Onche"] # remplace le Dresseur D'origine du pokemon par Onche
 ["IDo", "00000"] # remplace le n°Dresseur D'origine du pokemon par 00000
 ["NIVEAU", 100] # remplace le niveau du pokemon par 100
 ["SURNOM", "Palbolsky"] # remplace le surnom du pokemon par Palbolsky
 ["SHINY", true] # true = Le pokemon est shiny / False = Non shiny
 ["ATTAQUES", [1, 2, 3, nil]] # remplace les attaques par les id respectifs, mettre nil pour aucune attaque
 ["TALENT", 100] # remplace la cap spé/talent par son ID (Voir Pokemon_Data)
 ["OBJET", 1] # Fais tenir au l'objet n°1
 ["NATURE", 1] # remplace la nature du pokemon par son id (Voir Pokemon)
 ["EV", [0, 255, 255, 0, 0, 0]] # Remplace les EV par ceux renseignés, dans l'ordre : PV - Attaque - Defense - Vitesse - Attaque Speciale - Defense Specale
 ["IV", [31, 31, 31, 31, 31, 31]] # Pareil que EV
 ["GENRE", 0] # Modifie le sexe du pokémon : 0 sans genre - 1 male - 2 femelle
 ["BONHEUR", 255] # Modifie le bonheur du pokemon (0 - 255)
 ["BALL", 1] # Change l'ID de la ball avec laquelle le pokemon a été capturé (Voir Data_ball.txt)
 ["FORM", 02] # Change la forme du pokemon (Zarbi etc...)
 ["OEUF", true] # True donne un oeuf / False pas dans un oeuf


Tout ça, dans un seul et unique tableau.

Petit exemple, je veux échanger mon Bulbizarre Nv 10 contre un Carapuce, l'event serait :

Message : Salut, tu as un Bulbizarre ?
Script : appel_menu_equipe
Condition : Si script : $pokemon_party.actors[var(4)].id = 1
Bien, je te fais l'échange
Script :
echange_interne(3, "CARAPUCE", -1, [["DO", "Jean-Eude"], ["IDo", "85412"], ["SURNOM", "TroBg"], ["OBJET", "POTION"], ["GENRE", 1], ["ATTAQUES", ["VAMPIGRAINE", "HYDROBLAST", "CHARGE", nil]], ["EV", [255, 255, 255, 255, 255, 255]]])
Sinon
Message : Ce n'est pas Bulbizarre
Fin de condition

Avec cet exemple, je me met en index 3 (Donc 4eme pokémon de l'équipe) un Carapuce qui a Jean-Eude comme dresseur d'origine, 85412 comme ID d'origine, TroBg comme surnom, qui tient l'objet Potion, qui est un mâle, qui connais les attaques Vampigraine, Hydroblast et Charge et qui a 255 EV partout, abusé non ? Imbécile heureux

Il n'est pas nécessaire de mettre tout les paramètres de Plus pour générer le pokémon, ni même dans l'ordre, je pourrais mettre OEUF en premier et DO en dernier que ça ne changerai rien !

-- Crédits obligatoires --

- Schneitizel / Code original
- Nuri Yuri / Suggestions

N'hesitez pas à poster vos suggestions et vos rapports de bugs, je vous reponderai au plus vite Imbécile heureux

Posté par Nuri Yuri le 24 Aoû - 10:03 (2014)
Le Pokémon évolue après échange ?

Posté par Schneitizel le 24 Aoû - 10:32 (2014)
Pourquoi faire ?
Si le PNJ propose un spectrum, autant donner directement un ectoplasma non ?

Posté par Nuri Yuri le 24 Aoû - 10:54 (2014)
Bah non justement.

Posté par Schneitizel le 24 Aoû - 11:31 (2014)
Bah ça apporte quoi de plus ? x)

Posté par Nuri Yuri le 24 Aoû - 11:43 (2014)
Ça respecte les normes du jeu copié, ça démontre l'évolution en échange pour les nouveaux joueurs.

Posté par Schneitizel le 24 Aoû - 12:36 (2014)
Toujours LE detail pour tuer hein ? x)
Bon, je ponderai une version toute a l'heure, ou ce soir, ou demain, je sais pas, qui ajoutera ça

EDIT : Version 1.1 qui gère maintenant automatique les evolutions si le pokémon evolue en cas d'échange, merci Nuri Yuri pour ton idée qui m'a fait perdre 30 minutes :D
+ Les crédits deviennent obligatoires

Posté par Tokeur le 24 Aoû - 16:58 (2014)
On doit pas avoir le même script Pokemon parce que ya plein de méthode que je n'ai pas dans celles que tu utilises ^^' Comme gender, où il faut utiliser set_gender, ou encore ev_modifier, nature_modifier et iv_modifier ^^'
Pour les attaque, lorsque l'on mettais nil, il prenais le nil pour un ID et donc il arrivait pas à le convertir en int ou un truc du genre ^^'
Et aussi yavait un problème avec les objets lorsqu'on mettait le nom en String et non en ID (soit int).
(Et aussi un détail minime, au début t'utile p, j'aurai utilisé print parce qu'avec p, ça afficherai avec les guillemets je crois, cc Yuri d: )
Et j'ai aussi ajouté une animation tirée du script d'échange en temps réel de Sphinx puis modifiée à la va-vite.
Le script d'animation nécessite le script SpritePlan de Sphinx aussi :

SpritePlan
Code:
#=============================================================================== 
# SpritePlan cree par Sphinx pour PSP, le 17 mai 2009. 
# Credits demandes. 
#=============================================================================== 
class SpritePlan 
   
  def initialize(x, y, width, height, speed = 3) 
    @sprites = [] 
    @sprites_name = [] 
    @width = width 
    @height = height 
    @x = x 
    @y = y 
    @speed = speed 
  end 
   
  def [](no_sprite) 
    if @sprites[no_sprite] == nil 
      @sprites[no_sprite] = Sprite.new 
      @sprites[no_sprite].x = @x 
      @sprites[no_sprite].y = @y 
    end 
    return @sprites[no_sprite] 
  end 
   
  def []=(no_sprite, nom) 
    if @sprites[no_sprite] == nil 
      @sprites[no_sprite] = Sprite.new 
      @sprites[no_sprite].x = @x 
      @sprites[no_sprite].y = @y 
    end
    @sprites[no_sprite].bitmap = RPG::Cache.picture(nom)
    @sprites_name[no_sprite] = nom 
  end
 
  def ajouterSprite(no_sprite, sprite)
    @sprites[no_sprite] = sprite
  end
   
  def wait(frames) 
    i = 0 
    loop do 
      break if i == frames 
      i += 1 
      Graphics.update 
    end 
  end 
   
  def move_sprite(no_sprite, x, y, speed = @speed) 
    if x > 0 or y > 0 
      min = [x, y].min 
      max = [x, y].max 
      speed = 2.0 ** speed 
      tempx = @sprites[no_sprite].x 
      tempy = @sprites[no_sprite].y 
      for i in 0...(max.abs / speed).plancher 
        if max == x 
          @sprites[no_sprite].x += speed * x.sgn 
          if y >= 0 
            @sprites[no_sprite].y += ((y * speed / x) * y.sgn).arrondi 
          else 
            @sprites[no_sprite].y -= ((y * speed / x) * y.sgn).arrondi 
          end 
        else 
          if x >= 0 
            @sprites[no_sprite].x += ((x * speed / y) * x.sgn).arrondi 
          else 
            @sprites[no_sprite].x -= ((x * speed / y) * x.sgn).arrondi 
          end 
          @sprites[no_sprite].y += speed * y.sgn 
        end 
        update 
        Graphics.update 
        wait(2) 
      end 
    else 
      min = [x, y].max 
      max = [x, y].min 
      speed = 2.0 ** speed 
      tempx = @sprites[no_sprite].x 
      tempy = @sprites[no_sprite].y 
      for i in 0...(max.abs / speed).plancher 
        if max == x 
          @sprites[no_sprite].x += speed * x.sgn 
          if y >= 0 
            @sprites[no_sprite].y += ((y * speed / x) * y.sgn).arrondi 
          else 
            @sprites[no_sprite].y -= ((y * speed / x) * y.sgn).arrondi 
          end 
        else 
          if x >= 0 
            @sprites[no_sprite].x += ((x * speed / y) * x.sgn).arrondi 
          else 
            @sprites[no_sprite].x -= ((x * speed / y) * x.sgn).arrondi 
          end 
          @sprites[no_sprite].y += speed * y.sgn 
        end 
        update 
        Graphics.update 
        wait(2) 
      end 
    end 
    @sprites[no_sprite].x -= (@sprites[no_sprite].x - tempx) - x 
    @sprites[no_sprite].y -= (@sprites[no_sprite].y - tempy) - y 
    update 
  end 
   
  def update 
    for i in 0... @sprites.size 
      @sprites[i].bitmap.dispose 
      @sprites[i].bitmap = RPG::Cache.picture(@sprites_name[i]) 
      # Le sprite est il en dehors du cadre : 
      #   par la gauche : 
      if @sprites[i].x < @x 
        @sprites[i].bitmap.fill_rect(0, 0, @x - @sprites[i].x, @sprites[i].bitmap.height, Color.new(0, 0, 0, 0)) 
      end 
      #   par le haut : 
      if @sprites[i].y < @y 
        @sprites[i].bitmap.fill_rect(0, 0, @sprites[i].bitmap.width, @y - @sprites[i].y, Color.new(0, 0, 0, 0)) 
      end 
      #   par la droite : 
      if @sprites[i].x + @sprites[i].bitmap.width > @x + @width 
        @sprites[i].bitmap.fill_rect(@x + @width - @sprites[i].x, 0, (@sprites[i].x + @sprites[i].bitmap.width) - (@x + @width), @sprites[i].bitmap.height, Color.new(0, 0, 0, 0)) 
      end 
      #   par le bas : 
      if @sprites[i].y + @sprites[i].bitmap.height > @y + @height 
        @sprites[i].bitmap.fill_rect(0, @y + @height - @sprites[i].y, @sprites[i].bitmap.width, (@sprites[i].y + @sprites[i].bitmap.height) - (@y + @height), Color.new(0, 0, 0, 0)) 
      end 
      @sprites[i].update 
    end 
  end 
   
end


Pour ce qui est de l'échange interne, je l'ai modifié pour qu'il fonctionne avec mon script Pokemon (j'pense que c'est celui de PSP 0.7) et j'ai rajouté la possibilité de mettre l'animation, mais je l'ai fini à la va-vite parce qu'entre temps j'suis tombé à moit' malade donc j'ai pas eu le courage de le finir vraiment. Du coup j'pense qu'il reste quelques corrections à apporter ou des amélioration à faire ^^'

EchangeInterne
Code:
#==============================================================================   
# ■ Echange_interne 
# Schneitizel - Crédits obligatoires
# Modifié par Tokeur pour l'animation d'échange
# Animation d'échange tirée du script Echange en temps réel 2.0 de Sphinx
# 24/08/2014 

# - Permet de faire des échanges internes, avec un PNJ etc... 
#-----------------------------------------------------------------------------   
# - Utilisation : 

#    Dans un appel de script, mettez 

#  echange_interne(1, 2, 50, [...]) 

#  où : 
#    1 = Index du pokémon dans l'équipe (1er pokemon = 0, 2eme pokemon = 1 etc...) 
#    2 = ID ou nom entre "" du pokémon reçu 
#    50 = Niveau du pokémon qui va être reçu, pour mettre le niveau du pokemon que vous donnez, mettez -1 
#    [...] suis une syntaxe en plus : 

#    ["DO", "Onche"] remplace le Dresseur D'origine du pokemon par Onche 
#    ["IDo", "00000"] remplace le n°Dresseur D'origine du pokemon par 00000 
#    ["NIVEAU", 100] remplace le niveau du pokemon par 100 
#    ["SURNOM", "Palbolsky"] remplace le surnom du pokemon par Palbolsky 
#    ["SHINY", true] true = Le pokemon est shiny / False = Non shiny 
#    ["ATTAQUES", [1, 2, 3, nil]] remplace les attaques par les id respectifs, mettre nil pour aucune attaque 
#    ["TALENT", 100] remplace la cap spé/talent par son ID (Voir Pokemon_Data) 
#    ["OBJET", 1] Fais tenir au pokemon l'objet n°1 
#    ["NATURE", 1] remplace la nature du pokemon par son id (Voir Pokemon) 
#    ["EV", [0, 255, 255, 0, 0, 0]] Remplace les EV par ceux renseignés, dans l'ordre : PV - Attaque - Defense - Vitesse - Attaque Speciale - Defense Specale 
#    ["IV", [31, 31, 31, 31, 31, 31]] Pareil que EV 
#    ["GENRE", 0] Modifie le sexe du pokémon : 0 sans genre - 1 male - 2 femelle   
#    ["BONHEUR", 255] Modifie le bonheur du pokemon (0 - 255) 
#    ["BALL", 1] Change l'ID de la ball avec laquelle le pokemon a été capturé (Voir Data_ball.txt) 
#    ["FORM", 02] Change la forme du pokemon (Zarbi etc...) 
#    ["OEUF", true] True donne un oeuf / False pas dans un oeuf 

#    Donc si je veux crée un Tortkank, je peux mettre : 
#   
#  appel_menu_equipe 
#  echange_interne(var(4), "TORTANK", -1, [["DO", "Schneitizel"], ["IDo", "00001"], ["SHINY", true], ["ATTAQUES", ["HYDROCANON", "SURF", 2, 4]], ["IV", [31, 31, 31, 31, 31, 31]]]) 


#    va me generer un Tortkank de niveau du pokemon que je propose à l'echange, avec Schneitizel comme 
#    dresseur d'origine, avec un ID dresseur de 00001 (utile pour les gains d'exp), qui connait forcément 
#    les attaques Hydrocanon et Surf, ainsi que les attaques d'ID 2 et 4 de mon projet et qui a 31 IV partout ! 

#----------------------------------------------------------------------------- 
 
class Interpreter 
  def echange_interne(index, id_pokemon, id_niveau = 1, plus = [], animation = false) 
    if index <= -1 
      p "Aucun pokemon choisit ou le pokemon choisit n'est pas valide." 
      return 
    end 
   
    if id_niveau == -1 
      id_niveau = $pokemon_party.actors[index].level 
    end 
   
    pokemon = Pokemon.new(id_pokemon, id_niveau) 
   
    if plus != [] 
      for a in 0..plus.size-1 
        if plus[a][0] == "DO" 
          pokemon.trainer_name = plus[a][1] 
        elsif plus[a][0] == "IDo" 
          pokemon.trainer_id = plus[a][1].to_s 
        elsif plus[a][0] == "NIVEAU" 
          pokemon.level = plus[a][1] 
        elsif plus[a][0] == "SURNOM" 
          pokemon.given_name = plus[a][1].to_s 
        elsif plus[a][0] == "SHINY" 
          pokemon.shiny = plus[a][1] 
        elsif plus[a][0] == "ATTAQUES" 
          for b in 0..plus[a][1].size-1
            if plus[a][1][b]
              pokemon.replace_skill_index(b, plus[a][1][b])
            else
              pokemon.forget_skill_index(b)
            end
          end 
        elsif plus[a][0] == "TALENT" 
          pokemon.ability = plus[a][1] 
        elsif plus[a][0] == "OBJET" 
          if plus[a][1].type == String 
            pokemon.item_hold = Item.id(plus[a][1]) 
          else 
            pokemon.item_hold = plus[a][1] 
          end 
        elsif plus[a][0] == "NATURE" 
          #// pokemon.nature_modifier(plus[a][1]) 
        elsif plus[a][0] == "EV" 
          #// pokemon.battle_list = plus[a][1] 
        elsif plus[a][0] == "IV" 
          #// pokemon.iv_modifier(plus[a][1]) 
        elsif plus[a][0] == "GENRE" 
          pokemon.set_gender(plus[a][1]) 
        elsif plus[a][0] == "BONHEUR" 
          pokemon.loyalty = plus[a][1] 
        elsif plus[a][0] == "BALL" 
          pokemon.ball_data = $data_ball[plus[a][1]] 
        elsif plus[a][0] == "FORME" 
          pokemon.form = plus[a][1] 
        elsif plus[a][0] == "OEUF" 
          pokemon.egg = plus[a][1] 
        end 
      end 
    end 
   
    if animation
      animation_echange($pokemon_party.actors[index], pokemon)
    end
   
    id = nil 
    $pokemon_party.actors[index] = pokemon
   
    if id_pokemon.type == String 
      $data_pokedex[id_conversion(id_pokemon)] = [true, true] 
    else 
      $data_pokedex[id_pokemon] = [true, true] 
    end 
   
    for i in 0..$pokemon_party.actors[index].evolve_list.size-1   
      for j in 0..$pokemon_party.actors[index].evolve_list[i].size-1   
        if $pokemon_party.actors[index].evolve_list[i][j] == "trade" 
          id = id_conversion($pokemon_party.actors[index].evolve_list[i][0]) 
          break 
        end 
      end 
    end 
   
    if id != nil 
      Graphics.freeze   
      scene = POKEMON_S::Pokemon_Evolve.new($pokemon_party.actors[index], id, 5000, false) 
      scene.main   
      Graphics.transition   
      $data_pokedex[id] = [true, true] 
      $pokemon_party.actors[index].evolve(id) 
      id = nil 
    end 
  end
 
 
    def animation_echange(pokemon_envoye, pokemon_recu) 
      Graphics.freeze 
     
      # Fenetre de texte
      @text_window = Window_Base.new(4, 340, 632, 136)
      @text_window.opacity = 0
      @text_window.z = 520
      @text_window.contents = Bitmap.new(600 + 32, 104 + 32)
      @text_window.contents.font.name = $fontface
      @text_window.contents.font.size = $fontsizebig
     
      spritePlan = SpritePlan.new(0, 0, 640, 480) 
      # Fond 
      spritePlan[2] = "echange_fond.png" 
      spritePlan[2].z = 500 
     
      # Interface 1-1 
      spritePlan[4] = "echange_interface1-1.png" 
      spritePlan[4].x = 29 
      spritePlan[4].y = 94 
      spritePlan[4].z = 750
      spritePlan[4].visible = false 
      # Interface 1-2 
      spritePlan[5] = "echange_interface1-2.png" 
      spritePlan[5].x = 55 
      spritePlan[5].y = 120 
      spritePlan[5].z = 650
      spritePlan[5].visible = false 
      # Interface 1-3 
      spritePlan[6] = "echange_interface1-3.png" 
      spritePlan[6].x = 291 
      spritePlan[6].y = 175 
      spritePlan[6].z = 550 
      spritePlan[6].visible = false 
      # Interface 2 
      spritePlan[7] = "echange_interface2.png" 
      spritePlan[7].x = 0 
      spritePlan[7].y = 86 
      spritePlan[7].z = 550 
      spritePlan[7].visible = false 
      # Interface 3 n°1 
      spritePlan[8] = "echange_interface3.png" 
      spritePlan[8].x = 0 
      spritePlan[8].y = 0 
      spritePlan[8].z = 600
      spritePlan[8].visible = false 
      # Interface 3 n°2 
      spritePlan[9] = "echange_interface3.png" 
      spritePlan[9].x = 0 
      spritePlan[9].y = 0 
      spritePlan[9].z = 600
      spritePlan[9].visible = false 
      # Barre de progression 
      spritePlan[10] = "echange_barre.png" 
      spritePlan[10].x = 67 
      spritePlan[10].y = 298 
      spritePlan[10].z = 800 
      spritePlan[10].zoom_x = 0 
      # Sprite du pokémon envoyé 
      tmpSprite = Sprite.new 
      tmpSprite.x = -500 
      tmpSprite.y = -500 
      tmpSprite.zoom_x = 0 
      tmpSprite.zoom_y = 0 
      tmpSprite.z = 700 
      tmpSprite.bitmap = RPG::Cache.battler(pokemon_envoye.battler_face, 0) 
      spritePlan.ajouterSprite(11, tmpSprite)
      # Icone du pokémon envoyé 
      tmpSprite = Sprite.new 
      tmpSprite.x = -500 
      tmpSprite.y = -500 
      tmpSprite.zoom_x = 0 
      tmpSprite.zoom_y = 0 
      tmpSprite.z = 700 
      tmpSprite.bitmap = RPG::Cache.battler(pokemon_envoye.icon, 0) 
      spritePlan.ajouterSprite(12, tmpSprite) 
      # Icone du pokémon recu 
      tmpSprite = Sprite.new 
      tmpSprite.x = -500 
      tmpSprite.y = -500 
      tmpSprite.zoom_x = 0 
      tmpSprite.zoom_y = 0 
      tmpSprite.z = 700 
      tmpSprite.bitmap = RPG::Cache.battler(pokemon_recu.icon, 0) 
      spritePlan.ajouterSprite(13, tmpSprite) 
      # Sprite du pokémon recu 
      tmpSprite = Sprite.new 
      tmpSprite.x = -500 
      tmpSprite.y = -500 
      tmpSprite.zoom_x = 0 
      tmpSprite.zoom_y = 0 
      tmpSprite.z = 700 
      tmpSprite.bitmap = RPG::Cache.battler(pokemon_recu.battler_face, 0) 
      spritePlan.ajouterSprite(16, tmpSprite) 
      Graphics.transition 
       
      wait(50) 
       
      Graphics.freeze 
      spritePlan[4].visible = true 
      spritePlan[5].visible = true 
      spritePlan[6].visible = true 
      Graphics.transition 
       
      Graphics.freeze 
      spritePlan[11].zoom_x = 0.8 
      spritePlan[11].zoom_y = 0.8 
      spritePlan[11].x = 55 + (212 - spritePlan[11].bitmap.width * spritePlan[11].zoom_x) / 2 
      spritePlan[11].y = 120 + (144 - spritePlan[11].bitmap.height * spritePlan[11].zoom_y) / 2 
      Graphics.transition 
       
      Audio.bgm_stop 
       
      draw_text("Au revoir, " "#{pokemon_envoye.given_name}.") 
      if FileTest.exist?(pokemon_envoye.cry) 
        Audio.se_play(pokemon_envoye.cry) 
      end 
       
      wait(10) 
      Audio.bgm_play("Audio/BGM/PkmRS-Evolving", 80, 100) 
       
      while spritePlan[10].zoom_x < 1 
        spritePlan[10].zoom_x += 0.0075 
        if spritePlan[10].zoom_x < 0.5 
          spritePlan[11].zoom_x -= 0.012 
          spritePlan[11].zoom_y -= 0.012 
          spritePlan[11].x = 55 + (212 - spritePlan[11].bitmap.width * spritePlan[11].zoom_x) / 2 
          spritePlan[11].y = 120 + (144 - spritePlan[11].bitmap.height * spritePlan[11].zoom_y) / 2 
        elsif spritePlan[10].zoom_x == 0.5 
          spritePlan[11].visible = false 
          spritePlan[12].zoom_x = 0 
          spritePlan[12].zoom_y = 0.015 
          spritePlan[12].x = 55 + (212 - spritePlan[12].bitmap.width * spritePlan[12].zoom_x) / 2 
          spritePlan[12].y = 120 + (144 - spritePlan[12].bitmap.height * spritePlan[12].zoom_x) / 2 
        elsif spritePlan[10].zoom_x > 0.5 
          spritePlan[12].zoom_x += 0.015 
          spritePlan[12].zoom_y += 0.015 
          spritePlan[12].x = 55 + (212 - spritePlan[12].bitmap.width * spritePlan[12].zoom_x) / 2 
          spritePlan[12].y = 120 + (144 - spritePlan[12].bitmap.height * spritePlan[12].zoom_x) / 2 
        end 
        Graphics.update 
      end 
       
      wait(20) 
       
      vitesse = 1 
      spritePlan[8].x = spritePlan[12].x - ((spritePlan[8].bitmap.width - (spritePlan[12].bitmap.width * spritePlan[12].zoom_x)) / 2) 
      spritePlan[8].y = 158 
      spritePlan[8].visible = true 
      while spritePlan[8].x <= 640 
        if spritePlan[12].zoom_x > 0.25 and spritePlan[12].zoom_y > 0.25 
          spritePlan[12].zoom_x -= 0.0075 
          spritePlan[12].zoom_y -= 0.0075 
          spritePlan[12].y = 120 + (144 - spritePlan[12].bitmap.height * spritePlan[12].zoom_x) / 2 
          spritePlan[8].x = spritePlan[12].x - ((spritePlan[8].bitmap.width - (spritePlan[12].bitmap.width * spritePlan[12].zoom_x)) / 2) 
          spritePlan[8].y = 158 
        end 
        if spritePlan[12].x >= 267 and spritePlan[12].x < 270 
          vitesse = 5 
          Audio.se_play("Audio/SE/Pokemove") 
        end 
        spritePlan[8].x += 3 * vitesse 
        spritePlan[12].x += 3 * vitesse 
        Graphics.update 
      end 
       
      wait(20) 
       
      Graphics.freeze 
      spritePlan[4].visible = false 
      spritePlan[5].visible = false 
      spritePlan[6].visible = false 
      spritePlan[7].visible = true 
      spritePlan[10].visible = false 
      spritePlan[11].visible = false 
      spritePlan[8].x = -spritePlan[8].bitmap.width 
      spritePlan[8].y = 69 
      spritePlan[12].x = spritePlan[8].x + ((spritePlan[8].bitmap.width - (spritePlan[12].bitmap.width * spritePlan[12].zoom_x)) / 2) 
      spritePlan[12].y = 86 + (34 - spritePlan[12].bitmap.height * spritePlan[12].zoom_x) / 2 
      spritePlan[9].visible = true 
      spritePlan[9].x = 640 
      spritePlan[9].y = 173 
      spritePlan[13].zoom_x = 0.5 
      spritePlan[13].zoom_y = 0.5 
      spritePlan[13].x = spritePlan[9].x + ((spritePlan[9].bitmap.width - (spritePlan[13].bitmap.width * spritePlan[13].zoom_x)) / 2) 
      spritePlan[13].y = 192 + (34 - spritePlan[13].bitmap.height * spritePlan[13].zoom_x) / 2 
      Graphics.transition 
       
      wait(20) 
       
      while spritePlan[8].x <= 640 
        spritePlan[8].x += 15 
        spritePlan[12].x += 15 
        spritePlan[9].x -= 15 
        spritePlan[13].x -= 15 
        Graphics.update 
      end 
       
      wait(20) 
       
      Graphics.freeze 
      spritePlan[4].visible = true 
      spritePlan[5].visible = true 
      spritePlan[6].visible = true 
      spritePlan[7].visible = false 
      spritePlan[10].visible = true 
      spritePlan[8].visible = false 
      spritePlan[12].visible = false 
      spritePlan[10].zoom_x = 0 
      spritePlan[9].x = 640 
      spritePlan[9].y = 158 
      spritePlan[13].x = spritePlan[9].x + ((spritePlan[9].bitmap.width - (spritePlan[13].bitmap.width * spritePlan[13].zoom_x)) / 2) 
      spritePlan[13].y = 120 + (144 - spritePlan[13].bitmap.height * spritePlan[13].zoom_x) / 2 
      Graphics.transition 
       
      vitesse = 5 
      while spritePlan[13].x >= 55 + (212 - spritePlan[13].bitmap.width * spritePlan[13].zoom_x) / 2 
        if spritePlan[13].x <= 270 and spritePlan[13].zoom_x < 1 and spritePlan[13].zoom_y < 1 
          spritePlan[13].zoom_x += 0.0075 
          spritePlan[13].zoom_y += 0.0075 
          spritePlan[13].y = 120 + (144 - spritePlan[13].bitmap.height * spritePlan[13].zoom_x) / 2 
        end 
        if spritePlan[13].x >= 267 and spritePlan[13].x < 282 
          Audio.se_play("Audio/SE/Pokemove") 
          vitesse = 1 
          spritePlan[9].visible = false 
        end 
        spritePlan[9].x -= 3 * vitesse 
        spritePlan[13].x -= 3 * vitesse 
        Graphics.update 
      end 
       
      wait(20) 
       
      while spritePlan[10].zoom_x < 1 
        spritePlan[10].zoom_x += 0.0075 
        if spritePlan[10].zoom_x < 0.5 
          spritePlan[13].zoom_x -= 0.015 
          spritePlan[13].zoom_y -= 0.015 
          spritePlan[13].x = 55 + (212 - spritePlan[13].bitmap.width * spritePlan[13].zoom_x) / 2 
          spritePlan[13].y = 120 + (144 - spritePlan[13].bitmap.height * spritePlan[13].zoom_y) / 2 
        elsif spritePlan[10].zoom_x == 0.5 
          spritePlan[13].visible = false 
          spritePlan[16].zoom_x = 0 
          spritePlan[16].zoom_y = 0.012 
          spritePlan[16].x = 55 + (212 - spritePlan[16].bitmap.width * spritePlan[16].zoom_x) / 2 
          spritePlan[16].y = 120 + (144 - spritePlan[16].bitmap.height * spritePlan[16].zoom_x) / 2 
        elsif spritePlan[10].zoom_x > 0.5 
          spritePlan[16].zoom_x += 0.012 
          spritePlan[16].zoom_y += 0.012 
          spritePlan[16].x = 55 + (212 - spritePlan[16].bitmap.width * spritePlan[16].zoom_x) / 2 
          spritePlan[16].y = 120 + (144 - spritePlan[16].bitmap.height * spritePlan[16].zoom_x) / 2 
        end 
        Graphics.update 
      end 
       
      Audio.bgm_stop 
      wait(10) 
       
      if FileTest.exist?(pokemon_recu.cry) 
        Audio.se_play(pokemon_recu.cry) 
      end 
       
      draw_text("#{pokemon_recu.trainer_name} vous a envoyé", "#{pokemon_recu.given_name}.")
       
      Audio.me_play("Audio/ME/Caughtjingle", 80, 100) 
      wait(80) 
      Audio.bgm_play("Audio/BGM/PkmRS-MtChimney", 80, 100) 
       
      Graphics.freeze 
      spritePlan[4].dispose 
      spritePlan[5].dispose 
      spritePlan[6].dispose 
      spritePlan[7].dispose 
      spritePlan[10].dispose 
      spritePlan[8].dispose 
      spritePlan[9].dispose 
      spritePlan[11].dispose 
      spritePlan[12].dispose 
      spritePlan[13].dispose 
      spritePlan[16].dispose 
    end   

    def draw_text_(line1 = "", line2 = "")
      if line1.type == Array
        if line1[1] != nil
          draw_text(line1[0], line1[1])
        else
          draw_text(line1[0])
        end
      else
        Graphics.freeze
        @text_window.contents.clear
        @text_window.draw_text(12, 0, 460, 50, line1)
        @text_window.draw_text(12, 55, 460, 50, line2)
        Graphics.transition(5)
      end
    end
   
    def draw_text(line1 = "", line2 = "")
      draw_text_(line1, line2)
      loop do
        Graphics.update
        Input.update
        if Input.trigger?(Input::C)
          $game_system.se_play($data_system.decision_se)
          break
        end
      end
    end
   
    def wait(frame) 
      for i in 0..frame 
        Graphics.update 
      end 
    end 


end 


Pour mettre une animation, rajoutez simplement true à la fin, exemple :
echange_interne(3, "CARAPUCE", -1, [["DO", "Jean-Eude"], ["IDo", "85412"], ["SURNOM", "TroBg"], ["OBJET", "POTION"], ["GENRE", 1], ["ATTAQUES", ["VAMPIGRAINE", "HYDROBLAST", "CHARGE", nil]], ["EV", [255, 255, 255, 255, 255, 255]]], true)

PS : J'avais oublié de mettre les fichiers ressources, Merci à elric54 pour les avoir retrouvés ! ^^ http://ga3cgvr0r0.1fichier.com/

Posté par Nuri Yuri le 24 Aoû - 17:37 (2014)
Mon dieu, arrêtez d'utiliser Sprite_Plan >.< Ce script ne fait que montrer votre ignorance envers les bases du RGSS.
http://www.pokemontrash.com/club/rpg-maker/tuto-n3-utilisation-des-viewport…

Posté par Tokeur le 24 Aoû - 17:47 (2014)
ça, fallait le dire à Sphinx lorsqu'il faisait son animation d'échange ._.

Posté par Schneitizel le 24 Aoû - 21:45 (2014)
J'ai codé le truc sous 4g+, il est possible qu'il dois être adaptable pour les autres SK ^^

Posté par Girakoth le 25 Aoû - 00:53 (2014)
Cette concurrence, on dirait Quick et MacDo XD

Posté par Schneitizel le 25 Aoû - 01:03 (2014)
Girakoth a écrit:
Cette concurrence, on dirait Quick et MacDo XD


En l'occurence, je fais le McDo, c'est beau, c'est bon, mais ça vous engraisse jusqu'au point de non-retour de ça vous transforme en hamster dans mes aires de jeux avec plein de tuyaux \o/

Posté par Nuri Yuri le 25 Aoû - 09:01 (2014)
Concurrence entre Quick et MacDo ? Dafuq ?
La vraie concurrence c'est entre MacDo et KFC, Quick est dans la même catégorie que Flunch Coupable
Sinon, Schneitizel, MacDo c'est le restau super cher qui te rempli pas le ventre et qui n'a que de bon le CBO donc si tu t'alignes là dessus pour ton script