class Scene_Map
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :swap_dead_leader_scene_map_update, :update
#-----------------------------------------------------------------------------
# * Update
#-----------------------------------------------------------------------------
def update
swap_dead_leader_scene_map_update
unless $game_party.actors.empty?
if ($game_party.actors[0].hp).zero?
unless $game_party.all_dead?
$game_party.actors << $game_party.actors.shift
$game_player.refresh
else ; $game_temp.gameover = true
end
end
end
end
end#==============================================================================
# Inn & Savepoint System
#==============================================================================
# SephirothSpawn
# Version 1
# 2006-03-08
#------------------------------------------------------------------------------
# Do not edit the script in any manner to remove the SDK
# The Script was designed for usage with SDK only
#==============================================================================
#=========================================================================
# ** RPG::Inn
#=========================================================================
class RPG::Inn
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :cost, :transfer, :greeting
attr_reader :staying, :thanks, :exit
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(cost = 250, transfer = nil,
greeting = 'Welcome to the Inn. Would you like to stay?',
staying = 'Enjoy Your Stay',
thanks = 'Thank You for staying',
exit = 'See You Later')
@cost, @transfer, @greeting = cost, transfer, greeting
@staying, @thanks, @exit = staying, thanks, exit
end
end
#==============================================================================
# ** Game_System
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :savepoint_options, :savepoint_return
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_ispsystem_gamesys_init initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Original Initialization
seph_ispsystem_gamesys_init
# Creates Savepoint Options Array
@savepoint_options = ['Save', 'Load', 'Main Menu', 'Shutdown', 'Cancel']
# Turns Off Savepoint Return
@savepoint_return = false
end
end
#==============================================================================
# ** Game_Player
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :disable_player_movement
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_ispsystem_gameplayer_init initialize
alias seph_ispsystem_gameplayer_upm moving?
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Original Initialization
seph_ispsystem_gameplayer_init
# Turns Off Disable Movement
@disable_player_movement = false
end
#--------------------------------------------------------------------------
# * Player Movement Update
#--------------------------------------------------------------------------
def moving?
return true if @disable_player_movement
return seph_ispsystem_gameplayer_upm
end
end
#=========================================================================
# ** Window_InnGold
#=========================================================================
class Window_InnGold < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(cost)
super(640, 368, 320, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 160
@cost = cost
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, contents.width, 32, 'Current Gold:')
self.contents.font.color = normal_color
self.contents.draw_text(- 4, 0, contents.width, 32, $game_party.gold.to_s, 2)
self.contents.font.color = $game_party.gold >= @cost ? text_color(1) : text_color(2)
self.contents.draw_text(4, 32, contents.width, 32, 'Cost to stay:')
self.contents.draw_text(- 4, 32, contents.width, 32, @cost.to_s, 2)
end
end
#==============================================================================
# ** Scene_Title
#==============================================================================
class Scene_Title
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_ispsystem_stitle_main main
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Savepoint Load
unless $game_system.nil?
if $game_system.savepoint_return
$scene = Scene_SavePoint.new(false, $game_system.savepoint_options.index('Load'))
$game_system.savepoint_return = false
return
end
end
# Original Main Method
seph_ispsystem_stitle_main
end
end
#==============================================================================
# ** Scene_Menu
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_ispsystem_smenu_init initialize
alias seph_ispsystem_smenu_main main
#--------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
# Original Method
seph_ispsystem_smenu_init(menu_index)
# Savepoint Return Branch
if $game_system.savepoint_return
case @menu_index
when 4 # Save
@scene_change = "$scene = Scene_SavePoint.new(false, $game_system.savepoint_options.index('Save'))"
$game_system.savepoint_return = false
return
when 5 # End Game
@scene_change = "$scene = Scene_SavePoint.new(false, $game_system.savepoint_options.index('Shutdown'))"
$game_system.savepoint_return = false
return
end
end
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Scene Change
unless @scene_change.nil?
eval @scene_change
return
end
# Original Main Method
seph_ispsystem_smenu_main
end
end
#=========================================================================
# ** Scene_Inn
#=========================================================================
class Scene_Inn
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(inn = RPG::Inn.new)
@inn = inn
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Creates Map Spriteset
@spriteset = Spriteset_Map.new
# Creates Help Window
@help_window = Window_Help.new
@help_window.y = - 64
@help_window.opacity = 160
@help_window.set_text(@inn.greeting, 1)
# Creates Confirmation Window
@confirmation_window = Window_Command.new(160, ['Yes', 'No'])
@confirmation_window.x = - 160
@confirmation_window.y = 368
@confirmation_window.opacity = 160
# Creates Gold Window
@gold_window = Window_InnGold.new(@inn.cost)
# Disables Player Movements
$game_player.disable_player_movement = true
# Stores Scene Objects
@scene_objects = [@spriteset, @help_window, @confirmation_window, @gold_window]
# Execute transition
Graphics.transition
# Main loop
while $scene == self
# Update game screen
Graphics.update
# Update input information
Input.update
# Updates Scene Objects
@scene_objects.each {|x| x.update}
# Frame update
update
end
# Prepare for transition
Graphics.freeze
# Disposes Scene Objects
@scene_objects.each {|x| x.dispose}
# Enables Player Movements
$game_player.disable_player_movement = false
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update Player & Screen
$game_player.update
$game_screen.update
# If Confirmation Window Active
if @confirmation_window.active
update_main
return
end
# If Phase is 'Staying'
if @phase == 'Staying'
update_staying
return
end
# If Phase is 'Stay Exit'
if @phase == 'Stay Exit'
update_stay_exit
return
end
# If Phase is 'Exit'
if @phase == 'Exit'
update_exit
return
end
end
#--------------------------------------------------------------------------
# * Frame Update: Main
#--------------------------------------------------------------------------
def update_main
# Moves In Windows
@help_window.y += 4 if @help_window.y < 0
@confirmation_window.x += 11 if @confirmation_window.x < 16
@gold_window.x -= 21 if @gold_window.x > 304
# If B button is pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Set Help Text
@help_window.set_text(@inn.exit, 1)
# Turns to Exit Phase
@phase = 'Exit'
# Turns off Confirmation Window
@confirmation_window.active = false
return
end
# If C button is pressed
if Input.trigger?(Input::C)
# If No
if @confirmation_window.index == 1
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Set Help Text
@help_window.set_text(@inn.exit, 1)
# Turns to Exit Phase
@phase = 'Exit'
# Turns off Confirmation Window
@confirmation_window.active = false
return
end
# Checks Gold
if $game_party.gold < @inn.cost
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
# Set Help Text
@help_window.set_text("Not Enought #{$data_system.words.gold}", 1)
return
end
# Play Decision SE
$game_system.se_play($data_system.cancel_se)
# Recovers Actors
$game_party.actors.each {|actor| actor.recover_all}
# Sets Help Window Text
@help_window.set_text(@inn.staying, 1)
# Lose Gold
$game_party.lose_gold(@inn.cost)
# Refresh Gold Window
@gold_window.refresh
# Stores Player Location
@temp_loc = [$game_player.x, $game_player.y]
# Starts Frame Counting
@stay_frame_count = 0
# Moves Player to Bedroom
unless @inn.transfer.nil?
# Moves Player to Bedroom
$game_player.find_path(@inn.transfer[0], @inn.transfer[1])
end
# Starts Screen Fading Out
$game_screen.start_tone_change(Tone.new(-255, -255, -255, 0), 50)
# Turns Phase to Staying
@phase = 'Staying'
# Turns off Confirmation Window
@confirmation_window.active = false
end
end
#--------------------------------------------------------------------------
# * Frame Update: Staying
#--------------------------------------------------------------------------
def update_staying
# Move Out Windows
@help_window.y -= 4 if @help_window.y > - 64
@confirmation_window.x -= 11 if @confirmation_window.x > - 160
@gold_window.x += 21 if @gold_window.x < 640
# Counts Frames
@stay_frame_count += 1
# If Stay is Complete
if @stay_frame_count == 100
# Sets Help Text
@help_window.set_text(@inn.thanks, 1)
# Starts Screen Fading Out
$game_screen.start_tone_change(Tone.new(0, 0, 0, 0), 20)
# Moves Player Out of Bedroom
unless @inn.transfer.nil?
# Moves Player to Bedroom
$game_player.find_path(@temp_loc[0], @temp_loc[1])
end
# Turns Phase to Stay Exit
@phase = 'Stay Exit'
end
end
#--------------------------------------------------------------------------
# * Frame Update: Stay Exit
#--------------------------------------------------------------------------
def update_stay_exit
# Moves In Windows
@help_window.y += 4 if @help_window.y < 0
@gold_window.x -= 21 if @gold_window.x > 304
# Player Movement Finished
if $game_player.x == @temp_loc[0] && $game_player.y == @temp_loc[1]
# Window Finished Movement
if @help_window.x == 0 && @gold_window.x == 304
# If B or C is pressed
if Input.trigger?(Input::B) || Input.trigger?(Input::C)
# Play Decision SE
$game_system.se_play($data_system.cancel_se)
# Set Help Text
@help_window.set_text(@inn.exit, 1)
# Turns Phase to Exit
@phase = 'Exit'
end
end
end
end
#--------------------------------------------------------------------------
# * Frame Update: Stay Exit
#--------------------------------------------------------------------------
def update_exit
# Move Windows
@help_window.y -= 4 if @help_window.y > - 64
@confirmation_window.x -= 11 if @confirmation_window.x > - 160
@gold_window.x += 21 if @gold_window.x < 640
# Exit Scene
unless @help_window.y > - 64
# Transfers To Map Scene
$scene = Scene_Map.new
end
end
end
#==============================================================================
# ** Scene_SavePoint
#==============================================================================
class Scene_SavePoint
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(animation = true, index = 0)
@animation, @index = animation, index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Creates Map Spriteset
@spriteset = Spriteset_Map.new
# Creates Help Window
@help_window = Window_Help.new
@help_window.y = @animation ? - 64 : 0
@help_window.opacity = 160
@help_window.set_text('What Would You like to Do?', 1)
# Creates Gold Window
@gold_window = Window_Gold.new
@gold_window.x = 16
@gold_window.y = @animation ? 480 : 400
@gold_window.opacity = 160
# Creates Steps Window
@steps_window = Window_Steps.new
@steps_window.x = 464
@steps_window.y = @animation ? 480 : 368
@steps_window.opacity = 160
# Creates Command Window
@command_window = Window_Command.new(256, $game_system.savepoint_options)
@command_window.x = 192
@command_window.y = @animation ? 480 : 144
@command_window.opacity = 160
@command_window.height = 192
@command_window.index = @index
# Scene Change
@scene_change = '$scene = Scene_Map.new'
# Stores Scene Objects
@scene_objects = [@spriteset, @help_window, @gold_window, @steps_window, @command_window]
# Execute transition
Graphics.transition
# Main loop
while $scene == self
# Update game screen
Graphics.update
# Update input information
Input.update
# Updates Scene Objects
@scene_objects.each {|x| x.update}
# Frame update
update
end
# Prepare for transition
Graphics.freeze
# Disposes Scene Objects
@scene_objects.each {|x| x.dispose}
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Main Update
if @command_window.active
update_main
return
end
# Update Exit
if @phase == 'Exit'
update_exit
return
end
end
#--------------------------------------------------------------------------
# * Frame Update : Main
#--------------------------------------------------------------------------
def update_main
# Moves In Windows
@help_window.y += 4 if @help_window.y < 0
@gold_window.y -= 5 if @gold_window.y > 400
@steps_window.y -= 7 if @steps_window.y > 368
@command_window.y -= 21 if @command_window.y > 144
# If B button is Pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Turns to Exit Phase
@phase = 'Exit'
# Turns off Confirmation Window
@command_window.active = false
return
end
# If C button is pressed
if Input.trigger?(Input::C)
# Play decision SE
$game_system.se_play($data_system.decision_se)
check_commands
end
end
#--------------------------------------------------------------------------
# * Frame Update : Exit
#--------------------------------------------------------------------------
def update_exit
# Moves Out Windows
@help_window.y -= 4 if @help_window.y > - 64
@gold_window.y += 5 if @gold_window.y < 480
@steps_window.y += 7 if @steps_window.y < 480
@command_window.y += 21 if @command_window.y < 480
# When Finished Moving Windows
unless @help_window.y > - 64
# Changes to Scene Map
eval @scene_change
end
end
#--------------------------------------------------------------------------
# * Check Commands
#--------------------------------------------------------------------------
def check_commands
# Gets Command
command = $game_system.savepoint_options[@command_window.index]
# Branch Point for command
case command
when 'Save'
command_save
when 'Load'
command_load
when 'Main Menu'
command_main_menu
when 'Shutdown'
command_shutdown
when'Cancel'
command_cancel
end
end
#--------------------------------------------------------------------------
# * Command : Save
#--------------------------------------------------------------------------
def command_save
# Turns to Exit Phase
@phase = 'Exit'
# Turns off Confirmation Window
@command_window.active = false
# Turns On Savepoint Return
$game_system.savepoint_return = true
# Scene Change
@scene_change = '$scene = Scene_Save.new'
end
#--------------------------------------------------------------------------
# * Command : Load
#--------------------------------------------------------------------------
def command_load
# Turns to Exit Phase
@phase = 'Exit'
# Turns off Confirmation Window
@command_window.active = false
# Turns On Savepoint Return
$game_system.savepoint_return = true
# Scene Change
@scene_change = '$scene = Scene_Load.new'
end
#--------------------------------------------------------------------------
# * Command : Main Menu
#--------------------------------------------------------------------------
def command_main_menu
# Turns to Exit Phase
@phase = 'Exit'
# Turns off Confirmation Window
@command_window.active = false
# Scene Change
@scene_change = '$scene = Scene_Menu.new'
end
#--------------------------------------------------------------------------
# * Command : Shutdown
#--------------------------------------------------------------------------
def command_shutdown
# Turns to Exit Phase
@phase = 'Exit'
# Turns off Confirmation Window
@command_window.active = false
# Turns On Savepoint Return
$game_system.savepoint_return = true
# Scene Change
@scene_change = '$scene = Scene_End.new'
end
#--------------------------------------------------------------------------
# * Command : Cancel
#--------------------------------------------------------------------------
def command_cancel
# Turns to Exit Phase
@phase = 'Exit'
# Turns off Confirmation Window
@command_window.active = false
# Scene Change
@scene_change = '$scene = Scene_Map.new'
end
end#==============================================================================
# ** Event Icon & Text Display
#------------------------------------------------------------------------------
# SephirothSpawn
# Original Text Display By Áص¹
# Version 4.0
# 2007-07-30
# SDK : Version 2.0, Parts I & II
#------------------------------------------------------------------------------
# * Version History :
#
# Version 1 -------------------------------------------- (Approx. 2006-01-01)
# Version 2 ---------------------------------------------------- (2006-03-04)
# Version 3 ---------------------------------------------------- (2006-08-22)
# - Update : Re-scripted Much of the System
# Version 3.01 ------------------------------------------------ (2006-10-23)
# - Bug Fix : Fixed Erase Event
# Version 3.1 ------------------------------------------------- (2007-01-11)
# - Update : Removed Shadow Text Elements
# Version 3.11 ------------------------------------------------ (2007-02-08)
# - Update : Updated to SDK 2.0
# Version 4 ---------------------------------------------------- (2007-07-30)
# - Update : Rescripted to include text and icons
#------------------------------------------------------------------------------
# * Requirements :
#
# Method & Class Library (2.1+)
#------------------------------------------------------------------------------
# * Description :
#
# This script was designed to add floating text and icons over events and
# players on the map. You can control the color of the text and choose
# multiple options for the text over the player.
#------------------------------------------------------------------------------
# * Instructions
#
# Place The Script Below the SDK and Above Main.
#
# Setting Event Display Text. Replace <text> with the text you want to be
# displayed of event.
# Comment: {ETD<text>}
#
# For icons, use [icon_name] in text. Make sure to seperate with space.
#
# For Default Settings, refer to customization.
# For Modifing Setting during game play, refer to syntax.
#------------------------------------------------------------------------------
# * Customization
#
# Default Event Text Color
# - ETD_Default_EventText_Color = Color.new(red, green, blue)
#
# Default Player Text Color
# - ETD_Default_PlayerText_Color = Color.new(red, green, blue)
#
# Default Player Display Option
# - ETD_Default_PlayerText = 'Name', 'Class', 'Level', 'Hp', 'Sp'
#------------------------------------------------------------------------------
# * Syntax
#
# Changing Character Display Text
# - <game_character>.etd_display_text = 'String'
# Changing Character Display Color
# - <game_character>.etd_display_color = Color.new(r, g, b, a)
#
# * Substitute <game_character> with $game_player for the player, or
# $game_map.events[event_id] to replace with an event.
#==============================================================================
#=============================================================================
# ** Game_Character
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
# * Defaults
#
# ~ Default Player Display Options (Non-Case Sensitive):
# 'Name', 'Class', 'Level', 'Hp', 'Sp'
#--------------------------------------------------------------------------
ETD_Default_EventText_Color = Color.new(0, 0, 0)
ETD_Default_PlayerText_Color = Color.new(200, 0, 0)
ETD_Default_PlayerText = 'gem'
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :etd_display_color
attr_accessor :etd_display_text
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias_method :seph_etd_gmchr_init, :initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Sets ETD Options
@etd_display_color = self.is_a?(Game_Player) ?
ETD_Default_PlayerText_Color : ETD_Default_EventText_Color
# Original Initialization
seph_etd_gmchr_init
end
end
#==============================================================================
# ** Game_Event
#==============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias_method :seph_etd_gmevt_refresh, :refresh
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Original Refresh Method
seph_etd_gmevt_refresh
# Erase ETD Display Text
@etd_display_text = nil
# Checks to see if display text
unless @list.nil? || @erased
for i in 0...@list.size
if @list[i].code == 108
@list[i].parameters[0].dup.gsub!(/\{[Ee][Tt][Dd](.+?)\}/) do
@etd_display_color = ETD_Default_EventText_Color
@etd_display_text = $1
end
end
end
end
end
end
#==============================================================================
# ** Game_Player
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias_method :seph_etd_gmplyr_refresh, :refresh
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Original Refresh Method
seph_etd_gmplyr_refresh
# Gets First Actor
actor = $game_party.actors[0]
# Retrn if Nil Actor
return if actor.nil?
# Determines Text
case ETD_Default_PlayerText.dup.downcase
when 'name' ; txt = actor.name
when 'class' ; txt = actor.class_name
when 'level' ; txt = "Level: #{actor.level}"
when 'hp' ; txt = "HP: #{actor.hp} / #{actor.maxhp}"
when 'sp' ; txt = "SP: #{actor.sp} / #{actor.maxsp}"
when 'gem' ; txt = '{[player]}'
else ; txt = ''
end
# Creates Text Display
@etd_display_color = ETD_Default_PlayerText_Color
@etd_display_text = txt
end
end
#==============================================================================
# ** Sprite_Character
#==============================================================================
class Sprite_Character < RPG::Sprite
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias_method :seph_etd_spchr_update, :update
alias_method :seph_etd_spchr_dispose, :dispose
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Original update Method
seph_etd_spchr_update
# Character Display Update Method
update_display_text
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
# Original Dispose
seph_etd_spchr_dispose
# Dispose ETD Sprite
dispose_etd_sprite
end
#--------------------------------------------------------------------------
# * Dispose ETD Sprite
#--------------------------------------------------------------------------
def dispose_etd_sprite
# Dispose ETD Sprite
unless @_etd_text_sprite.nil?
@_etd_text_sprite.dispose
@_etd_text_sprite = nil
end
end
#--------------------------------------------------------------------------
# * Update Display Sprite
#--------------------------------------------------------------------------
def update_display_text
# If Character Has No ETD
if @character.etd_display_text.nil?
# Dispose ETD Sprite
dispose_etd_sprite
return
end
# If ETD Text Sprite Doesn't Exist
if @_etd_text_sprite.nil?
# Create ETD Text Sprite
create_etd_sprite
return
end
# If ETD Sprite Parameters Don't Match Characters
unless @_etd_display_text == @character.etd_display_text &&
@_etd_display_color == @character.etd_display_color
# Dispose Sprite
dispose_etd_sprite
# Recreate Sprite
create_etd_sprite
end
# Update ETD Sprite Position
@_etd_text_sprite.x = self.x
@_etd_text_sprite.y = self.y - self.oy / 2 - 24
end
#--------------------------------------------------------------------------
# * Create ETD Sprite
#--------------------------------------------------------------------------
def create_etd_sprite
# Creates Display Bitmap
bitmap = Bitmap.new(192, 26)
# Draws ETD Display Text
begin
bitmap.font.color = @character.etd_display_color
rescue
@character.etd_display_color = @character.is_a?(Game_Player) ?
Game_Character::ETD_Default_PlayerText_Color :
Game_Character::ETD_Default_EventText_Color
bitmap.font.color = @character.etd_display_color
end
bitmap.draw_icon_text(0, 0, 192, 24, @character.etd_display_text, 1)
# Creates Display Text Sprite
@_etd_text_sprite = Sprite.new(self.viewport)
@_etd_text_sprite.bitmap = bitmap
@_etd_text_sprite.ox = 80
@_etd_text_sprite.oy = 24
@_etd_text_sprite.x = self.x
@_etd_text_sprite.y = self.y - self.oy / 2 - 24
@_etd_text_sprite.z = 3000
@_etd_text_sprite.visible = true
# Saves ETD Text
@_etd_display_text = @character.etd_display_text
@_etd_display_color = @character.etd_display_color
end
end#===============================================================================
# ~** Recieved Item Window **~
#-------------------------------------------------------------------------------
# Written by : Kain Nobel
# Version : 2.0
# Last Update : 09.02.2008
# Date Created : 07.18.2008
#===============================================================================
#===============================================================================
# ** ItemGet
#-------------------------------------------------------------------------------
# This module handles the ItemGet system.
#===============================================================================
module ItemGet
#-----------------------------------------------------------------------------
# * Customizable Constants
#-----------------------------------------------------------------------------
FontName = "pix Chicago"
FontSize = 14
GainSE = "056-Right02"
LossSE = "058-Wrong02"
Delay = 30
#-----------------------------------------------------------------------------
# * Font Name
#-----------------------------------------------------------------------------
def self.font_name
return FontName.is_a?(String) ? FontName : Font.default_name
end
#-----------------------------------------------------------------------------
# * Font Size
#-----------------------------------------------------------------------------
def self.font_size
return FontSize.is_a?(Integer) ? FontSize : Font.default_size
end
#-----------------------------------------------------------------------------
# * Delay
#-----------------------------------------------------------------------------
def self.delay
return Delay.is_a?(Fixnum) ? Delay : 60
end
#-----------------------------------------------------------------------------
# * Item Gain Sound
#-----------------------------------------------------------------------------
def self.gain_se
unless GainSE.nil?
if GainSE.is_a?(String)
return Audio.se_play("Audio/SE/" + GainSE, 100, 100)
elsif GainSE.is_a?(Array) and GainSE.size == 2
return Audio.se_play("Audio/SE/" + GainSE[0], GainSE[1], GainSE[2])
end
end
end
#-----------------------------------------------------------------------------
# * Item Loss Sound
#-----------------------------------------------------------------------------
def self.loss_se
unless LossSE.nil?
if LossSE.is_a?(String)
return Audio.se_play("Audio/SE/" + LossSE, 100, 100)
elsif LossSE.is_a?(Array) and LossSE.size == 2
return Audio.se_play("Audio/SE/" + LossSE[0], LossSE[1], LossSE[2])
end
end
end
end
#===============================================================================
# ** Game_Temp
#-------------------------------------------------------------------------------
# The ItemGet Window is activated and disabled through the following command.
# -->> $game_temp.display_itemget = true / false <<--
#===============================================================================
class Game_Temp
#-----------------------------------------------------------------------------
# * Attribute Accessors
#-----------------------------------------------------------------------------
attr_accessor :display_itemget
#-----------------------------------------------------------------------------
# * Alias Methods
#-----------------------------------------------------------------------------
alias_method :kn_itemgetwindow_game_temp_initialize, :initialize
#-----------------------------------------------------------------------------
# * Object Initialization
#-----------------------------------------------------------------------------
def initialize
kn_itemgetwindow_game_temp_initialize
@display_itemget = true
end
end
#===============================================================================
# ** Window_ItemGet
#-------------------------------------------------------------------------------
# This window displays the item gained on the map, if the script is enabled.
#===============================================================================
class Window_ItemGet < Window_Base
#-----------------------------------------------------------------------------
# * Attributes
#-----------------------------------------------------------------------------
attr_accessor :type
attr_accessor :id
attr_accessor :value
#-----------------------------------------------------------------------------
# * Object Initialization
#-----------------------------------------------------------------------------
def initialize(type = 1, id = 0)
super(0, 0, 220, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.visible = false
self.contents.font.name = ItemGet.font_name
self.contents.font.size = ItemGet.font_size
@type, @id, @value = type, id, value
refresh_gain
refresh_loss
end
#-----------------------------------------------------------------------------
# * Refresh (Gain)
#-----------------------------------------------------------------------------
def refresh_gain
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 180, 32, "Acquired")
self.contents.font.color = normal_color
self.contents.draw_text(0, 32, 168, 32, value.to_s, 2)
case @type
when 1 ; self.draw_item_name($data_items[@id], 4, 32)
when 2 ; self.draw_item_name($data_weapons[@id], 4, 32)
when 3 ; self.draw_item_name($data_armors[@id], 4, 32)
end
end
#-----------------------------------------------------------------------------
# * Refresh (Loss)
#-----------------------------------------------------------------------------
def refresh_loss
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 180, 32, "Lost")
self.contents.font.color = normal_color
self.contents.draw_text(0, 32, 168, 32, value.to_s, 2)
case @type
when 1 ; self.draw_item_name($data_items[@id], 4, 32)
when 2 ; self.draw_item_name($data_weapons[@id], 4, 32)
when 3 ; self.draw_item_name($data_armors[@id], 4, 32)
end
end
#-----------------------------------------------------------------------------
# * Update
#-----------------------------------------------------------------------------
def update
super
end
end
#===============================================================================
# ** Interpreter
#-------------------------------------------------------------------------------
# The "Gain Item", "Gain Weapon" and "Gain Armor" commands have been enhanced
# to use the "Item Get" window, if the script is enabled.
#===============================================================================
class Interpreter
#-----------------------------------------------------------------------------
# * Alias Methods
#-----------------------------------------------------------------------------
alias_method :kn_itemgetwindow_interpreter_command126, :command_126
alias_method :kn_itemgetwindow_interpreter_command127, :command_127
alias_method :kn_itemgetwindow_interpreter_command128, :command_128
#-----------------------------------------------------------------------------
# * Change Items
#-----------------------------------------------------------------------------
def command_126
if $scene.is_a?(Scene_Map) && $game_temp.display_itemget
value = operate_value(@parameters[1], @parameters[2], @parameters[3])
$game_party.gain_item(@parameters[0], value)
if value >= 1
$scene.item_gain[0] = 1
$scene.item_gain[1] = (@parameters[0])
$scene.item_value = value
ItemGet.gain_se
else
$scene.item_loss[0] = 1
$scene.item_loss[1] = (@parameters[0])
$scene.item_value = value
ItemGet.loss_se
end
return true
else ; kn_itemgetwindow_interpreter_command126
end
end
#-----------------------------------------------------------------------------
# * Change Weapons
#-----------------------------------------------------------------------------
def command_127
if $scene.is_a?(Scene_Map) && $game_temp.display_itemget
value = operate_value(@parameters[1], @parameters[2], @parameters[3])
$game_party.gain_weapon(@parameters[0], value)
if value >= 1
$scene.item_gain[0] = 2
$scene.item_gain[1] = (@parameters[0])
$scene.item_value = value
ItemGet.gain_se
else
$scene.item_loss[0] = 2
$scene.item_loss[1] = (@parameters[0])
$scene.item_value = value
ItemGet.loss_se
end
return true
else ; kn_itemgetwindow_interpreter_command127
end
end
#-----------------------------------------------------------------------------
# * Change Armor
#-----------------------------------------------------------------------------
def command_128
if $scene.is_a?(Scene_Map) && $game_temp.display_itemget
value = operate_value(@parameters[1], @parameters[2], @parameters[3])
$game_party.gain_armor(@parameters[0], value)
if value >= 1
$scene.item_gain[0] = 3
$scene.item_gain[1] = (@parameters[0])
$scene.item_value = value
ItemGet.gain_se
else
$scene.item_loss[0] = 3
$scene.item_loss[1] = (@parameters[0])
$scene.item_value = value
ItemGet.loss_se
end
return true
else ; kn_itemgetwindow_interpreter_command128
end
end
end
#===============================================================================
# ** Scene_Map
#-------------------------------------------------------------------------------
# This scene has been enhanced with the "Item Acquired" window.
#===============================================================================
class Scene_Map
#-----------------------------------------------------------------------------
# * Attributes
#-----------------------------------------------------------------------------
attr_accessor :item_gain
attr_accessor :item_loss
attr_accessor :item_value
#-----------------------------------------------------------------------------
# * Alias Methods
#-----------------------------------------------------------------------------
alias_method :kn_itemgetwindow_scene_map_main, :main
alias_method :kn_itemgetwindow_scene_map_update, :update
#-----------------------------------------------------------------------------
# * Main Method (*Aliased*)
#-----------------------------------------------------------------------------
def main
@window_itemget = Window_ItemGet.new
@item_gain, @item_loss, @item_value, @item_delay = [0, 0], [0, 0], 0, 0
kn_itemgetwindow_scene_map_main
@window_itemget.dispose unless @window_itemget.nil?
end
#-----------------------------------------------------------------------------
# * Update Method (*Aliased*)
#-----------------------------------------------------------------------------
def update
kn_itemgetwindow_scene_map_update
if @item_delay > 0
@item_delay -= 1
elsif @item_delay.zero? || $game_temp.display_itemget == false
@item_delay = -1
@window_itemget.visible = false
@item_gain[0], @item_gain[1], @item_loss[0], @item_loss[1] = 0, 0, 0, 0
end
if @item_gain[0] != 0 && @item_gain[1] != 0 && @item_delay < 0
@window_itemget.type = @item_gain[0]
@window_itemget.id = @item_gain[1]
@window_itemget.value = @item_value
@window_itemget.refresh_gain
@window_itemget.visible = true
@item_delay = ItemGet.delay
elsif @item_loss[0] != 0 && @item_loss[1] != 0 && @item_delay < 0
@window_itemget.type = @item_loss[0]
@window_itemget.id = @item_loss[1]
@window_itemget.value = @item_value
@window_itemget.refresh_loss
@window_itemget.visible = true
@item_delay = ItemGet.delay
end
end
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
# Original Dispose
seph_etd_spchr_dispose
# Dispose ETD Sprite
dispose_etd_sprite
end
#==============================================================================
# ** Sound Interaction System
#------------------------------------------------------------------------------
# SephirothSpawn
# Version 1
# 2007-03-21
# SDK : Version 2.0+, Parts I & II
#------------------------------------------------------------------------------
# * Version History :
#
# Version 1 ---------------------------------------------------- (2007-03-21)
#------------------------------------------------------------------------------
# * Description
#
# This script was designed to :
# - play sound effects for moving characters and events on the map
# - play background sound effects (bgs) when within range of events
#
# When your player approaches an event with a walking sound effect, you will
# here footsteps or other sound effects equal to the distance the player is
# from the event. When the player gets within a range of an object with a
# bgs, the bgs is played as the footsteps are played, just constantly.
#------------------------------------------------------------------------------
# * Instructions
#
# Place The Script Below the SDK and Above Main.
#
# Setting Events with Sound Interaction
# - Comment : Sound Interaction|type|filename|max_volume|max_distance
#
# Replace :
# - type : MVT (for movement) or
# RNG (for bgs)
# - filename : filename of se or bgs
# - max_volume : max volume
# - max_distance : max distance
#------------------------------------------------------------------------------
# * Customization
#
# Default player movement sound effect settings
# - Player_Movement_SE_Name = 'se_filename'
# - Player_Movement_SE_Volume = max_volume
# - Player_Movement_SE_Frames = [frame_id, ...]
#
# Default events frames to play se
# - Movement_SE_Frames = [frame_id, ...]
#------------------------------------------------------------------------------
# * Syntax :
#
# Setting Sound Interaction Settings
# <game_character>.sis_movement_se_name = 'filename' or nil
# <game_character>.sis_movement_se_max_volume = n
# <game_character>.sis_movement_se_max_distance = n
# <game_character>.sis_movement_se_frames = [frame_id, ...]
# <game_character>.sis_range_bgs_name = 'filename' or nil
# <game_character>.sis_range_bgs_max_volume = n
# <game_character>.sis_range_bgs_max_distance = n
#
# NOTE : For events, when the event refreshes, these are all refreshed
# by the page comments.
#
# Setting Player Sound Interaction Settings
# $game-player.sis_enabled = true or false
#==============================================================================
#==============================================================================
# ** Sound Interaction System
#==============================================================================
module Sound_Interaction
#--------------------------------------------------------------------------
# * Player Movement SE
#--------------------------------------------------------------------------
Player_Movement_SE_Name = nil
Player_Movement_SE_Volume = 60
Player_Movement_SE_Frames = [0]
#--------------------------------------------------------------------------
# * Non-Defined Frames To Play Movement SE
#--------------------------------------------------------------------------
Movement_SE_Frames = [0]
end
#==============================================================================
# ** Game_Character
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :sis_movement_se_name
attr_accessor :sis_movement_se_max_volume
attr_accessor :sis_movement_se_max_distance
attr_accessor :sis_movement_se_frames
attr_accessor :sis_range_bgs_name
attr_accessor :sis_range_bgs_max_volume
attr_accessor :sis_range_bgs_max_distance
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias_method :seph_soundintsys_gmchr_ua, :update
#--------------------------------------------------------------------------
# * Frame Update : Animation Counters
#--------------------------------------------------------------------------
def update
# Gets Old Pattern
old_pattern = @pattern
# Original Update Animation Counters
seph_soundintsys_gmchr_ua
# If Play Movement SE
unless @sis_movement_se_name.nil?
# If Pattern is Different
if old_pattern != @pattern &&
# If Movement SE Frame
@sis_movement_se_frames.include?(old_pattern)
# Gets Distance From Player
px, py = $game_player.x, $game_player.y
distance = self == $game_player ? 0 : Math.hypot(@x - px, @y - py)
# Calculates Volume
md = @sis_movement_se_max_distance
mv = @sis_movement_se_max_volume
volume = distance == 0 ? mv : distance > md ? 0 :
mv * ((md - (distance - 1)) / md)
# If Volume Greater Than 0
if volume > 0 && ![nil, ''].include?(@sis_movement_se_name)
# Play Movement SE
Audio.se_play('Audio/SE/' + @sis_movement_se_name, volume)
end
end
end
end
end
#==============================================================================
# ** Game_Event
#==============================================================================
class Game_Event
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias_method :seph_soundintsys_gmevt_refrsh, :refresh
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Original Refresh
seph_soundintsys_gmevt_refrsh
# Set LD Variables
@sis_movement_se_name = nil
@sis_movement_se_max_volume = 100
@sis_movement_se_max_distance = 10
@sis_range_bgs_name = nil
@sis_range_bgs_max_volume = 100
@sis_range_bgs_max_distance = 10
# Return if Nil Page or Erased
return if @list.nil? || @erased
# Pass Through All Event Commands
for ec in @list
# If Comment Command
if ec.code == 108 &&
# And Comments Include "SOUND INTERACTION"
ec.parameters[0].upcase.include?('SOUND INTERACTION')
# Split Comment Line
parameters = ec.parameters[0].split('|')
# Branch By Type
case parameters[1].upcase
when 'MVT'
# Set Filename, Volume & Distance
@sis_movement_se_name = parameters[2]
@sis_movement_se_max_volume = parameters[3].to_i
@sis_movement_se_max_distance = parameters[4].to_i
if parameters[5].nil?
@sis_movement_se_frames = Sound_Interaction::Movement_SE_Frames
else
@sis_movement_se_frames = eval "[#{parameters[5]}]"
end
when 'RNG'
# Set Filename, Volume & Distance
@sis_range_bgs_name = parameters[2]
@sis_range_bgs_max_volume = parameters[3].to_i
@sis_range_bgs_max_distance = parameters[4].to_i
end
end
end
end
end
#==============================================================================
# ** Game_Player
#==============================================================================
class Game_Player
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :sis_range_bgs
attr_accessor :sis_enabled
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias_method :seph_soundintsys_gmplyr_init, :initialize
alias_method :seph_soundintsys_gmplyr_update, :update
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Original Initialization
seph_soundintsys_gmplyr_init
# Enable Sound Interaction
@sis_enabled = true
# Set Movement Distances
@sis_movement_se_name = Sound_Interaction::Player_Movement_SE_Name
@sis_movement_se_max_volume = Sound_Interaction::Player_Movement_SE_Volume
@sis_movement_se_frames = Sound_Interaction::Player_Movement_SE_Frames
# Set Distances
@sis_event_distances = {}
@sis_event_distances.default = nil
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Original Update
seph_soundintsys_gmplyr_update
# Update Sound Interaction
update_sound_interaction
end
#--------------------------------------------------------------------------
# * Event Distances
#--------------------------------------------------------------------------
def sis_event_ranges
# ditance => [event_id]
ranges = {}
for event_id in $game_map.events.keys.sort
event = $game_map.events[event_id]
next if event.sis_range_bgs_name.nil?
distance = Math.hypot(@x - event.x, @y - event.y)
ranges[distance] = [] unless ranges.has_key?(distance)
ranges[distance] << event_id
end
return ranges
end
#--------------------------------------------------------------------------
# * Frame Update : Sound Interaction Range
#--------------------------------------------------------------------------
def update_sound_interaction
# If Not Enabled
unless @sis_enabled
# If BGS Playing
if @sis_range_bgs != nil
# Set Range BGS to Nil
@sis_range_bgs = nil
# Stop BGS
$game_system.bgs_play(nil)
end
return
end
# Gets Event Ranges
event_ranges = sis_event_ranges
# Set Main Break Flag to False
main_break = false
# Pass Through Shortest to Farthest Range
for distance in event_ranges.keys.sort
# Pass Through Events
for event_id in event_ranges[distance].sort
# If Last Event Played & Distance Hasn't Changed
if @sis_range_last_event_id == event_id &&
@sis_event_distances[event_id] == distance
# Break Main Loop
main_break = true
# Break Loop
break
end
# Gets Event Data
event = $game_map.events[event_id]
# If Distance Has Changed
if @sis_event_distances[event_id] != distance
# Record Distance Change
@sis_event_distances[event_id] = distance
# Calculates Volume
md = event.sis_range_bgs_max_distance
mv = event.sis_range_bgs_max_volume
volume = distance == 0 ? mv : distance > md ? 0 :
mv * ((md - (distance - 1)) / md)
# If Volume is Less Than 1
if volume < 1
# If Volume was Playing Before
if @sis_range_bgs == event.sis_range_bgs_name
# Set Previoius BGS to Nil
@sis_range_bgs = nil
# Clear SIS Last Event Range Flag
@sis_range_last_event_id = nil
# Stop BGS
$game_system.bgs_play(nil)
end
next
end
# Record Playing BGS
@sis_range_bgs = event.sis_range_bgs_name
# Record SIS Last Event Range Flag
@sis_range_last_event_id = event_id
# Play BGS
$game_system.bgs_play(RPG::AudioFile.new(@sis_range_bgs, volume))
# Break Main Loop
main_break = true
# Break Loop
break
end
end
# Break if Break Main is True
break if main_break
end
end
end
#==============================================================================
# ** Scene_Map
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias_method :seph_soundintsys_scnmap_cb, :call_battle
#--------------------------------------------------------------------------
# * Frame Update : Call Battle
#--------------------------------------------------------------------------
def call_battle
# If Player Playing Sound Interaction BGS
if $game_player.sis_enabled && $game_player.sis_range_bgs != nil
# Clear BGS
$game_player.sis_range_bgs = nil
# Stop BGS
$game_system.bgs_play(nil)
end
# Original Call Battle
seph_soundintsys_scnmap_cb
end
end#==============================================================================
# ** Event Icon & Text Display
#------------------------------------------------------------------------------
# SephirothSpawn
# Original Text Display By Áص¹
# Version 4.0
# 2007-07-30
# SDK : Version 2.0, Parts I & II
#------------------------------------------------------------------------------
# * Version History :
#
# Version 1 -------------------------------------------- (Approx. 2006-01-01)
# Version 2 ---------------------------------------------------- (2006-03-04)
# Version 3 ---------------------------------------------------- (2006-08-22)
# - Update : Re-scripted Much of the System
# Version 3.01 ------------------------------------------------ (2006-10-23)
# - Bug Fix : Fixed Erase Event
# Version 3.1 ------------------------------------------------- (2007-01-11)
# - Update : Removed Shadow Text Elements
# Version 3.11 ------------------------------------------------ (2007-02-08)
# - Update : Updated to SDK 2.0
# Version 4 ---------------------------------------------------- (2007-07-30)
# - Update : Rescripted to include text and icons
#------------------------------------------------------------------------------
# * Requirements :
#
# Method & Class Library (2.1+)
#------------------------------------------------------------------------------
# * Description :
#
# This script was designed to add floating text and icons over events and
# players on the map. You can control the color of the text and choose
# multiple options for the text over the player.
#------------------------------------------------------------------------------
# * Instructions
#
# Place The Script Below the SDK and Above Main.
#
# Setting Event Display Text. Replace <text> with the text you want to be
# displayed of event.
# Comment: {ETD<text>}
#
# For icons, use [icon_name] in text. Make sure to seperate with space.
#
# For Default Settings, refer to customization.
# For Modifing Setting during game play, refer to syntax.
#------------------------------------------------------------------------------
# * Customization
#
# Default Event Text Color
# - ETD_Default_EventText_Color = Color.new(red, green, blue)
#
# Default Player Text Color
# - ETD_Default_PlayerText_Color = Color.new(red, green, blue)
#
# Default Player Display Option
# - ETD_Default_PlayerText = 'Name', 'Class', 'Level', 'Hp', 'Sp'
#------------------------------------------------------------------------------
# * Syntax
#
# Changing Character Display Text
# - <game_character>.etd_display_text = 'String'
# Changing Character Display Color
# - <game_character>.etd_display_color = Color.new(r, g, b, a)
#
# * Substitute <game_character> with $game_player for the player, or
# $game_map.events[event_id] to replace with an event.
#==============================================================================
#=============================================================================
# ** Game_Character
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
# * Defaults
#
# ~ Default Player Display Options (Non-Case Sensitive):
# 'Name', 'Class', 'Level', 'Hp', 'Sp'
#--------------------------------------------------------------------------
ETD_Default_EventText_Color = Color.new(0, 0, 0)
ETD_Default_PlayerText_Color = Color.new(200, 0, 0)
ETD_Default_PlayerText = 'gem'
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :etd_display_color
attr_accessor :etd_display_text
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias_method :seph_etd_gmchr_init, :initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Sets ETD Options
@etd_display_color = self.is_a?(Game_Player) ?
ETD_Default_PlayerText_Color : ETD_Default_EventText_Color
# Original Initialization
seph_etd_gmchr_init
end
end
#==============================================================================
# ** Game_Event
#==============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias_method :seph_etd_gmevt_refresh, :refresh
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Original Refresh Method
seph_etd_gmevt_refresh
# Erase ETD Display Text
@etd_display_text = nil
# Checks to see if display text
unless @list.nil? || @erased
for i in 0...@list.size
if @list[i].code == 108
@list[i].parameters[0].dup.gsub!(/\{[Ee][Tt][Dd](.+?)\}/) do
@etd_display_color = ETD_Default_EventText_Color
@etd_display_text = $1
end
end
end
end
end
end
#==============================================================================
# ** Game_Player
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias_method :seph_etd_gmplyr_refresh, :refresh
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Original Refresh Method
seph_etd_gmplyr_refresh
# Gets First Actor
actor = $game_party.actors[0]
# Retrn if Nil Actor
return if actor.nil?
# Determines Text
case ETD_Default_PlayerText.dup.downcase
when 'name' ; txt = actor.name
when 'class' ; txt = actor.class_name
when 'level' ; txt = "Level: #{actor.level}"
when 'hp' ; txt = "HP: #{actor.hp} / #{actor.maxhp}"
when 'sp' ; txt = "SP: #{actor.sp} / #{actor.maxsp}"
when 'gem' ; txt = '{[player]}'
else ; txt = ''
end
# Creates Text Display
@etd_display_color = ETD_Default_PlayerText_Color
@etd_display_text = txt
end
end
#==============================================================================
# ** Sprite_Character
#==============================================================================
class Sprite_Character < RPG::Sprite
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias_method :seph_etd_spchr_update, :update
alias_method :seph_etd_spchr_dispose, :dispose
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Original update Method
seph_etd_spchr_update
# Character Display Update Method
update_display_text
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
# Original Dispose
#seph_etd_spchr_dispose
# Dispose ETD Sprite
dispose_etd_sprite
end
#--------------------------------------------------------------------------
# * Dispose ETD Sprite
#--------------------------------------------------------------------------
def dispose_etd_sprite
# Dispose ETD Sprite
unless @_etd_text_sprite.nil?
@_etd_text_sprite.dispose
@_etd_text_sprite = nil
end
end
#--------------------------------------------------------------------------
# * Update Display Sprite
#--------------------------------------------------------------------------
def update_display_text
# If Character Has No ETD
if @character.etd_display_text.nil?
# Dispose ETD Sprite
dispose_etd_sprite
return
end
# If ETD Text Sprite Doesn't Exist
if @_etd_text_sprite.nil?
# Create ETD Text Sprite
create_etd_sprite
return
end
# If ETD Sprite Parameters Don't Match Characters
unless @_etd_display_text == @character.etd_display_text &&
@_etd_display_color == @character.etd_display_color
# Dispose Sprite
dispose_etd_sprite
# Recreate Sprite
create_etd_sprite
end
# Update ETD Sprite Position
@_etd_text_sprite.x = self.x
@_etd_text_sprite.y = self.y - self.oy / 2 - 24
end
#--------------------------------------------------------------------------
# * Create ETD Sprite
#--------------------------------------------------------------------------
def create_etd_sprite
# Creates Display Bitmap
bitmap = Bitmap.new(192, 26)
# Draws ETD Display Text
begin
bitmap.font.color = @character.etd_display_color
rescue
@character.etd_display_color = @character.is_a?(Game_Player) ?
Game_Character::ETD_Default_PlayerText_Color :
Game_Character::ETD_Default_EventText_Color
bitmap.font.color = @character.etd_display_color
end
bitmap.draw_icon_text(0, 0, 192, 24, @character.etd_display_text, 1)
# Creates Display Text Sprite
@_etd_text_sprite = Sprite.new(self.viewport)
@_etd_text_sprite.bitmap = bitmap
@_etd_text_sprite.ox = 80
@_etd_text_sprite.oy = 24
@_etd_text_sprite.x = self.x
@_etd_text_sprite.y = self.y - self.oy / 2 - 24
@_etd_text_sprite.z = 3000
@_etd_text_sprite.visible = true
# Saves ETD Text
@_etd_display_text = @character.etd_display_text
@_etd_display_color = @character.etd_display_color
end
end#===============================================================================
# ** SAI Random Wander State
#-------------------------------------------------------------------------------
# Author: Bishop Myers ("Sailerius")
# Version: 1.01
# Date: 2011.06.15
# SDK Version: 2.4
#===============================================================================
# Instructions
# ------------------------------------------------------------------------------
# Just paste this script in below the SDK and all events using Random movement
# will automatically begin using the wander state.
# ------------------------------------------------------------------------------
# What It Does
# ------------------------------------------------------------------------------
# The default Random movement looks very artificial. Instead of choosing a
# random adjacent tile to move to, the events will now select a random
# destination and walk to it, making it appear as if they're moving with
# purpose. Once they reach their new destination, the events will select a new
# point to wander to.
#===============================================================================
#===============================================================================
# ** Game_Character
#===============================================================================
class Game_Character
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :sailerius_saiwander_gamecharacter_initialize, :initialize
alias_method :sailerius_saiwander_gamecharacter_movetyperandom, :move_type_random
#-----------------------------------------------------------------------------
# * Public Instance Variables
#-----------------------------------------------------------------------------
attr_reader :wander_x # map x-coordinate to pursue
attr_reader :wander_y # map y-coordinate to pursue
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
sailerius_saiwander_gamecharacter_initialize
set_wander_destination
end
#--------------------------------------------------------------------------
# * Move Type : Random
#--------------------------------------------------------------------------
def move_type_random
# Check if reached destination
if (@wander_x == @x and @wander_y == @y)
set_wander_destination
end
sailerius_saiwander_gamecharacter_movetyperandom
end
#--------------------------------------------------------------------------
# * Move at Random
#--------------------------------------------------------------------------
def move_random
# Get distance from destination
dx = @x - @wander_x
dy = @y - @wander_y
# Move horizontally
unless dx == 0
if dx < 0
# Go somewhere else if impassable
if not passable?(@x + 1, @y, 0)
set_wander_destination
return
end
move_right(false)
return
else
# Go somewhere else if impassable
if not passable?(@x - 1, @y, 0)
set_wander_destination
return
end
move_left(false)
return
end
end
# Move vertically
unless dy == 0
if dy < 0
# Go somewhere else if impassable
if not passable?(@x, @y + 1, 0)
set_wander_destination
return
end
move_down(false)
return
else
# Go somewhere else if impassable
if not passable?(@x, @y - 1, 0)
set_wander_destination
return
end
move_up(false)
return
end
end
end
#--------------------------------------------------------------------------
# * Determine New Wander Destination
#--------------------------------------------------------------------------
def set_wander_destination
@wander_x = @x + rand(40) - 20
@wander_y = @y + rand(40) - 20
end
end#==============================================================================
# Path Finding
#==============================================================================
# Near Fantastica
# Version 1
# 29.11.05
#==============================================================================
# Lets the Player or Event draw a path from an desonation to the source. This
# method is very fast and because the palthfinding is imbeded into the Game
# Character the pathfinding can be inturputed or redrawn at any time.
#==============================================================================
# Player :: $game_player.find_path(x,y)
# Event Script Call :: self.event.find_path(x,y)
# Event Movement Script Call :: self.find_path(x,y)
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
alias nf_pf_game_character_initialize initialize
alias nf_pf_game_character_update update
#--------------------------------------------------------------------------
attr_accessor :map
attr_accessor :runpath
#--------------------------------------------------------------------------
def initialize
nf_pf_game_character_initialize
@map = nil
@runpath = false
end
#--------------------------------------------------------------------------
def update
run_path if @runpath == true
nf_pf_game_character_update
end
#--------------------------------------------------------------------------
def run_path
return if moving?
step = @map[@x,@y]
if step == 1
@map = nil
@runpath = false
return
end
dir = rand(2)
case dir
when 0
move_right if @map[@x+1,@y] == step - 1 and step != 0
move_down if @map[@x,@y+1] == step - 1 and step != 0
move_left if @map[@x-1,@y] == step -1 and step != 0
move_up if @map[@x,@y-1] == step - 1 and step != 0
when 1
move_up if @map[@x,@y-1] == step - 1 and step != 0
move_left if @map[@x-1,@y] == step -1 and step != 0
move_down if @map[@x,@y+1] == step - 1 and step != 0
move_right if @map[@x+1,@y] == step - 1 and step != 0
end
end
#--------------------------------------------------------------------------
def find_path(x,y)
sx, sy = @x, @y
result = setup_map(sx,sy,x,y)
@runpath = result[0]
@map = result[1]
@map[sx,sy] = result[2] if result[2] != nil
end
#--------------------------------------------------------------------------
def clear_path
@map = nil
@runpath = false
end
#--------------------------------------------------------------------------
def setup_map(sx,sy,ex,ey)
map = Table.new($game_map.width, $game_map.height)
map[ex,ey] = 1
old_positions = []
new_positions = []
old_positions.push([ex, ey])
depth = 2
depth.upto(100){|step|
loop do
break if old_positions[0] == nil
x,y = old_positions.shift
return [true, map, step] if x == sx and y+1 == sy
if $game_player.passable?(x, y, 2) and map[x,y + 1] == 0
map[x,y + 1] = step
new_positions.push([x,y + 1])
end
return [true, map, step] if x-1 == sx and y == sy
if $game_player.passable?(x, y, 4) and map[x - 1,y] == 0
map[x - 1,y] = step
new_positions.push([x - 1,y])
end
return [true, map, step] if x+1 == sx and y == sy
if $game_player.passable?(x, y, 6) and map[x + 1,y] == 0
map[x + 1,y] = step
new_positions.push([x + 1,y])
end
return [true, map, step] if x == sx and y-1 == sy
if $game_player.passable?(x, y, 8) and map[x,y - 1] == 0
map[x,y - 1] = step
new_positions.push([x,y - 1])
end
end
old_positions = new_positions
new_positions = []
}
return [false, nil, nil]
end
end
class Game_Map
#--------------------------------------------------------------------------
alias pf_game_map_setup setup
#--------------------------------------------------------------------------
def setup(map_id)
pf_game_map_setup(map_id)
$game_player.clear_path
end
end
class Game_Player
#--------------------------------------------------------------------------
alias pf_game_player_update_player_movement update
#--------------------------------------------------------------------------
def update
$game_player.clear_path if Input.dir4 != 0
pf_game_player_update_player_movement
end
end
class Interpreter
#--------------------------------------------------------------------------
def event
return $game_map.events[@event_id]
end
end
#==============================================================================
# ** Slipknot Advance Message System
#------------------------------------------------------------------------------
# Slipknot
# 3.0
# 02.23.06
#------------------------------------------------------------------------------
=begin
Thanks to:
- Dubealex, for some of the features.
- Phylomorphis, for the hexadecimal color.
=end
#==============================================================================
module Message_Settings
#--------------------------------------------------------------------------
# • Default text display:
# 0: normal
# 1: shadow
# 2: outline
#--------------------------------------------------------------------------
Default_Text = 2
#--------------------------------------------------------------------------
# • Name Box skin:
# nil = same as message box
#--------------------------------------------------------------------------
NB_skin = ('Charcoal XP')
#--------------------------------------------------------------------------
# • Fade the name box and picture
#--------------------------------------------------------------------------
Fade = true
#--------------------------------------------------------------------------
# • Cursor based in current choice width
#--------------------------------------------------------------------------
Advance_Cursor = true
#--------------------------------------------------------------------------
# • Folder for the message pictures
#--------------------------------------------------------------------------
Path = ('Graphics/Pictures/Message/')
#--------------------------------------------------------------------------
end
#--------------------------------------------------------------------------
# Loads the maps' names
#--------------------------------------------------------------------------
$data_mapinfos = load_data ('Data/MapInfos.rxdata')
#--------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Begin Bitmap Edit
#------------------------------------------------------------------------------
class Bitmap
#--------------------------------------------------------------------------
# • Outline Text
#--------------------------------------------------------------------------
def draw_text_outline x, y, wid, hei, str, ali=0
color = font.color.dup
font.color.set 0, 0, 0, color.alpha
draw_text x+1, y, wid, hei, str, ali
draw_text x-1, y, wid, hei, str, ali
draw_text x, y+1, wid, hei, str, ali
draw_text x, y-1, wid, hei, str, ali
font.color = color
draw_text x, y, wid, hei, str, ali
end
#--------------------------------------------------------------------------
# • Shadow Text
#--------------------------------------------------------------------------
def draw_text_shadow x, y, wid, hei, str, ali=0
color = font.color.dup
font.color.set 0, 0, 0, (color.alpha*2.0/3.0).ceil
draw_text x+2, y+2, wid, hei, str, ali
font.color = color
draw_text x, y, wid, hei, str, ali
end
end
#------------------------------------------------------------------------------
# End Bitmap Edit
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Begin Window_Message Edit
#------------------------------------------------------------------------------
class Window_Message < Window_Selectable
#--------------------------------------------------------------------------
# • Include Message_Settings constants
#--------------------------------------------------------------------------
include Message_Settings
#--------------------------------------------------------------------------
# • Window intialization
#--------------------------------------------------------------------------
def initialize
super 0, 304, 640, 160
self.contents = Bitmap.new 608, 128
self.z = 9998
@fade_in = @contents_showing = false
self.index = -1
self.opacity = @cursor_width = 0
@back = Window_Base.new 65, 299, 510, 175
@back.z = 9990
self.active = self.visible = false
end
#--------------------------------------------------------------------------
# • Hides or show the window contents and background
#--------------------------------------------------------------------------
def visible=(val)
super
@back.visible = val
end
#--------------------------------------------------------------------------
# • Dispose of all internal objects
#--------------------------------------------------------------------------
def dispose
terminate_message
$game_temp.message_window_showing = false
@back.dispose
super
end
#--------------------------------------------------------------------------
# • Terminates the message processing
#--------------------------------------------------------------------------
def terminate_message
self.active = @back.pause = false
self.index = -1
contents.clear
@contents_showing = false
if $game_temp.message_proc != nil
$game_temp.message_proc.call
end
[$game_temp].each do |t|
t.message_text = t.message_proc = t.choice_proc = nil
t.choice_start = t.num_input_start = 99
t.choice_max = t.choice_cancel_type = 0
t.num_input_variable_id = t.num_input_digits_max = 0
end
[@gold_window, @name_box, @picture, input_window].each do |x|
x.dispose if exists? x
end
end
#--------------------------------------------------------------------------
# • Writes all the text in the window
#--------------------------------------------------------------------------
def refresh
contents.clear
[contents.font].each do |x|
x.name = Font.default_name
x.size = 18
x.bold = x.italic = false
x.color = normal_color
end
case Default_Text
when 0 then disp_text
when 1 then disp_text false, true
when 2 then disp_text true end
x = y = 0
x = 8 if $game_temp.choice_start == 0
return if (text = $game_temp.message_text).nil?
text.gsub!(/\\[Rr]and\((\d+)\)/) { rand($1).to_s }
text.gsub!(/\\[Vv]\[(\d+)\]/) { $game_variables[$1.to_i] }
text.gsub!(/\\[Nn]\[(\d+)\]/) {
$game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : '' }
text.gsub!(/\\[Nn][Pp]\[([\d+])\]/) { $game_party.actors[$1.to_i].name }
text.gsub!(/\\\$\$/) {"#{$game_party.gold} #{$data_system.words.gold}"}
text.gsub!(/\\\$/) { $game_party.gold.to_s }
text.gsub!(/\\[Cc]lass\[(\d+)\]/) {
$game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].class_name : '' }
text.gsub!(/\\[Mm]ap/) { $game_map.name }
face = over_event = false
picture = name_box = ''
if (/\\[Nn]a\[(.+?)\]/.match(text)) != nil
name_box = $1
text.sub!(/\\[Nn]a\[.*?\]/) { '' }
end
if (/\\[Pp]ic\[(.+?)\]/.match(text)) != nil
picture = $1
text.sub!(/\\[Pp]ic\[.*?\]/) { '' }
end
# Right
if (/\\[Ff]{(.+?)}/.match(text)) != nil
face, face_name = 1, $1
text.sub!(/\\[Ff]{.*?}/) { '' }
end
# Left
if (/\\[Ff]\[(.+?)\]/.match(text)) != nil
face, face_name = 2, $1
text.sub!(/\\[Ff]\[.*?\]/) { '' }
end
if (/\\[Pp]\[([-1,0-9]+)\]/.match(text)) != nil
over_event, event = true, $1.to_i
text.sub!(/\\[Pp]\[[-1,0-9]+\]/) { '' }
end
if (/\\[Pp]/.match(text)) != nil
over_event, event = true, $game_temp.this_event
text.sub!(/\\[Pp]/) { '' }
end
text.gsub!(/\\\\/) { "\000" }
text.gsub!(/\\[Cc]\[([[0-9][A-F][a-f]#]+)\]/) { "\001[#$1]" }
text.gsub!(/\\[Gg]/) { "\002" }
text.gsub!(/\\[Tt][Ss]\[(\d+)\]/) { "\003[#$1]" }
text.gsub!(/\\[Ff]ont\[(.+?)\]/) { "\004[#$1]" }
text.gsub!(/\\[Tt]ext\[([0-2])\]/) { "\005[#$1]" }
text.gsub!(/\\[Ii]c\[(.+?)\]/) { "\006[#$1]" }
text.gsub!(/\\[Ii]i{([IiWwAaSs]?)}\[(\d+)\]/) { change_icon($1, $2.to_i) }
text.gsub!(/\\[Bb]/) { "\007" }
text.gsub!(/\\[Ii]/) { "\010" }
@cursor_width = 0, 0, 0, 0
stxt = 0, 0, 0, 0
icon = ''
x = 104 if face == 2
while (c = text.slice!(/./m)) != nil
case c
when "\000" then c = '\\'
when "\001"
text.sub!(/\[(.*?)\]/, '')
hex = $1.to_s
color = $1.to_i
contents.font.color = text_color(color)
if hex.slice!(/./m) == '#'
contents.font.color = hex_color(hex)
next
end
contents.font.color = text_color(color)
next
when "\002"
next if @gold_window != nil
@gold_window = Window_Gold.new
@gold_window.x = 560 - @gold_window.width
@gold_window.y = $game_temp.in_battle ? 192 : (self.y >= 128 ? 32 : 384)
@gold_window.opacity = @back.opacity
@gold_window.back_opacity = @back.back_opacity
next
when "\003"
text.sub!(/\[([0-9]+)\]/, '')
contents.font.size = [[$1.to_i, 6].max, 32].min
next
when "\004"
text.sub!(/\[(.+?)\]/, '')
contents.font.name = $1.to_s
next
when "\005"
text.sub!(/\[([0-9]+)\]/, '')
case $1.to_i
when 0 then disp_text
when 1 then disp_text false,true
when 2 then disp_text true end
next
when "\006"
text.sub!(/\[(.+?)\]/, '')
icon = $1.to_s
c = ''
when "\007"
[contents.font].each do |h| h.bold = !h.bold end
next
when "\010"
[contents.font].each do |h| h.italic = !h.italic end
next
when "\013"
text.sub!(/\[(.*?)\]/, '')
icon = $1.to_s
c = ''
when "\n"
y += 1
x = face == 2 ? 104 : 0
if y >= $game_temp.choice_start
x += 8
@cursor_x = face == 2 ? 112 : 8
end
next
end
if icon != ''
icon_y = (32-24)/2
contents.blt(4+x, 32*y+4, RPG::Cache.icon(icon), Rect.new(0,0,24,24))
stxt[y] += 24
x += 24
icon = ''
end
next if c == ''
w = contents.text_size(c).width
if @outline_text and !@shadow_text
contents.draw_text_outline 4+x, 32*y, w*2, 32, c
elsif @shadow_text and !@outline_text
contents.draw_text_shadow 4+x, 32*y, w*2, 32, c
else
contents.draw_text 4+x, 32*y, w*2, 32, c
end
x += w
stxt[y] += w
@cursor_width[y] += w if y >= $game_temp.choice_start
end
indent = face ? 104 : 0
@back.height = y*32+32
@back.width = [stxt.max, (@cursor_width.max+16)].max + indent + 40
fix_position
if $game_temp.choice_max > 0
@item_max = $game_temp.choice_max
self.active, self.index = true, 0
end
if $game_temp.num_input_variable_id > 0
digits_max = $game_temp.num_input_digits_max
number = $game_variables[$game_temp.num_input_variable_id]
@input_number_window = Window_InputNumber.new digits_max
@back.height += 32
@back.width = [@back.width, (input_window.width+indent+16)].max
fix_position
input_window.number = number
input_window.y = self.y+$game_temp.num_input_start*32
input_window.x = face == 2 ? self.x+indent+8 : self.x+8
end
if face
fy = @back.height <= 128 ? 0 : (@back.height-128)/2
fx = face == 2 ? 0 : stxt.max+16
contents.blt fx, fy, image(face_name), Rect.new(0,0,96,96)
@back.height = 128 if @back.height <= 128
fix_position face
end
if over_event and $game_map.events != nil
ch = event <= 0 ? $game_player : $game_map.events[event]
fx = [[ch.screen_x-@back.width/2, 4].max, 636-@back.width].min
fy = [[ch.screen_y-(@back.height+48), 4].max, 476-@back.height].min
self.x = @back.x = fx
self.y = @back.y = fy
end
if picture != ''
px = self.x+@back.width
@picture = Sprite.new
@picture.bitmap = image picture
@picture.x = px-@picture.bitmap.width
@picture.y = self.y-@picture.bitmap.height
@picture.opacity = 0 if Fade
end
if name_box != ''
@name_box = Sprite_NameBox.new self.x, self.y-15, name_box
@name_box.opacity = 0 if Fade
@name_box.back.opacity = $game_system.message_frame == 0 ? 255 : 0
end
end
#--------------------------------------------------------------------------
# • Frame update
#--------------------------------------------------------------------------
def update
if @contents_showing
super
@back.update
end
if @fade_in
self.contents_opacity += 24
input_window.contents_opacity += 24 if exists? input_window
@name_box.opacity += 24 if exists? @name_box and Fade
@picture.opacity += 24 if exists? @picture and Fade
@fade_in = false if contents_opacity == 255
return
end
if input_window != nil
input_window.update
if Input.trigger? 13
$game_system.se_play $data_system.decision_se
$game_variables[$game_temp.num_input_variable_id] = input_window.number
$game_map.need_refresh = true
input_window.dispose
@input_number_window = nil
terminate_message
end
return
end
if @contents_showing
@back.pause = true if $game_temp.choice_max == 0
if Input.trigger? 12
if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
$game_system.se_play $data_system.cancel_se
$game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
terminate_message
end
end
if Input.trigger? 13
if $game_temp.choice_max > 0
$game_system.se_play $data_system.decision_se
$game_temp.choice_proc.call(self.index)
end
terminate_message
end
return
end
if $game_temp.message_text != nil
@contents_showing = true
$game_temp.message_window_showing = true
reset_window
refresh
Graphics.frame_reset
self.visible = true
self.contents_opacity = 0
if input_window != nil
input_window.contents_opacity = 0
end
@fade_in = true
return
end
return unless visible
self.opacity -= 48
if opacity == 0
self.visible = false
$game_temp.message_window_showing = false
end
end
#--------------------------------------------------------------------------
# • Returns the file 'name' from the choosen folder
#--------------------------------------------------------------------------
def image name
RPG::Cache.load_bitmap Path, name
end
#--------------------------------------------------------------------------
# • Gets the name and icon from the database
#--------------------------------------------------------------------------
def change_icon option, index
s = case option.downcase
when 'i' then $data_items[index]
when 'w' then $data_weapons[index]
when 'a' then $data_armors[index]
when 's' then $data_skills[index] end
sprintf("\013[%s]%s", s.icon_name, s.name) unless s.name.nil?
end
#--------------------------------------------------------------------------
# • Returns @input_number_window
#--------------------------------------------------------------------------
def input_window
@input_number_window
end
#--------------------------------------------------------------------------
# • Changes the way of display the text
#--------------------------------------------------------------------------
def disp_text w1=false, w2=false
@outline_text, @shadow_text = w1, w2
end
#--------------------------------------------------------------------------
# • Return true if the object exists
#--------------------------------------------------------------------------
def exists? object
not (object.nil? or object.disposed?)
end
#--------------------------------------------------------------------------
# • Updates the position of the windows
#--------------------------------------------------------------------------
def fix_position face=false
h2 = @back.height/2
self.y = $game_temp.in_battle ? 96 - h2 :
case $game_system.message_position
when 0 then 96 - h2
when 1 then 240-h2
when 2 then 384-h2 end
self.x = 320 - @back.width/2
@back.x, @back.y = self.x, self.y
end
#--------------------------------------------------------------------------
# • Reset the position of the windows
#--------------------------------------------------------------------------
def reset_window
fix_position
@back.opacity = $game_system.message_frame == 0 ? 255 : 0
@back.back_opacity = 160
end
#--------------------------------------------------------------------------
# • Updates the cursor rectangle
#--------------------------------------------------------------------------
def update_cursor_rect
if @index >= 0
n = $game_temp.choice_start + @index
width = Advance_Cursor ? @cursor_width[n] : @cursor_width.max
cursor_rect.set @cursor_x, n*32, width + 8, 32
else cursor_rect.empty end
end
end
#------------------------------------------------------------------------------
# End Window_Message Edit
#------------------------------------------------------------------------------
class Sprite_NameBox < Sprite
#--------------------------------------------------------------------------
# • Include Message_Settings constants
#------------------------------------------------------------------------
include Message_Settings
#--------------------------------------------------------------------------
# • Atributes
#------------------------------------------------------------------------
attr_reader :back
#--------------------------------------------------------------------------
# • Sprite initialization
#------------------------------------------------------------------------
def initialize x, y, text=' '
dumb = Bitmap.new 320, 42
size = dumb.text_size(text).width
dumb.dispose
@back = Window_Base.new x, y, size+12, 32
@back.z = 9995
unless NB_skin.nil?
@back.windowskin = RPG::Cache.windowskin NB_skin
end
viewport = Viewport.new x+6, y+5, size, 22
viewport.z = @back.z+10
super viewport
self.bitmap = Bitmap.new size, 22
case Default_Text
when 0 then bitmap.draw_text 0, 0, size, 22, text
when 1 then bitmap.draw_text_shadow 0, 0, size, 22, text
when 2 then bitmap.draw_text_outline 0, 0, size, 22, text end
end
#--------------------------------------------------------------------------
# • Dispose self and the back
#------------------------------------------------------------------------
def dispose
super
@back.dispose
end
end
#------------------------------------------------------------------------------
# Begin Game_Temp Edit
#------------------------------------------------------------------------------
class Game_Temp
#--------------------------------------------------------------------------
# • Store the current event
#--------------------------------------------------------------------------
attr_accessor :this_event
#--------------------------------------------------------------------------
end
#------------------------------------------------------------------------------
# End Game_Temp Edit
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Begin Interpreter Edit
#------------------------------------------------------------------------------
class Interpreter
#--------------------------------------------------------------------------
alias slipknot_skams_interpreter_command101 command_101
#--------------------------------------------------------------------------
# • Get the caller event id
#--------------------------------------------------------------------------
def command_101
$game_temp.this_event = @event_id
slipknot_skams_interpreter_command101
end
end
#------------------------------------------------------------------------------
# End Interpreter Edit
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Begin Game_Map Edit
#------------------------------------------------------------------------------
class Game_Map
#--------------------------------------------------------------------------
# • Return the name of the current map
#--------------------------------------------------------------------------
def name
$data_mapinfos[@map_id].name
end
end
#------------------------------------------------------------------------------
# End Game_Map Edit
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Begin Window_Base Edit
#------------------------------------------------------------------------------
class Window_Base < Window
#--------------------------------------------------------------------------
# • Convert 'string' to hexadecimal color
#--------------------------------------------------------------------------
def hex_color(string)
return normal_color if string.size != 6
r = g = b = 0
6.times do |i|
s = string.slice!(/./m)
v = hex_convert(s.downcase)
case i
when 1 then r += v * 16
when 2 then r += v
when 3 then g += v * 16
when 4 then g += v
when 5 then b += v * 16
when 6 then b += v end
end
Color.new(r, g, b)
end
#--------------------------------------------------------------------------
# • Covert 'c' into hex value
#--------------------------------------------------------------------------
def hex_convert(c)
return c.to_i if (/[0-9]/).match(c) != nil
case c
when 'a' then 10
when 'b' then 11
when 'c' then 12
when 'd' then 13
when 'e' then 14
when 'f' then 15 end
end
end
#------------------------------------------------------------------------------
# End Window_Base Edit
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Begin Window_InputNumber Edit
#------------------------------------------------------------------------------
class Window_InputNumber < Window_Base
#--------------------------------------------------------------------------
# • Fix the cursor width
#--------------------------------------------------------------------------
def initialize(digits_max)
@digits_max = digits_max
@number = 0
dummy = Bitmap.new 32, 32
@cursor_width = dummy.text_size('0').width+8
dummy.dispose
super 0, 0, @cursor_width*@digits_max+32, 64
self.contents = Bitmap.new width-32, 32
self.z += 9999
self.opacity = @index = 0
refresh
update_cursor_rect
end
end
#------------------------------------------------------------------------------
# End Window_InputNumber Edit
#------------------------------------------------------------------------------