#============================================================================== # ■ 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 |