Вы находитесь на странице: 1из 11

=begin

call script:
Scene_Actor_Titles.new(actor_index)
-add titles to actors
add_title(actor_id, title_id)
example
add_title(4, 2)
adds title 2 to actor 4
-check if title in list and assigns it to a switch
check_titles(actor_id, title_id, switch)
example
check_titles(4, 2, 5)
checks if actor 4 has title 2 and puts answer in switch 5
can be used without switch_id
-check actor title size and assigns it to a variable
actor_title_list_size(actor_id, variable_id)
example
actor_title_list_size(4, 10)
checks title list size for actor 4 and puts answer in variable 10
=end
module BM
module TITLES
Call_title = "Titles"
#Name of the title
TITLE_NAMES = {
0 => "Normal",
# format: title_id => "Title name"
1 => "Nobleman",
2 => "Privateer",
3 => "Crusader",
4 => "Clumsy Fool",
5 => "Juggler",
6 => "Bashful",
7 => "Tipsy",
14 => "Wolf",
# Add more titles as you like
}# don't remove
# Add more titles as you like
#Description of the title
# will be blink if not listed
TITLE_DESC = {# do not remove
1 => "Those of noble birth",
2 => "A real scoundrel at heart",
3 => "Willing to take on any brave endevour",
4 => "Keep out of the way!",
}# do not remove
COSTUMES ={
#title_id => ["Character Name", Character Index],
14 => ["Animal",6],
}#do not remove

