Chasseur41 Admin
Nombre de messages : 49 Age : 31 Localisation : Vendôme (41) et Tours (37) Loisirs : Création de jeu, musique, livre et sortit Date d'inscription : 04/07/2007
Feuille de personnage Prénom du Personnage: Brutus Nom du Personnage: Macligan Âge du Personnage: 28 ans
| Sujet: Améliorez c'est caractéristique. Jeu 5 Juil - 19:23 | |
| Ce" script permet de faire apparaitre une fenêtre ou il est possible de faire évoluer les caractéristiques des personnages de l'équipe. Ce genre de script est souvent demandé, le voilà ! Pour commencer , créez un nouveau script au dessus de main, nommez le : Window_caracplus Collez ceci à l' intérieur : - Code:
-
#======================================================================= # ■ Distribution de point de caractéristiques # ■ Scene_caracplus v1.0 par Krazplay #======================================================================= # Ecrit par Krazplay, version la plus à jour disponible sur le forum du site rpgmakerxp.free.fr # Nécessite : le scrîpt Window_caracplus # Description : # Permet de donner des points à distribuer à n'importe quel personnage de l'équipe entre ses # 4 caractéristiques principales (force, agilité, dextérité et intelligence). # Utilisation : # A l'aide de la ligne de scrîpt suivante dans n'importe quel scrîpt ou évènement : # $scene = Scene_caracplus.new(acteurs, points à distribuer) # Attention, ces deux variables doivent être des arrays (tableaux). # MAUVAIS exemples : acteurs = $game_party.actors[0] points = 10 # BONS exemples : acteurs = [$game_party.actors[0]] points = [10] # Ainsi pour donner 8 point au premier héro de l'équipe et 5 points au troisième, la bonne commande sera : # $scene = Scene_caracplus.new([$game_party.actors[0], $game_party.actors[2]], [8,5]) # Pour donner 10 points à toute l'équipe on écrirait : # $scene = Scene_caracplus.new($game_party.actors, [10,10,10,10]) # Oui $game_party.actors est déjà un tableau donc il n'a pas besoin de crochets supplémentaires # Eviter de distribuer 0 ou nil point, enlever plutôt l'acteur de la variable.
#SCRIPT PERMETTANT DE DEPENSER DE3S POIINTS DE CARCTERISTIK
#======================================================================= class Scene_caracplus def initialize(actors, pointgagnés, n=0) @n = n @actors = actors @pg = pointgagnés @pointgagnés = pointgagnés[n] @actor = actors[n] @confirmation = false end def main @caracplus_window = Window_Caracplus.new(@actor,@pointgagnés) Graphics.transition loop do Graphics.update Input.update update_command if $scene != self @caracplus_window.dispose Graphics.update if @actors.size > @n+1 and @pg[@n+1] != nil $scene = Scene_caracplus.new(@actors, @pg, @n+1) else if @actors.size > @n+2 and @pg[@n+2] != nil $scene = Scene_caracplus.new(@actors, @pg, @n+2) else if @actors.size > @n+3 and @pg[@n+3] != nil $scene = Scene_caracplus.new(@actors, @pg, @n+3) end end end break end end end #main def update_command if Input.trigger?(Input::DOWN) and @confirmation != true @caracplus_window.ligneplusun @caracplus_window.refresh end if Input.trigger?(Input::UP) and @confirmation != true @caracplus_window.lignemoinsun @caracplus_window.refresh end if Input.trigger?(Input::LEFT) and @confirmation != true @caracplus_window.pointmoinsun @caracplus_window.refresh end if Input.trigger?(Input::RIGHT) and @confirmation != true @caracplus_window.pointplusun @caracplus_window.refresh end if Input.trigger?(Input::B) and @confirmation != true #Cancel @caracplus_window.pointazero @caracplus_window.refresh end if Input.trigger?(Input::B) and @confirmation == true #Cancel @confirmation = false @confirmer_window.dispose end if Input.trigger?(Input::C) #Confirmer if @confirmation == true @confirmation = false @confirmer_window.dispose @caracplus_window.terminer $scene = Scene_Map.new else if @caracplus_window.toutestbon? == true and @confirmation != true @confirmer_window = Window_confirmer.new(450,20) @confirmation = true end end end if Input.trigger?(Input::X) #Touche A for i in 0..14 @caracplus_window.pointmoinsun end @caracplus_window.refresh end if Input.trigger?(Input::A) #Touche Z for i in 0..14 @caracplus_window.pointplusun end @caracplus_window.refresh end end end
#======================================================================= # ■ Distribution de point de caractéristiques # ■ Window_caracplus v1.0 par Krazplay #======================================================================= # Ecrit par Krazplay, version la plus à jour disponible sur le forum du site rpgmakerxp.free.fr # Nécessite : le scrîpt Scene_caracplus # Description et Utilisation décris dans le scrîpt Scene_caraplus #======================================================================= class Window_Caracplus < Window_Base def initialize(actor,pointgagnés) super(5, 5, 630, 470) @ligne = 0 @actor = actor @statplus = [0,0,0,0] @pointgagnés = pointgagnés @pointarépartir = pointgagnés self.contents = Bitmap.new(width-32, height-32) self.contents.font.name = "Arial" self.contents.font.size = 24 self.contents.clear deséquipement @str = actor.str @dex = actor.dex @agi = actor.agi @int = actor.int @carac = [@str, @dex, @agi, @int] refresh end def refresh self.contents.clear self.cursor_rect.set(190, (240 + 30*@ligne), 175, 30) actor = @actor self.contents.font.name = "Arial" self.contents.font.color = normal_color self.draw_actor_battler(actor, 90, 270) self.draw_actor_graphic(actor, 80, 140) self.contents.font.size = 26 longueur = contents.text_size(actor.name).width self.draw_actor_name(actor, self.width/2-longueur/2, 10) self.contents.font.size = 24 self.contents.draw_text(0, 50, self.width, 32, actor.class_name.to_s+" Lv "+actor.level.to_s, 1) self.draw_actor_exp(actor, 200, 78) self.draw_actor_hp(actor, 200, 101, width = 144) self.draw_actor_sp(actor, 200, 124, width = 144) équiper self.draw_actor_parameter(actor, 200, 150, 0) self.draw_actor_parameter(actor, 200, 175, 1) self.draw_actor_parameter(actor, 200, 200, 2) deséquipement self.contents.font.color = system_color self.contents.draw_text(200, 240, 120, 32, $data_system.words.str) self.contents.draw_text(200, 270, 120, 32, $data_system.words.dex) self.contents.draw_text(200, 300, 120, 32, $data_system.words.agi) self.contents.draw_text(200, 330, 120, 32, $data_system.words.int) self.contents.font.color = normal_color self.contents.draw_text(320, 240, 36, 32, @str.to_s, 2) self.contents.draw_text(320, 270, 36, 32, @dex.to_s, 2) self.contents.draw_text(320, 300, 36, 32, @agi.to_s, 2) self.contents.draw_text(320, 330, 36, 32, @int.to_s, 2) for i in 0..3 self.contents.font.color = Color.new(255, 155, 155, 255) self.contents.draw_text(370, 240+30*i, 36, 32, "+") self.contents.draw_text(390, 240+30*i, 36, 32, @statplus[i].to_s, 2) self.contents.font.color = Color.new(155, 255, 155, 255) self.contents.draw_text(450, 240+30*i, 36, 32, "=") stat = @carac[i] + @statplus[i] self.contents.draw_text(490, 240+30*i, 36, 32, stat.to_s, 2) end self.contents.font.color = normal_color self.contents.draw_text(50, 380, 320, 32, "Nombre de points à répartir :") self.contents.draw_text(330, 380, 36, 32, @pointarépartir.to_s, 2) self.contents.draw_text(430, 150, 108, 32, "[A/Z = (-15)/(+15)]") self.contents.draw_text(430, 175, 72, 32, "[X = Reset]") end def ligneplusun if @ligne<3 @ligne += 1 end end def lignemoinsun if @ligne>0 @ligne -= 1 end end def pointmoinsun i = @ligne if @statplus[i]-1 > -1 @statplus[i] -= 1 @pointarépartir += 1 end end def pointplusun i = @ligne if @pointarépartir > 0 and @statplus[i]+@carac[i]+1 < 1000 @statplus[i] += 1 @pointarépartir -= 1 end end def pointazero @statplus = [0,0,0,0] @pointarépartir = @pointgagnés end def toutestbon? if @pointarépartir == 0 return true else return false end end def terminer $game_actors[@actor.id].str += @statplus[0] $game_actors[@actor.id].dex += @statplus[1] $game_actors[@actor.id].agi += @statplus[2] $game_actors[@actor.id].int += @statplus[3] @actor.equip(0, @weapon_id) @actor.equip(1, @armor1_id) @actor.equip(2, @armor2_id) @actor.equip(3, @armor3_id) @actor.equip(4, @armor4_id) end def équiper @actor.equip(0, @weapon_id) @actor.equip(1, @armor1_id) @actor.equip(2, @armor2_id) @actor.equip(3, @armor3_id) @actor.equip(4, @armor4_id) end def deséquipement @weapon_id = @actor.weapon_id @armor1_id = @actor.armor1_id @armor2_id = @actor.armor2_id @armor3_id = @actor.armor3_id @armor4_id = @actor.armor4_id @actor.equip(0, 0) @actor.equip(1, 0) @actor.equip(2, 0) @actor.equip(3, 0) @actor.equip(4, 0) end def draw_actor_battler(actor, x, y) bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue) cw = bitmap.width ch = bitmap.height src_rect = Rect.new(0, 0, cw, ch) self.contents.blt(x - cw / 2, y - ch / 2, bitmap, src_rect) end end
class Window_confirmer < Window_Base def initialize(x,y) super(x, y, 150, 64) self.contents = Bitmap.new(width-32, height-32) self.contents.font.name = "Arial" self.contents.font.size = 24 self.contents.draw_text(0, 0, 120, 32, "Confirmer ?") end end Pour accéder à cette fenetre , Mettez dans un événement sur la map "insérér un script" qui se trouve en page 3. Vous n'avez qu'a mettre ceci : $scene = Scene_caracplus.new($game_party.actors, [10,10,10,10]) Les "10" représentent le nombre de point de caractéristique à utiliser .Si vous voulez que le 2eme perso en est que 5 vous faite ... 10 , 5 , 10 , 10 et voila . Des inforamations sont donnés au début du script (dans le script !) Pour les expérimentés en événements ,vous pourrez créer un magasin ou des points de caractéristiques sont vendus ... Avec une carte de fidélité ou au bout d' un certain nombre de caractéristique achetés , hop une oferte pour chaque membre de l' équipe ... etc Vola bon making !
Dernière édition par le Sam 3 Nov - 12:27, édité 1 fois | |
|