Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
- # ■ Window_GameCompletion [RMXP]
- # ■ Author: Bigace360
- # ■ Version: 2.0
- # ■ Date: 5.25.2012
- # Home Blog: http://bigaceworld.wordpress.com/
- #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
- # INTRODUCTION #
- #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
- # Shows how much percentage of the game is completed by calling how much a
- # variable is.
- #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
- # VERSION HISTORY #
- #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
- # v 1.0 - 5.25.2012 > Started and Finished Script
- # v 2.0 - 5.31.2012 > Rewrote the script for compatiblity with the Warrior Engine
- #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
- # INSTRUCTIONS #
- #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
- # In the Event Editor, under the Control Variable tab, set the variable to the
- # number you have in the module below. Then have the Operation at Set and then,
- # change the constant to whatever number you want to add between 1~100.
- #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
- #
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Warrior Engine (Setting module for the Warrior Engine)
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- module Warrior_Engine
- #=============================================================================
- # ▼ Warning DO NOT TOUCH THIS MODULE, altering this will ruin any chances of
- # any script that requires this engine to run.
- #
- # For Configurations go to Module Core below this one.
- #=============================================================================
- module MESSAGE
- #--------------------------------------------------------------------------
- # * required
- # This method checks for the existance of the basic module and other
- # WARRIOR scripts required for this script to work, don't edit this
- #--------------------------------------------------------------------------
- def self.required(name, req, version, type = nil)
- if !$imported[:ace_warrior_module]
- msg = "The script '%s' requires the script\n"
- msg += "'Warrior_Engine' v%s or higher above it to work properly\n"
- msg += "Go to http://bigaceworld.wordpress.com/ to download this script."
- print(sprintf(msg, self.script_name(name), version))
- exit
- else
- self.required_script(name, req, version, type)
- end
- end
- #--------------------------------------------------------------------------
- # * script_name
- # Get the script name base on the imported value, don't edit this
- #--------------------------------------------------------------------------
- def self.script_name(name, ext = "WE")
- name = name.to_s.gsub("_", " ").upcase.split
- name.collect! {|char| char == ext ? "#{char} -" : char.capitalize }
- name.join(" ")
- end
- end
- end
- #=============================================================================
- # ▼ BEGIN CONFIGURATIONS HERE BELOW
- #=============================================================================
- module ACE
- module Completion
- #The set game_variable
- PROGRESS_VARIABLE = 1
- # The way progress percentage will be displayed.
- COMPLETE_PERCENT = "%1.0f%%"
- #Name of the window
- HEADER = 'Game Completion'
- #Colors for the bar
- PRG_COLOR1 = Color.new(150, 0, 0, 255)
- PRG_COLOR2 = Color.new(255, 255, 60, 255)
- #Color for a 100% game completion bar
- FULL_COLOR = Color.new(0, 255, 0, 255)
- end
- end
- #==============================================================================
- # ▼ Editting anything past this point may potentially result in causing
- # computer damage, incontinence, explosion of user's head, coma, death, and/or
- # halitosis so edit at your own risk.
- #==============================================================================
- $imported ||= {}
- $imported[:completion_script] = 2.0
- Warrior_Engine::MESSAGE.required(:completion_script, :ace_warrior_module, 1.00, :above)
- class Window_Progress < Window_Base
- include ACE::Completion
- attr_reader :progress # PROGRESS
- def initialize(x, y)
- super(x, y, 160, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- @progress = 0
- refresh
- end
- def window_width; return 160; end
- def progres_v; return $game_variables[PROGRESS_VARIABLE]; end
- def complete_rate; progres_v > 0 ? @progress.to_f / progres_v : 0; end
- def refresh
- contents.clear
- draw_completion_bar(0, -4, progress)
- end
- def draw_gauge(dx, dy, dw, rate, color1, color2)
- dw += 2 if true
- fill_w = dw * progres_v / [100, 1].max
- warrior_guage(dx, dy, dw, rate, fill_w, color1, color2, 8)
- end
- def draw_completion_bar(x, y, progress, width = 120)
- draw_gauge(x+5, y+3, width, complete_rate, PRG_COLOR1, PRG_COLOR2)
- if progres_v == 100
- draw_gauge(x+5, y, width, complete_rate, FULL_COLOR, FULL_COLOR)
- end
- change_color(system_color)
- draw_text(x, y-5, window_width-32, 32, HEADER, 1)
- change_color(normal_color)
- xr = x + width
- if @progress == 0
- text = sprintf(COMPLETE_PERCENT, progres_v)
- else
- text = sprintf(COMPLETE_PERCENT, @progress.to_i * 100 / 100)
- end
- self.contents.font.size = 14
- draw_text(x+5, y+12, width, 32, text, 2)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment