Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ################################################################################
- ############################## BIG FACE ########################################
- ################################################################################
- =begin
- Auteur : Biward
- Version : 2.0
- Fonctionne sur : VXAce
- Date : 17/08/2013 16:47
- Ce script vous permet d'afficher des bigs faces dans vos messages, comme le
- Neo Message sur RPG Maker VX. Pour cela, vous avez uniquement besoin d'une
- variable.
- Pour l'utiliser correctement, suivez le tutoriel suivant.
- Il existe 4 commandes que vous allez pouvoir utiliser :
- - bf_state(actor, number) :
- cette commande va permettre de changer l'état du personnage "actor". L'image
- affichée sera cherchée dans le dossier Faces/Ralph/Ralph_number. Par exemple
- Faces/Ralph/Ralph_1 si number = 1.
- - set_pnj_name("PNJ") :
- cette commande permet de déterminer le nom du PNJ à qui on parle et donc à
- l'image que le script va devoir chercher.
- - set_pnj_state(number) :
- cette commande permet de déterminer l'état du PNJ à qui on parle et donc à
- l'image que le script va devoir chercher.
- - reset_message :
- cette commande permet de réinitialiser tous les paramètres. Cette commande est
- nécessaire si vous ne voulez plus afficher de bigface sur les messages !
- - type_bf(number)
- cette commande permet de gérer le type d'affichage (qui est de base TYPE).
- 1 : fondu ; 2 : par les côtés ; 3 : par le bas
- - reset_type
- cette commande remet à zéro le type d'affichage qui sera à nouveau TYPE
- Suivez les exemples de la démo.
- =end
- module BI
- module BF
- # Indiquez ici la variable qui va stocker l'ID du héro à afficher.
- V1 = 1
- # Indiquez ici la position Y des faces :
- # 416 = hauteur de la fenêtre
- # 288 = hauteur de l'image dans la démo
- POS_Y = 416 - 288
- # Indiquez ici le type d'affichage :
- # 1 : fondu
- # 2 : arrivé depuis les côtés
- # 3 : arrivée d'en dessous
- TYPE = 2
- end
- end
- ################################################################################
- ##### Début du script
- ################################################################################
- ### Cache
- # création des deux commandes de lecteur du fichier BF
- module Cache
- def self.bface(actor, number)
- load_bitmap("Graphics/Faces/#{actor.name}/", "#{actor.name}_#{number}")
- end
- def self.pbface(pnj, number)
- load_bitmap("Graphics/Faces/#{pnj}/", "#{pnj}_#{number}")
- end
- end
- ### Game_Interpreter
- # création des commandes
- class Game_Interpreter
- def bf_state(actor, number)
- $game_bf = Array.new if ! $game_bf
- $game_bf[actor] = number
- end
- def set_pnj_name(name)
- $game_pnj = nil if ! $game_pnj
- $game_pnj[0] = name.to_s
- end
- def reset_message
- $game_bf[$game_variables[BI::BF::V1]] = 0
- $game_variables[BI::BF::V1] = 0
- $game_pnj[0] = nil
- $game_pnj[1] = 0
- end
- def set_pnj_state(number)
- $game_pnj[1] = number
- end
- def update_conversation
- $update_conv = true
- end
- def type_bf(number)
- Spriteset_BigFace.type = number
- end
- def reset_type
- Spriteset_BigFace.type = BI::BF::TYPE
- end
- end
- ### Scene_Title
- # création des variables au début du jeu
- class Scene_Title < Scene_Base
- alias cng_bi command_new_game
- def command_new_game
- $game_bf = Array.new
- $game_pnj = Array.new
- $game_pnj[0] = nil
- $game_pnj[1] = 0
- $data_actors.size.times {$game_bf << 0 }
- Spriteset_BigFace.type = BI::BF::TYPE
- cng_bi
- end
- end
- ### Spriteset_Map
- # modification de certaines méthodes pour
- class Spriteset_Map
- include BI::BF
- alias ibi initialize
- def initialize
- create_bf
- ibi
- end
- def create_bf
- @spritebf = Spriteset_BigFace.new
- end
- def update_bf
- @spritebf.update
- end
- def update_conv
- @spritebf.update_conv
- end
- def dispose_bf
- @spritebf.remove
- end
- end
- ### Spriteset_BigFace
- # creation d'un nouveau spriteset pour la map
- class Spriteset_BigFace
- class << self
- attr_accessor :type
- end
- def initialize
- update
- end
- def p_opacity
- 10.times do
- @sprite.opacity += 25.5 if @sprite
- @sprite2.opacity += 25.5 if @sprite2
- Graphics.wait(1)
- end
- end
- def m_opacity
- 10.times do
- @sprite.opacity -= 25.5 if @sprite
- @sprite2.opacity -= 25.5 if @sprite2
- Graphics.wait(1)
- end
- end
- def p_x
- 10.times do
- @sprite.x += (@sprite.width.to_f - 40.0).to_f / 10 if @sprite.x < -40
- @sprite2.x -= (@sprite2.width.to_f - 40.0).to_f / 10 if @sprite2.x > (Graphics.width - @sprite2.width + 40)
- @sprite.x = -40.0 if @sprite.x > -40
- @sprite2.x = (Graphics.width - @sprite2.width + 40) if @sprite2.x < (Graphics.width - @sprite2.width + 40)
- Graphics.wait(1)
- end
- end
- def m_x
- 10.times do
- @sprite.x -= (@sprite.width.to_f - 40.0).to_f / 10 if @sprite
- @sprite2.x += (@sprite2.width.to_f - 40.0).to_f / 10 if @sprite2
- Graphics.wait(1)
- end
- end
- def p_y
- 10.times do
- @sprite.y -= (Graphics.height - BI::BF::POS_Y.to_f).to_f / 10 if @sprite.y > BI::BF::POS_Y
- @sprite2.y -= (Graphics.height - BI::BF::POS_Y.to_f).to_f / 10 if @sprite2.y > BI::BF::POS_Y
- @sprite.y = BI::BF::POS_Y if @sprite.y < BI::BF::POS_Y
- @sprite2.y = BI::BF::POS_Y if @sprite2.y < BI::BF::POS_Y
- Graphics.wait(1)
- end
- end
- def m_y
- 10.times do
- @sprite.y += (Graphics.height - BI::BF::POS_Y.to_f) / 10 if @sprite
- @sprite2.y += (Graphics.height - BI::BF::POS_Y.to_f) / 10 if @sprite2
- Graphics.wait(1)
- end
- @sprite.y = Graphics.height if @sprite
- @sprite2.y = Graphics.height if @sprite2
- end
- def remove
- @sprite.dispose
- @sprite = nil
- end
- def remove2
- @sprite2.dispose
- @sprite2 = nil
- end
- def update
- if $game_bf && $game_pnj
- if $game_variables[BI::BF::V1] > 0 && $game_bf[$game_variables[BI::BF::V1]] > 0 && ! @sprite && $aff
- @sprite = Sprite.new
- @sprite.bitmap = Cache.bface($game_actors[$game_variables[BI::BF::V1]], $game_bf[$game_variables[BI::BF::V1]])
- if Spriteset_BigFace.type == 1
- @sprite.opacity = 0 if ! $update_conv
- @sprite.x = -40
- @sprite.y = BI::BF::POS_Y
- elsif Spriteset_BigFace.type == 2
- @sprite.x = -@sprite.width
- @sprite.y = BI::BF::POS_Y
- elsif Spriteset_BigFace.type == 3
- @sprite.y = @sprite.height
- @sprite.x = -40
- end
- end
- if $game_pnj[0] != nil && $game_pnj[1] > 0 && $aff && ! @sprite2
- @sprite2 = Sprite.new
- @sprite2.bitmap = Cache.pbface($game_pnj[0], $game_pnj[1])
- @sprite2.y = BI::BF::POS_Y
- if Spriteset_BigFace.type == 1
- @sprite.opacity = 0 if ! $update_conv
- @sprite2.x = Graphics.width - @sprite2.width + 40
- elsif Spriteset_BigFace.type == 2
- @sprite2.x = Graphics.width
- elsif Spriteset_BigFace.type == 3
- @sprite2.y = Graphics.height
- @sprite2.x = Graphics.width - @sprite2.width + 40
- end
- end
- if @sprite || @sprite2
- case Spriteset_BigFace.type
- when 1
- if @sprite.opacity < 255 || @sprite2.opacity < 255
- p_opacity if ! $update_conv
- end
- when 2
- if @sprite.x < -40 || @sprite2.x > (Graphics.width - @sprite2.width + 40)
- p_x if ! $update_conv
- end
- when 3
- if @sprite.y > BI::BF::POS_Y || @sprite2.y > BI::BF::POS_Y
- p_y if ! $update_conv
- end
- end
- end
- if @sprite && ! $aff
- m_opacity if Spriteset_BigFace.type == 1
- m_x if Spriteset_BigFace.type == 2
- m_y if Spriteset_BigFace.type == 3
- remove
- end
- if @sprite2 && ! $aff
- m_opacity if Spriteset_BigFace.type == 1
- m_x if Spriteset_BigFace.type == 2
- m_y if Spriteset_BigFace.type == 3
- remove2
- end
- end
- end
- def update_conv
- remove
- remove2
- update
- $update_conv = false
- end
- end
- ### Scene_Map ###
- # ajout dans l'update
- # et recréation des variables si elles n'existent plus.
- class Scene_Map < Scene_Base
- alias ubi update
- def update
- update_var
- $aff = $game_message.visible
- @spriteset.update_bf
- @spriteset.update_conv if $update_conv
- ubi
- end
- def update_var
- $game_bf = Array.new if ! $game_bf
- if ! $game_pnj
- $game_pnj = Array.new
- $game_pnj[0] = nil
- $game_pnj[1] = 0
- end
- Spriteset_BigFace.type = BI::BF::TYPE if ! Spriteset_BigFace.type
- $data_actors.size.times {$game_bf << 0 }
- end
- end
- ################################################################################
- ##### Fin du script
- ################################################################################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement