Créer un animal de compagnie (chat)

 

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

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

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

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

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



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 :
 

Recherche

© 2008 All rights reserved.