nara bakura Prophete
Nombre de messages : 55 Date d'inscription : 24/06/2007
Fueille de participation Niveau: 3 points d'Exp: (55/200)
| Sujet: animal de compagnie Mar 3 Juil - 18:27 | |
| Ecrit par le Webmaster : Etape 1 : Les scripts Il y a 4 scripts. Ce tuto vous fera faire un chat. Voici les scripts a placer au dessu de Main : Window_Chat - Code:
-
#================================ #Window_Chat par mysterio #pour faire un animal de companie. #================================
class Window_Chat < Window_Base #==================================# #==================================# def initialize super(0, 0, 160, 96) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = $fontface self.contents.font.size = $fontsize refresh end #================================ def refresh self.contents.clear self.contents.font.color = system_color bitmap = RPG::Cache.icon("Chat") src_rect = Rect.new(0, 0, bitmap.width, bitmap.height) self.contents.blt(5, y+32, bitmap, src_rect) self.contents.draw_text(0,0,500,32,"Pussy Cat" ) self.contents.draw_text(40,30,500,32,"LV" ) self.contents.font.color = normal_color self.contents.draw_text(80,30,500,32,$game_variables[36].to_s) end end Window_Chat2 : - Code:
-
#================================ #Window_Chat2 par mysterio #pour faire un animal de companie. #================================
class Window_Chat2 < Window_Base #==================================# #==================================# def initialize super(0, 0, 160, 96) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = $fontface self.contents.font.size = $fontsize refresh end #================================ def refresh if $game_switches[8] == true self.contents.clear self.contents.font.color = system_color bitmap = RPG::Cache.icon("Viande") src_rect = Rect.new(0, 0, bitmap.width, bitmap.height) self.contents.blt(5, y+32, bitmap, src_rect) self.contents.draw_text(0,0,500,32,"Bol" ) self.contents.font.color = normal_color self.contents.draw_text(40,30,500,32,"Plein" ) end else if $game_switches[8] == false self.contents.clear self.contents.font.color = system_color bitmap = RPG::Cache.icon("Viande") src_rect = Rect.new(0, 0, bitmap.width, bitmap.height) self.contents.blt(5, y+32, bitmap, src_rect) self.contents.draw_text(0,0,500,32,"Bol" ) self.contents.font.color = normal_color self.contents.draw_text(40,30,500,32,"Vide" ) end end end Window_Chat3 : - Code:
-
#================================ #Window_Chat 3 par mysterio #pour faire un animal de companie. #================================
class Window_Chat3 < Window_Base #==================================# #==================================# def initialize super(0, 0, 160, 96) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = $fontface self.contents.font.size = $fontsize refresh end #================================ def refresh if $game_switches[9] == true self.contents.clear self.contents.font.color = system_color bitmap = RPG::Cache.icon("Savon") src_rect = Rect.new(0, 0, bitmap.width, bitmap.height) self.contents.blt(5, y+32, bitmap, src_rect) self.contents.draw_text(0,0,500,32,"Propret?" ) self.contents.font.color = normal_color self.contents.draw_text(40,30,500,32,"Propre" ) end else if $game_switches[9] == false self.contents.clear self.contents.font.color = system_color bitmap = RPG::Cache.icon("Savon") src_rect = Rect.new(0, 0, bitmap.width, bitmap.height) self.contents.blt(5, y+32, bitmap, src_rect) self.contents.draw_text(0,0,500,32,"Propret?" ) self.contents.font.color = normal_color self.contents.draw_text(40,30,500,32,"Sale" ) end end end Et Window_Chat4 : - Code:
-
#================================ #Window_Chat4 par mysterio #pour faire un animal de companie. #================================
class Window_Chat4 < Window_Base #==================================# #==================================# def initialize super(0, 0, 160, 96) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = $fontface self.contents.font.size = $fontsize refresh end #================================ def refresh if $game_switches[10] == true self.contents.clear self.contents.font.color = system_color bitmap = RPG::Cache.icon("Cadeau 2") src_rect = Rect.new(0, 0, bitmap.width, bitmap.height) self.contents.blt(5, y+32, bitmap, src_rect) self.contents.draw_text(0,0,500,32,"Joie" ) self.contents.font.color = normal_color self.contents.draw_text(40,30,500,32,"Heureux" ) end else if $game_switches[10] == false self.contents.clear self.contents.font.color = system_color bitmap = RPG::Cache.icon("Cadeau 2") src_rect = Rect.new(0, 0, bitmap.width, bitmap.height) self.contents.blt(5, y+32, bitmap, src_rect) self.contents.draw_text(0,0,500,32,"Joie" ) self.contents.font.color = normal_color self.contents.draw_text(40,30,500,32,"Triste" ) end end end Voila. Une petite explication des scripts : Window_Chat permet d'afficher le NIVEAU du chat (facultatif) Window_chat 2 est pour la faim Window_chat 3 pour la salet? Window_chat 4 pour la joie. Window_Chat : Ligne 23 = Le nom du chat. Changez selon vos envies. Window_Chat : Ligne 26 = La variable utilis?e pour le niveau. Changez selon vos besoins. Window_Chat 2 : Lignes 21 et 32 = icone de la nourriture. Changez selon vos envies aussi. Window_Chat 2 : Lignes 18 et 29 = switch utilis?. Changez selon vos besoins. Les 2 autres scripts sont pareils. Changez selon vos besoins et envies. ------------------------------------------------------ Ceci fait, attaquons nous ? la Partie 2. Etape 2 : Evenement. Faites un ?venement avec une apparence de chat Par la touche action - Code:
-
Jouer un effet sonore (SE) : "O67-Animal02" tempo 100, volume 80.
Scr?pt :: @miaou = Window_Chat.new @miaou.x = 0 @miaou.y = 0 @miaou2 = Window_Chat2.new @miaou2.x = 161 @miaou2.y = 0 @miaou3 = Window_Chat3.new @miaou3.x = 322 @miaou3.y = 0 @miaou4 = Window_Chat4.new @miaou4.x = 483 @miaou4.y = 0
Mettre une ?tiquette : chat
Message : Que voulez vous faire ?
Choix : [Nourrir],[laver],[caresser],[rien]
si [Nourrir] : Condition : interrupteur [0008] = on Msg : Ton chat n'a pas faim. Sauter vers l'?tiquette : chat. sinon Condition : Argent =/> 3 Msg : Tu as nourri ton chat pour 3 PO. Monnaie : -3 Variable [0037 : Exp du chat] + 1 Interrupteur [0008] = on Scr?pt : @miaou.dispose @miaou2.dispose @miaou3.dispose @miaou4.dispose Scr?pt : @miaou = Window_Chat.new @miaou.x = 0 @miaou.y = 0 @miaou2 = Window_Chat2.new @miaou2.x = 161 @miaou2.y = 0 @miaou3 = Window_Chat3.new @miaou3.x = 322 @miaou3.y = 0 @miaou4 = Window_Chat4.new @miaou4.x = 483 @miaou4.y = 0 Sauter vers l'?tiquette : chat sinon Msg : Nourrir ton chat co?te 3 PO ! Sauter vers l'?tiquette : chat end end
Si [Laver] faire : Condition : interrupteur [0009] = on Msg : Ton chat est propre. Sauter vers l'?tiquette : chat. sinon Condition : Argent =/> 2 Msg : Tu as nourri ton chat pour 2 PO. Monnaie : -2 Variable [0037 : Exp du chat] + 1 Interrupteur [0009] = on Scr?pt : @miaou.dispose @miaou2.dispose @miaou3.dispose @miaou4.dispose Scr?pt : @miaou = Window_Chat.new @miaou.x = 0 @miaou.y = 0 @miaou2 = Window_Chat2.new @miaou2.x = 161 @miaou2.y = 0 @miaou3 = Window_Chat3.new @miaou3.x = 322 @miaou3.y = 0 @miaou4 = Window_Chat4.new @miaou4.x = 483 @miaou4.y = 0 Sauter vers l'?tiquette : chat sinon Msg : Laver ton chat co?te 2 PO ! Sauter vers l'?tiquette : chat end end
Si [Carresser] faire : Condition : interrupteur [0010] = on Msg : Ton chat est d?ja tr?s heureux. Sauter vers l'?tiquette : chat. sinon Msg : Tu grattouille le ventre de ton petit animal.Il adore ?a ! Variable [0037 : Exp du chat] + 1 Interrupteur [0010] = on Scr?pt : @miaou.dispose @miaou2.dispose @miaou3.dispose @miaou4.dispose Scr?pt : @miaou = Window_Chat.new @miaou.x = 0 @miaou.y = 0 @miaou2 = Window_Chat2.new @miaou2.x = 161 @miaou2.y = 0 @miaou3 = Window_Chat3.new @miaou3.x = 322 @miaou3.y = 0 @miaou4 = Window_Chat4.new @miaou4.x = 483 @miaou4.y = 0 Sauter vers l'?tiquette : chat end
Si [Rien] faire : Scr?pt : @miaou.dispose @miaou2.dispose @miaou3.dispose @miaou4.dispose end Voila ! Maintenant, que je vous explique l'histoire du niveau. Par exemple, faites un ?venement commun en // d?clench? par le switch du d?but de votre jeu. Condition : variable [0037 : Exp de chat] = 6 msg : (H?ros1) peut d?sormais courir ! Switch [nuberofswitch] = on fin Mais bon ensuite pour le faire courir, c'est vous qui voyez ! Je vais pas tout vous faire, hein ! :cheesygrin: ------------------------------------------------------ Etape 3 : Update. Faites un event sur un lit. Par la touche action msg : Dormir ? choix : [oui] , [non] Si [oui] faire : T?l?porter ?quipe, (sur le lit),Bas, Pas de fondu. D?placer/modifier event : H?ros Modifier l'apparence : (Apparence de votre h?ros qui dort, dans "Down") attendre 10 frames Modifier le ton de l'?cran, R:255,V:255,B:255,S:0, 20 frames. attendre 20 frames Switches [0008],[0009],[0010] = off modifier le ton de l'?cran ,R:0,V:0,B:0,S:0, 20frames attendre 20 frames D?lacer/modifier event : H?ros Modifier apparence : (apparence normale du h?ros) T?l?porter ?quipe, (a cot? du lit),Droite, Pas de fondu. Msg : Tu as bien dormi ! <> Si [Non] faire : <> fin <> Voila ! J'?sp?re avoir pu ?tre utile ! Voici un p'tit screen : | |
|