CHANGE_STATS = true
#titles can add or subtract from the base stats
# will be 0 if not listed
BASE_STAT_CHANGE = {# do not remove
#title_id
Hp Mp Atk Def Int Agi
1 => [ 0, 0, 0, 0, 0, 0],
2 => [ 0, 0, 0, 0, 0, 10],
3 => [10, 0, 0, 0, 0, 0],
4 => [ 0, 0, 0, 0, 0, -10],
5 => [ 0, 0, 0, 0, 0, 10],
6 => [ 0, 0, 0, 5, 2, 0],
7 => [ 0, 0, 10, -5, -5, -5],
}# do not remove
CHANGE_LEVELUP = true
#titles can add or subtract from stats during level up
# will be 0 if not listed
LEVELUP_BONUS = { # do not remove
#title_id
Hp Mp Atk Def Int Agi
1 => [40, 0, 0, 5, 0, 0],
2 => [ 0, 0, 0, 0, 0, 5],
3 => [50, 0, 0, 0, 0, 0],
4 => [10, 0, 0, 0, 0, 0],
5 => [ 0, 0, 0, 0, 0, 2],
6 => [ 0, 0, 0, 2, 0, 0],
}# do not remove
# Title that actor starts with
# format actor_id => title_id
STARTING_TITLE = {# do not remove
0 => 1, #default if actor not assigned
1 => 1,
2 => 2,
3 => 1,
4 => 3,
# Add more actors as you like
}# do not remove
# show title in status window
OPTIONS={
:show_in_status => true,
:show_after_name => false,
#location of actor's title
:titles_x => 0,
:titles_y => 350,
# show stat change number (ie HP +10, MP -2)
:show_stat_change => false,
# key to press to change titles
:titles_key => Input::X,
}# do not remove
WINDOW_OPTIONS = {
# horizontal location of pick titles window
:win_x => 80,
# vertical location of pick titles window
# :win_pos => 0 bottom

# :win_pos => 1 top


:win_pos => 1,
# width of pick titles window
:win_width => 160,
# width of pick titles stats window
:win_stat_width => 100,
}# do not remove
end
end
#===============================================================================
# No touching unless you know what you're doing!!
#===============================================================================
$imported = {} if $imported == nil
$imported["titles"] = true
if $imported["SceneStatusReDux"]
module YE::REDUX::STATUS
IMPORTED_COMMANDS[400] = [false,
0, BM::TITLES::Call_title, "Scene_Actor_Ti
tles"]
end
end
#===============================================================================
class Game_Interpreter
include BM::TITLES
end
module BM::TITLES
module_function
#-------------------------------------------------------------------------def add_title(actor_id, title_id)
$game_actors[actor_id].title_list(title_id)
end
#-------------------------------------------------------------------------def check_titles(actor_id, title_id, switch_id = nil)
in_list = $game_actors[actor_id].title_list.include?(title_id)
$game_switches[switch_id] = in_list if switch_id > 0
return in_list
end
#-------------------------------------------------------------------------def actor_title_list_size(actor, variable_id = 0)
title_list = $game_actors[actor].title_list
$game_variables[variable_id] = title_list.size if variable_id > 0
return title_list
end
end
#===============================================================================
# Game_actor
#===============================================================================
class Game_Actor < Game_Battler
attr_accessor :title_name
attr_accessor :title_id
#----------------------------------------------------------------------------alias titles_setup setup unless $@
#----------------------------------------------------------------------------def setup(actor_id)
titles_setup(actor_id)
@title_names = Array.new
@title_list = Array.new

if BM::TITLES::STARTING_TITLE.include?(actor_id)
@title_id = BM::TITLES::STARTING_TITLE[@actor_id]
else
@title_id = BM::TITLES::STARTING_TITLE[0]
end
end
#----------------------------------------------------------------------------def title_name
return BM::TITLES::TITLE_NAMES[@title_id]
end
#----------------------------------------------------------------------------def title_id=(new_id)
@title_id = new_id
if BM::TITLES::COSTUMES.include?(new_id)
pic_name = BM::TITLES::COSTUMES[new_id][0]
index = BM::TITLES::COSTUMES[new_id][1]
$game_actors[@actor_id].set_graphic(pic_name, index, @face_name, @face_ind
ex)
$game_player.refresh
end
return @title_id
end
#----------------------------------------------------------------------------def title_list(id = nil)
result = @title_list
result << @title_id #adds current title equipped
if id != nil #adds new title
result << id
end
result.uniq! # remove all duplicates
return result
end
#----------------------------------------------------------------------------def base_stat_title_change(type, title = @title_id)
if BM::TITLES::CHANGE_STATS and BM::TITLES::BASE_STAT_CHANGE.include?(title)
amount = BM::TITLES::BASE_STAT_CHANGE[title][type]
else
amount = 0
end
return Integer(amount)
end
#============================================================================#
# * Change Parameters based on Title
#
#============================================================================#
alias title_base_maxhp base_maxhp unless $@
#-------------------------------------------------------------------------def base_maxhp
n = title_base_maxhp
n += base_stat_title_change(0)
return Integer(n)
end
#-------------------------------------------------------------------------# * Get basic Maximum MP
#-------------------------------------------------------------------------alias title_base_maxmp base_maxmp unless $@
def base_maxmp
n = title_base_maxmp
n += base_stat_title_change(1)
return Integer(n)
end

#-------------------------------------------------------------------------alias title_base_atk base_atk unless $@


#-------------------------------------------------------------------------def base_atk
n = title_base_atk
n += base_stat_title_change(2)
return Integer(n)
end
#-------------------------------------------------------------------------alias title_base_def base_def unless $@
#-------------------------------------------------------------------------def base_def
n = title_base_def
n += base_stat_title_change(3)
return Integer(n)
end
#-------------------------------------------------------------------------alias title_base_spi base_spi unless $@
#-------------------------------------------------------------------------def base_spi
n = title_base_spi
n += base_stat_title_change(4)
return Integer(n)
end
#-------------------------------------------------------------------------alias title_base_agi base_agi unless $@
#-------------------------------------------------------------------------def base_agi
n = title_base_agi
n += base_stat_title_change(5)
return Integer(n)
end
#--------------------------------------------------------------------------alias title_levelup level_up unless $@
#--------------------------------------------------------------------------def level_up
title_levelup
id = @title_id
if BM::TITLES::CHANGE_LEVELUP && BM::TITLES::LEVELUP_BONUS.include?(id)
self.maxhp += BM::TITLES::LEVELUP_BONUS[id][0]
self.maxmp += BM::TITLES::LEVELUP_BONUS[id][1]
self.atk += BM::TITLES::LEVELUP_BONUS[id][2]
self.def += BM::TITLES::LEVELUP_BONUS[id][3]
self.spi += BM::TITLES::LEVELUP_BONUS[id][4]
self.agi += BM::TITLES::LEVELUP_BONUS[id][5]
end
end
end
#------------------------------------------------------------------------------# Window_Status
#------------------------------------------------------------------------------class Window_Status < Window_Base
if BM::TITLES::OPTIONS[:show_in_status]
if BM::TITLES::OPTIONS[:show_after_name] == false or $imported["SceneStatusR
eDux"]
#---------------------------------------------------------------------------alias titles_refresh refresh unless $@
#----------------------------------------------------------------------------

def refresh
titles_refresh
x = BM::TITLES::OPTIONS[:titles_x]
y = BM::TITLES::OPTIONS[:titles_y]
self.contents.font.color = normal_color
draw_actor_title(@actor, x, y)
end
#---------------------------------------------------------------------------def draw_actor_title(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 80, WLH, "Title: ", 2)
self.contents.font.color = normal_color
self.contents.draw_text(x + 80, y, 108, WLH, actor.title_name)
end
#---------------------------------------------------------------------------elsif BM::TITLES::OPTIONS[:show_after_name]
def draw_actor_name(actor, x, y)
self.contents.font.color = hp_color(actor)
self.contents.draw_text(x, y, 220, WLH, "#{actor.name} the #{actor.title
_name}")
end
#---------------------------------------------------------------------------alias titlesdraw_actor_class draw_actor_class unless $@
#---------------------------------------------------------------------------def draw_actor_class(actor, x, y)
titlesdraw_actor_class(actor, x + 160, y)
end
end
end
end
#==============================================================================
# Window_Titles_Stats
#==============================================================================
class Window_Titles_Stats < Window_Base
def initialize(actor_index)
height = 32 + WLH * 6
super(0, 0, BM::TITLES::WINDOW_OPTIONS[:win_stat_width], height)
self.z = 1000
@actor = $game_party.members[actor_index]
refresh(@actor)
end
#-------------------------------------------------------------------------def refresh(actor, clone = nil)
self.contents.clear
@actor = actor
@clone = clone
stats_compare(@actor, @clone)
end
#-------------------------------------------------------------------------def stats_compare(actor, clone = nil)
return if clone == nil
x = 0; y = 0
w = self.contents.width
for i in 0..5
case i
when 0

vocab = Vocab.hp
when 1
vocab = Vocab.mp
when 2
vocab = Vocab.atk
when 3
vocab = Vocab.def
when 4
vocab = Vocab.spi
when 5
vocab = Vocab.agi
end
if clone == nil
self.contents.draw_text(x, y, w, WLH, vocab)
else
value1 = clone[i]
value2 = actor.base_stat_title_change(i)
difference = value1 - value2
text = "+#{difference}" if difference > 0
text = "---" if difference == 0
self.contents.font.color = normal_color if BM::TITLES::OPTIONS[:show_sta
t_change]
parameter_color(value1, value2) unless BM::TITLES::OPTIONS[:show_stat_ch
ange]
self.contents.draw_text(x, y, w, WLH, vocab)
parameter_color(value1, value2)
self.contents.draw_text(x, y, w, WLH, text, 2) if BM::TITLES::OPTIONS[:s
how_stat_change]
end
y += WLH
end
end
#-------------------------------------------------------------------------def parameter_color(value1, value2)
if value1 > value2
self.contents.font.color = power_up_color
elsif value1 < value2
self.contents.font.color = power_down_color
else
self.contents.font.color = normal_color
end
end
end
#==============================================================================
# Scene_Status
#==============================================================================
class Scene_Status < Scene_Base
#-------------------------------------------------------------------------alias titles_initialize initialize unless $@
#-------------------------------------------------------------------------def initialize(*args)
titles_initialize(*args)
@actor = $game_party.members[@actor_index]
@titles_list_window = Window_Titles_List.new(@actor_index)
@titles_list_window.x = BM::TITLES::WINDOW_OPTIONS[:win_x]
@titles_stat_window = Window_Titles_Stats.new(@actor_index)
@titles_list_window.y = Graphics.height - @titles_list_window.height if BM::
TITLES::WINDOW_OPTIONS[:win_pos] == 0
@titles_stat_window.y = @titles_list_window.y
@titles_stat_window.x = @titles_list_window.x + @titles_list_window.width

hide_titles
end
#-------------------------------------------------------------------------alias titles_terminate terminate unless $@
#-------------------------------------------------------------------------def terminate
titles_terminate
@titles_list_window.dispose
@titles_stat_window.dispose
end
#-------------------------------------------------------------------------def clone_actor
temp_actor = @actor.clone
temp_actor.title_id = (@actor.title_list[@titles_list_window.index])
chp = temp_actor.base_stat_title_change(0)
cmp = temp_actor.base_stat_title_change(1)
catk = temp_actor.base_stat_title_change(2)
cdef = temp_actor.base_stat_title_change(3)
cspi = temp_actor.base_stat_title_change(4)
cagi = temp_actor.base_stat_title_change(5)
@array = [chp,cmp,catk,cdef,cspi,cagi]
end
#-------------------------------------------------------------------------alias titles_update update unless $@
#-------------------------------------------------------------------------def update
super
clone_actor
@titles_list_window.update
@titles_stat_window.refresh(@actor, @array)
if @titles_list_window.active
if Input.trigger?(BM::TITLES::OPTIONS[:titles_key])
hide_titles
elsif Input.trigger?(Input::C)
if @actor.title_id == (@actor.title_list[@titles_list_window.index])
Sound.play_buzzer
return
else
Sound.play_decision
@actor.title_id=(@actor.title_list[@titles_list_window.index])
@status_window.refresh
@titles_list_window.refresh
@titles_stat_window.refresh(@actor, @array)
return
end
elsif Input.trigger?(Input::B)
hide_titles
end
elsif Input.trigger?(BM::TITLES::OPTIONS[:titles_key])
show_titles
else
titles_update
end
end
#-------------------------------------------------------------------------def hide_titles
if $imported["SceneStatusReDux"] && @command_window != nil
@command_window.active = true
end
@titles_list_window.active = false

@titles_list_window.visible = false
@titles_stat_window.visible = false
end
#-------------------------------------------------------------------------def show_titles
if $imported["SceneStatusReDux"]
@command_window.active = false
end
@titles_list_window.active = true
@titles_list_window.visible = true
@titles_stat_window.visible = true
@titles_stat_window.back_opacity = 255
@titles_list_window.back_opacity = 255
end
end
#============================================================================
class Window_Titles_List < Window_Command
def initialize(actor_index)
@actor = $game_party.members[actor_index]
@commands = @actor.title_list
super(BM::TITLES::WINDOW_OPTIONS[:win_width], @commands)
self.z = 1000
end
#-------------------------------------------------------------------------# * Whether or not to display in enabled state
#
item : item
#-------------------------------------------------------------------------def selected?(title)
return true if @actor.title_name != title
return false
end
#-------------------------------------------------------------------------# * Draw Item
#
index : item number
#
enabled : enabled flag. When false, draw semi-transparently.
#-------------------------------------------------------------------------def draw_item(index)
title = BM::TITLES::TITLE_NAMES[@commands[index]]
return if title == nil
selected = selected?(title)
rect = item_rect(index)
rect.x += 4
rect.width -= 8
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
self.contents.font.color.alpha = selected ? 255 : 128
self.contents.draw_text(rect, title)
end
#-------------------------------------------------------------------------# * Update Help Text
#-------------------------------------------------------------------------def update_help
index = @actor.title_list[@index]
text = BM::TITLES::TITLE_DESC[index]
@help_window.set_text(text == nil ? "" : text)
end
end
#==============================================================================
class Scene_Actor_Titles < Scene_Base
def initialize(actor_index)

@actor_index = actor_index
end
#-------------------------------------------------------------------------def start
super
create_menu_background
@actor = $game_party.members[@actor_index]
@top_window = Window_Base.new(0,0,Graphics.width, 56)
@top_window.contents.draw_text(0,0,Graphics.width-32,24,BM::TITLES::Call_tit
le,1)
@help_window = Window_Help.new
@help_window.y = Graphics.height-56
@titles_list_window = Window_Titles_List.new(@actor_index)
@titles_list_window.active = true
@titles_list_window.z = 120
@titles_list_window.x = 0
@titles_list_window.y = 56
@titles_list_window.height = Graphics.height-56*2
@titles_list_window.help_window = @help_window
@titles_stat_window = Window_Titles_Stats.new(@actor_index)
@titles_stat_window.z = 120
@titles_stat_window.width = Graphics.width - @titles_list_window.width
@titles_stat_window.x = @titles_list_window.width
@titles_stat_window.y = @titles_list_window.y
@titles_stat_window.height = @titles_list_window.height
end
#-------------------------------------------------------------------------def terminate
super
dispose_menu_background
@top_window.dispose
@titles_list_window.dispose
@titles_stat_window.dispose
@help_window.dispose
end
#-------------------------------------------------------------------------def clone_actor
temp_actor = @actor.clone
temp_actor.title_id=(@actor.title_list[@titles_list_window.index])
chp = temp_actor.base_stat_title_change(0)
cmp = temp_actor.base_stat_title_change(1)
catk = temp_actor.base_stat_title_change(2)
cdef = temp_actor.base_stat_title_change(3)
cspi = temp_actor.base_stat_title_change(4)
cagi = temp_actor.base_stat_title_change(5)
@array = [chp,cmp,catk,cdef,cspi,cagi]
end
#-------------------------------------------------------------------------def update
super
clone_actor
@titles_list_window.update
@titles_stat_window.refresh(@actor, @array)
if Input.trigger?(BM::TITLES::OPTIONS[:titles_key]) or Input.trigger?(Input:
:B)
return_scene
elsif Input.trigger?(Input::C)

if @actor.title_id == (@actor.title_list[@titles_list_window.index])
Sound.play_buzzer
return
else
Sound.play_decision
@actor.title_id=(@actor.title_list[@titles_list_window.index])
@titles_list_window.refresh
@titles_stat_window.refresh(@actor, @array)
return
end
elsif Input.trigger?(Input::R) or Input.trigger?(Input::RIGHT)
next_actor
elsif Input.trigger?(Input::L) or Input.trigger?(Input::LEFT)
prev_actor
end
end
#-------------------------------------------------------------------------# * Switch to Next Actor Screen
#-------------------------------------------------------------------------def next_actor
@actor_index += 1
@actor_index %= $game_party.members.size
$scene = Scene_Actor_Titles.new(@actor_index)
end
#-------------------------------------------------------------------------# * Switch to Previous Actor Screen
#-------------------------------------------------------------------------def prev_actor
@actor_index += $game_party.members.size - 1
@actor_index %= $game_party.members.size
$scene = Scene_Actor_Titles.new(@actor_index)
end
#-------------------------------------------------------------------------def return_scene
if $imported["SceneStatusReDux"] and $game_temp.status_menu_flag
$scene = Scene_Status.new(@actor_index, $game_temp.status_menu_index)
elsif
$scene = Scene_Map.new
end
end
end

Вам также может понравиться