SYSTEME DE POURCENTAGE
Bonjour/rebonjour,
Ceci est la version amélioré de mon premier script !
Je vous présente mon script pour faire une système qui permet au joueur de voir a quel pourcentage du jeu il est rendu !
En plus, vous pouvez mettre un commentaire suivant le pourcentage du joueur !
C'est a dire, que par exmple le joueur est a 56%, vous pouvez lui mettre le message "tu est sur la bonne voix" !
Donc ce système est constituer de trois script !
Il faut mettre les trois script dans l'ordre donner ici et au dessus du script main (tout en bas)!
C'est a dire:
-Window_Pourcent
-Window_Steps
-Scene_Menu
-Main
SCRIPT
Script n°1 a nomé "
Window_Pourcent":
- Code: Tout sélectionner
#==============================================================================
# ** Système de pourcentage
#------------------------------------------------------------------------------
# Bubblebug
# v2.0
# 01/03.2011
#==============================================================================
# Le pourcentage est définie dans la variable n°1 !
# Donc pour modifier le pourcentage, modifié la variable n°1 !
#==============================================================================
class Window_Pourcent < Window_Base
def initialize
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, "Avancement")
@total_sec = $game_variables[1]
text = $game_variables[1]
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 100, 32, text.to_s, 2)
self.contents.draw_text(4, 32, 125, 32, "%", 2)
end
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end
Script n°2 a nomé "
Window_Steps":
- Code: Tout sélectionner
#==============================================================================
# ** Système de pourcentage
#------------------------------------------------------------------------------
# Bubblebug
# v2.0
# 01/03.2011
#==============================================================================
# Le pourcentage est définie dans la variable n°1 !
# Donc pour modifier le pourcentage, modifié la variable n°1 !
#==============================================================================
class Window_Steps < Window_Base
def option #Reglez comme vous voulez !
@afficher = true #Mettre "true" pour afficher les commentaire, mettre "false" pour les masquer !
end
def initialize
option
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
if @afficher == true
if $game_variables[1] <= 25
commentaire = "Tu débute"
end
if $game_variables[1] >= 26
if $game_variables[1] <= 50
commentaire = "Tu es bon"
end
end
if $game_variables[1] >= 51
if $game_variables[1] <= 75
commentaire = "Tu es fort"
end
end
if $game_variables[1] >= 76
if $game_variables[1] <= 99
commentaire = "Tu es puissant"
end
end
if $game_variables[1] == 100
commentaire = "Tu as fini"
end
if $game_variables[1] < 0
commentaire = "Erreur (-)"
end
if $game_variables[1] > 100
commentaire = "Erreur (+)"
end
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, "Commentaire")
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, commentaire.to_s)
end
end
end
Script n°3 a nomé "
Scene_Menu":
- Code: Tout sélectionner
#==============================================================================
# ** Système de pourcentage
#------------------------------------------------------------------------------
# Bubblebug
# v2.0
# 01/03.2011
#==============================================================================
# Le pourcentage est définie dans la variable n°1 !
# Donc pour modifier le pourcentage, modifié la variable n°1 !
#==============================================================================
class Scene_Menu
def initialize(menu_index = 0)
@menu_index = menu_index
end
def main
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Statut"
s5 = "Sauvegarder"
s6 = "Quitter le jeu"
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
@command_window.index = @menu_index
if $game_party.actors.size == 0
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
if $game_system.save_disabled
@command_window.disable_item(4)
end
@pourcent_window = Window_Pourcent.new
@pourcent_window.x = 0
@pourcent_window.y = 224
@steps_window = Window_Steps.new
@steps_window.x = 0
@steps_window.y = 320
@gold_window = Window_Gold.new
@gold_window.x = 0
@gold_window.y = 416
@status_window = Window_MenuStatus.new
@status_window.x = 160
@status_window.y = 0
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
@pourcent_window.dispose
@steps_window.dispose
@gold_window.dispose
@status_window.dispose
end
def update
@command_window.update
@pourcent_window.update
@steps_window.update
@gold_window.update
@status_window.update
if @command_window.active
update_command
return
end
if @status_window.active
update_status
return
end
end
def update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
if $game_party.actors.size == 0 and @command_window.index < 4
$game_system.se_play($data_system.buzzer_se)
return
end
case @command_window.index
when 0
$game_system.se_play($data_system.decision_se)
$scene = Scene_Item.new
when 1
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 2
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 3
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 4
if $game_system.save_disabled
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Save.new
when 5
$game_system.se_play($data_system.decision_se)
$scene = Scene_End.new
end
return
end
end
def update_status
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
if Input.trigger?(Input::C)
case @command_window.index
when 1
if $game_party.actors[@status_window.index].restriction >= 2
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Skill.new(@status_window.index)
when 2
$game_system.se_play($data_system.decision_se)
$scene = Scene_Equip.new(@status_window.index)
when 3
$game_system.se_play($data_system.decision_se)
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end
Alors comment marche se système de pourcentage ?
Hé bien, pour modifier le pourcentage, il suffit de modifier la variable n°1 du jeu !
Par exemple, pour ajouter 1%, vous devez faire +1 à la variable 001 !
Il est maintenant possible de masquer ce qui sera marquer dans les commentaire !
Au début du script "Window_Steps", il y a "@afficher = true" !
Pour masquer il vous suffit de mettre "false" a la place de "true" !
SCREEN
Voici une image du rendu:
Je ne demande pas spécialement de nom dans les crédit !
Mais si vous tenez a le mettre, ce systèmeest fait par "
Bubblebug" !