Code: |
#==============================================================================# ** 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 |
Code: |
#==============================================================================# ** 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 |
Code: |
#==============================================================================# ** 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 |
Zooria a écrit: |
Ceci est 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 ! [...] 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" ! |
Citation: |
Sinon est-ce qu'il s'affiche dans le menu chargement ? |
Citation: |
Ce qui est un peu dommage c'est que le pourcentage est défini par une variable et qu'il n'est pas réellement tracé ... |
Code: |
#============================================================================== # ** Système de pourcentage #============================================================================== # Bubblebug# v3.0 # 05/03.2011 #============================================================================== # EXPLICATION # # Le pourcentage est définie dans la variable n°1 ! # Donc pour modifier le pourcentage, modifié la variable n°1 ! # # Le nombre de donjon fini est définie dans la variable n°2 ! # Donc pour modifié le nombre de donjon finie modifié la variable n°2 ! #============================================================================== 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 @statistique_window = Statistique.new @statistique_window.x = 0 @statistique_window.y = 224 @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 @statistique_window.dispose @gold_window.dispose @status_window.dispose end def update @command_window.update @statistique_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 class Statistique < Window_Base def initialize super(0, 0, 160, 192) 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(0, 0, 200, 32, "Pourcentage:") self.contents.draw_text(100, 20, 50, 32, "%") self.contents.font.color = normal_color self.contents.draw_text(50, 20, 50, 32, $game_variables[1].to_s, 2) self.contents.font.color = system_color self.contents.draw_text(0, 50, 200, 32, "Temp de jeu:") @total_sec = Graphics.frame_count / Graphics.frame_rate hour = @total_sec / 60 / 60 min = @total_sec / 60 % 60 sec = @total_sec % 60 text = sprintf("%02d:%02d:%02d", hour, min, sec) self.contents.font.color = normal_color self.contents.draw_text(4, 70, 120, 32, text, 2) self.contents.font.color = system_color self.contents.draw_text(0, 100, 150, 32, "Donjon:") self.contents.font.color = normal_color self.contents.draw_text(80, 120, 100, 32, $game_variables[2].to_s + "/15") end def update super if Graphics.frame_count / Graphics.frame_rate != @total_sec refresh end end end class Scene_Load < Scene_File def initialize $game_temp = Game_Temp.new $game_temp.last_file_index = 0 latest_time = Time.at(0) for i in 0..3 filename = make_filename(i) if FileTest.exist?(filename) file = File.open(filename, "r") if file.mtime > latest_time latest_time = file.mtime $game_temp.last_file_index = i end file.close end end super("Charger quelle partie ?") end def on_decision(filename) unless FileTest.exist?(filename) $game_system.se_play($data_system.buzzer_se) return end $game_system.se_play($data_system.load_se) file = File.open(filename, "rb") read_save_data(file) file.close $game_system.bgm_play($game_system.playing_bgm) $game_system.bgs_play($game_system.playing_bgs) $game_map.update $scene = Scene_Map.new end def on_cancel $game_system.se_play($data_system.cancel_se) $scene = Scene_Title.new end def read_save_data(file) characters = Marshal.load(file) Graphics.frame_count = Marshal.load(file) $game_system = Marshal.load(file) $game_switches = Marshal.load(file) $game_variables = Marshal.load(file) $game_self_switches = Marshal.load(file) $game_screen = Marshal.load(file) $game_actors = Marshal.load(file) $game_party = Marshal.load(file) $game_troop = Marshal.load(file) $game_map = Marshal.load(file) $game_player = Marshal.load(file) if $game_system.magic_number != $data_system.magic_number $game_map.setup($game_map.map_id) $game_player.center($game_player.x, $game_player.y) end $game_party.refresh end end class Window_SaveFile < Window_Base attr_reader :filename attr_reader :selected def initialize(file_index, filename) super(0, 64 + file_index % 4 * 104, 640, 104) self.contents = Bitmap.new(width - 32, height - 32) @file_index = file_index @filename = "[url=mailto:Save#{@file_index]Save#{@file_index[/url] + 1}.rxdata" @time_stamp = Time.at(0) @file_exist = FileTest.exist?(@filename) if @file_exist file = File.open(@filename, "r") @time_stamp = file.mtime @characters = Marshal.load(file) @frame_count = Marshal.load(file) @game_system = Marshal.load(file) @game_switches = Marshal.load(file) @game_variables = Marshal.load(file) @total_sec = @frame_count / Graphics.frame_rate file.close end refresh @selected = false end def refresh self.contents.clear self.contents.font.color = normal_color name = "Fichier [url=mailto:#{@file_index]#{@file_index[/url] + 1}" self.contents.draw_text(4, 0, 600, 32, name) @name_width = contents.text_size(name).width if @file_exist for i in [url=mailto:0...@characters.size]0...@characters.size[/url] bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1]) cw = bitmap.rect.width / 4 ch = bitmap.rect.height / 4 src_rect = Rect.new(0, 0, cw, ch) x = 300 - @characters.size * 32 + i * 64 - cw / 2 self.contents.blt(x, 68 - ch, bitmap, src_rect) end hour = @total_sec / 60 / 60 min = @total_sec / 60 % 60 sec = @total_sec % 60 time_string = sprintf("%02d:%02d:%02d", hour, min, sec) self.contents.font.color = normal_color self.contents.draw_text(4, 18, 600, 32, time_string, 2) self.contents.font.color = system_color self.contents.draw_text(-5, -5, 600, 32, "%", 2) self.contents.font.color = normal_color self.contents.draw_text(-25, -5, 600, 32, @game_variables[1].to_s, 2) time_string = @time_stamp.strftime("%Y/%m/%d %H:%M") self.contents.draw_text(4, 45, 600, 32, time_string, 2) end end def selected=(selected) @selected = selected update_cursor_rect end def update_cursor_rect if @selected self.cursor_rect.set(0, 0, @name_width + 8, 32) else self.cursor_rect.empty end end end |
Code: |
self.contents.draw_text(x, y, 200, 32, $game_variables[1].to_s) #Remplace "X" et "Y" par un emplacement, fait plusieur essait pour bien la placer comme tu le désire :D) |
Zooria a écrit: | ||
C'est un truc tout "con" ! Ajoute:
dans le script, au niveau des texte de la sauvergarde (script "Book - Scene File") Et le pourcentage serai définit dans la variables n°1 Peut pas te donner le code complet, car les balise bug :s |