Code:
#==============================================================================
# ** Soulpour - Party Titles Orpheus
# Author: Soulpour777
# Web URL: infinitytears.wordpress.com
# This is free for Non Commercial Use.
# Not Free for Commercial Use
# Credits: Division Heaven for Eric's Graphic and Animeflow for the Wallpaper
#------------------------------------------------------------------------------
# Description:
# This script is an extended description window wherein the developer can assign
# character titles that can be achieved my any of the actors in the party,
# or even party members that left the party already. This can also function
# as a way to set up user controlled achievements.
#------------------------------------------------------------------------------
# Main Note:
# Please LOOK at the demo how all the events are set up.
#------------------------------------------------------------------------------
# Installation:
# Put this script below Materials, above Main.
# Put all the graphics on the Graphics/Systems folder.
#------------------------------------------------------------------------------
# Script Calls:
# $game_system.assign_title_desc(description)
# $game_system.assign_actor(actor_name)
# $game_system.assign_title_information(level, rank, location, badge)
# $game_system.assign_titles(name)
# $game_system.assign_header(header)
# $game_system.create_orpheus_title(title_name, key_symbol, switch_id)
# SceneManager.call(Soulpour_OrpheusTitles)
#------------------------------------------------------------------------------
# where:
#~ description is the description of the title.
#~ actor_name is the name of the actor who holds the title.
#~ level is the level of the title.
#~ rank is the rank of the title among all the titles
#~ location is the location where you gained the title
#~ badge is the badge rate of the title, whether silver, gold, bronze, etc.
#~ name is the name of the title.
#~ header is the name of the header graphic
#~ title_name is the name of the title you assign in the command list.
#~ key_symbol is a desired symbol for the title. It doesn't matter what you write,
#~ as long as they are key symbols.
#~ switch_id is the switch that allows the title to be activated and viewed.
#------------------------------------------------------------------------------
#Example:
# $game_system.assign_title_desc("Kill all the peasants.")
# $game_system.assign_actor("Eric Brassclaw")
# $game_system.assign_title_information(1, "Peasant Level", "Asteria", "Silver")
# $game_system.assign_titles("The Ravager")
# $game_system.assign_header("ravager_graphic")
# $game_system.create_orpheus_title("The Ravager", :ravager, 10)
# SceneManager.call(Soulpour_OrpheusTitles)
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# *Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :titles
attr_accessor :symbol_value
attr_accessor :title_name
attr_accessor :acquiring_actor
attr_accessor :title_graphic
attr_accessor :title_level
attr_accessor :title_rank
attr_accessor :title_location
attr_accessor :title_badge
attr_accessor :title_description
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias :soulpour_orpheus_system_ex :initialize
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
def initialize
@titles = []
@symbol_value = nil
@title_name = nil
@acquiring_actor = nil
@title_graphic = nil
@title_level = nil
@title_rank = nil
@title_location = nil
@title_icon_badge = nil
@title_description = nil
soulpour_orpheus_system_ex
end
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
def create_orpheus_title(title_name, key_symbol, switch_id)
@symbol_value = key_symbol
$game_system.titles << Orpheus_PartyLink.new(title_name, key_symbol, switch_id)
end
#--------------------------------------------------------------------------
# * assign_titles
#--------------------------------------------------------------------------
def assign_titles(name)
@title_name = name
end
#--------------------------------------------------------------------------
# * assign_actor
#--------------------------------------------------------------------------
def assign_actor(actor)
@acquiring_actor = actor
end
#--------------------------------------------------------------------------
# * assign_header
#--------------------------------------------------------------------------
def assign_header(header)
@title_graphic = header
end
#--------------------------------------------------------------------------
# * assign_title_information
#--------------------------------------------------------------------------
def assign_title_information(level, rank, location, badge)
@title_level = level
@title_rank = rank
@title_location = location
@title_badge = badge
end
#--------------------------------------------------------------------------
# * assign_title_desc
#--------------------------------------------------------------------------
def assign_title_desc(description)
@title_description = description
end
end
class Window_OrpheusTtiles < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, Graphics.width, Graphics.height)
refresh
activate
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
create_titles_title (line_height * 0)
draw_sheldon_line(line_height * 1)
create_header_container (line_height * 2)
draw_sheldon_line(line_height * 6)
draw_orpheus_lower_corner (line_height * 7)
draw_sheldon_line(line_height * 13)
draw_description_orpheus_ex (line_height * 14)
end
#--------------------------------------------------------------------------
# * Draw Block 1
#--------------------------------------------------------------------------
def create_titles_title(y)
draw_text_ex(4, y, "Title Name: ")
draw_text_ex(288, y, $game_system.acquiring_actor)
end
#--------------------------------------------------------------------------
# * Draw Block 2
#--------------------------------------------------------------------------
def create_header_container(y)
create_titles_header_graphic
end
#--------------------------------------------------------------------------
# * Create Header
#--------------------------------------------------------------------------
def create_titles_header_graphic
@title_header = Sprite.new
@title_header.bitmap = Cache.system($game_system.title_graphic)
@title_header.x = 15
@title_header.y = 52
@title_header.z = 100
end
#--------------------------------------------------------------------------
# * Free Header
#--------------------------------------------------------------------------
def dispose_titles_header_graphic
@title_header.bitmap.dispose
@title_header.dispose
end
#--------------------------------------------------------------------------
# * Draw Block 3
#--------------------------------------------------------------------------
def draw_orpheus_lower_corner(y)
draw_text_ex(32, y, "Acquired by: " + $game_system.acquiring_actor)
draw_text_ex(32, y +30, "Title Level: " + $game_system.title_level.to_s)
draw_text_ex(32, y + 60, "Title Rank: " + $game_system.title_rank)
draw_text_ex(32, y + 90, "Location Acquired: " + $game_system.title_location)
draw_text_ex(32, y + 120, "Badge: " + $game_system.title_badge)
end
#--------------------------------------------------------------------------
# * Free
#--------------------------------------------------------------------------
def dispose
dispose_titles_header_graphic
contents.dispose unless disposed?
super
end
#--------------------------------------------------------------------------
# * Draw Block 4
#--------------------------------------------------------------------------
def draw_description_orpheus_ex(y)
create_title_description(4, y)
end
#--------------------------------------------------------------------------
# * Draw Horizontal Line
#--------------------------------------------------------------------------
def draw_sheldon_line(y)
line_y = y + line_height / 2 - 1
contents.fill_rect(0, line_y, contents_width, 2, line_color)
end
#--------------------------------------------------------------------------
# * Get Color of Horizontal Line
#--------------------------------------------------------------------------
def line_color
color = normal_color
color.alpha = 48
color
end
#--------------------------------------------------------------------------
# * Draw Description
#--------------------------------------------------------------------------
def create_title_description(x, y)
draw_text_ex(x, y, $game_system.title_description)
end
end
class Scene_TitlesOrpheus < Scene_Base
#--------------------------------------------------------------------------
# * Start / Initialize
#--------------------------------------------------------------------------
def start
super
@orpheus_titles_start = Window_OrpheusTtiles.new
@orpheus_titles_start.opacity = 0
create_orpheus_wallpaper_title_ex("hero_titles_wallpaper")
create_orpheus_title_particles_ex("orpheus_particles")
end
#--------------------------------------------------------------------------
# * create_orpheus_wallpaper_title_ex : new method
#--------------------------------------------------------------------------
def create_orpheus_wallpaper_title_ex(wallpaper)
@wall_ex = Plane.new
@wall_ex.bitmap = Cache.system(wallpaper)
end
#--------------------------------------------------------------------------
# * create_orpheus_wallpaper_title_ex : new method
#--------------------------------------------------------------------------
def create_orpheus_title_particles_ex(particle)
@particle_ex = Plane.new
@particle_ex.bitmap = Cache.system(particle)
end
#--------------------------------------------------------------------------
# * update_orpheus_title_particles_ex : new method
#--------------------------------------------------------------------------
def update_orpheus_title_particles_ex
@particle_ex.oy -= -1
end
#--------------------------------------------------------------------------
# * dispose_orpheus_extra_graphics_ex : new method
#--------------------------------------------------------------------------
def dispose_orpheus_extra_graphics_ex
@particle_ex.bitmap.dispose
@particle_ex.dispose
@wall_ex.bitmap.dispose
@wall_ex.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
update_basic
update_orpheus_title_particles_ex
if Input.press?(:B)
Sound.play_cancel
SceneManager.return
end
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
dispose_orpheus_extra_graphics_ex
Graphics.freeze
dispose_all_windows
dispose_main_viewport
end
end
class Orpheus_PartyBase < Window_Command
#--------------------------------------------------------------------------
# * Initialize Process
#--------------------------------------------------------------------------
def initialize(x, y, width, height = nil, data_list = [])
@data_list = data_list
@window_width = width
@window_height = height
super(x, y)
self.opacity = 0
end
#--------------------------------------------------------------------------
# * Data List
#--------------------------------------------------------------------------
def data_list=(new_list)
if @data_list != new_list
make_command_list
refresh
end
end
#--------------------------------------------------------------------------
# * Return Data List
#--------------------------------------------------------------------------
def data_list
@data_list
end
#--------------------------------------------------------------------------
# * Width
#--------------------------------------------------------------------------
def window_width
@window_width
end
#--------------------------------------------------------------------------
# * Height
#--------------------------------------------------------------------------
def window_height
@window_height || fitting_height(@data_list.size)
end
#--------------------------------------------------------------------------
# * Item Max
#--------------------------------------------------------------------------
def item_max
@list.size
end
#--------------------------------------------------------------------------
# * Make Command List
#--------------------------------------------------------------------------
def make_command_list
@list = data_list.select { |i| include?(i) }.collect { |i| {name: name_of(i), symbol: symbol_of(i), enabled: enable?(i), ext: ext_of(i)} }
end
#--------------------------------------------------------------------------
# * Include Item
#--------------------------------------------------------------------------
def include?(item)
return false if item.nil?
true
end
#--------------------------------------------------------------------------
# * Name of Item
#--------------------------------------------------------------------------
def name_of(item)
return ""
end
#--------------------------------------------------------------------------
# * Symbol Of
#--------------------------------------------------------------------------
def symbol_of(item)
return :none
end
#--------------------------------------------------------------------------
# * Enable
#--------------------------------------------------------------------------
def enable?(item)
return true
end
#--------------------------------------------------------------------------
# * Extension Of
#--------------------------------------------------------------------------
def ext_of(item)
return nil
end
end
class Orpheus_PartyLink
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :name, :symbol, :switch_id, :ext
#--------------------------------------------------------------------------
# * Initialize Process
#--------------------------------------------------------------------------
def initialize(name, symbol, switch_id = 0, ext = nil)
@name = name
@symbol = symbol
@switch_id = switch_id
@ext = ext
end
#--------------------------------------------------------------------------
# * if Switch Enabled
#--------------------------------------------------------------------------
def enabled?
switch_id == 0 ? true : $game_switches[switch_id]
end
end
class Orpheus_TitlesCommand < Orpheus_PartyBase
#--------------------------------------------------------------------------
# * Include
#--------------------------------------------------------------------------
def include?(item)
return false unless item.is_a?(Orpheus_PartyLink)
true
end
#--------------------------------------------------------------------------
# * Name of
#--------------------------------------------------------------------------
def name_of(item)
return item.name
end
#--------------------------------------------------------------------------
# * Symbol
#--------------------------------------------------------------------------
def symbol_of(item)
return item.symbol
end
#--------------------------------------------------------------------------
# * Enable
#--------------------------------------------------------------------------
def enable?(item)
return item.enabled?
end
#--------------------------------------------------------------------------
# * Extension of
#--------------------------------------------------------------------------
def ext_of(item)
return item.ext
end
end
class Soulpour_OrpheusTitles < Scene_Base
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :orpheus_party_window
#--------------------------------------------------------------------------
# * Start Processing
#--------------------------------------------------------------------------
def start
super
create_orpheus_party_titles
create_orpheus_wallpaper_title("hero_titles_wallpaper")
create_orpheus_title_particles("orpheus_particles")
end
#--------------------------------------------------------------------------
# * create_orpheus_party_titles : new method
#--------------------------------------------------------------------------
def create_orpheus_party_titles
@orpheus_party_window = Orpheus_TitlesCommand.new(0, 0, Graphics.width, Graphics.height, $game_system.titles)
@orpheus_party_window.opacity = 0
@orpheus_party_window.set_handler(:ok, method(:ok_method))
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
update_basic
update_orpheus_title_particles
@orpheus_party_window.activate
if Input.press?(:B)
Sound.play_cancel
return_scene
end
end
#--------------------------------------------------------------------------
# * create_orpheus_wallpaper_title : new method
#--------------------------------------------------------------------------
def create_orpheus_wallpaper_title(wallpaper)
@wall = Plane.new
@wall.bitmap = Cache.system(wallpaper)
end
#--------------------------------------------------------------------------
# * create_orpheus_title_particles : new method
#--------------------------------------------------------------------------
def create_orpheus_title_particles(particle)
@particle = Plane.new
@particle.bitmap = Cache.system(particle)
end
#--------------------------------------------------------------------------
# * update_orpheus_title_particles : new method
#--------------------------------------------------------------------------
def update_orpheus_title_particles
@particle.oy -= -1
end
#--------------------------------------------------------------------------
# * dispose_orpheus_extra_graphics : new method
#--------------------------------------------------------------------------
def dispose_orpheus_extra_graphics
@particle.bitmap.dispose
@particle.dispose
@wall.bitmap.dispose
@wall.dispose
end
#--------------------------------------------------------------------------
# * ok_method : new method
#--------------------------------------------------------------------------
def ok_method
if $game_system.symbol_value
SceneManager.call(Scene_TitlesOrpheus)
end
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
dispose_orpheus_extra_graphics
Graphics.freeze
dispose_all_windows
dispose_main_viewport
end
end