Script Subir Nivel al Estilo Final Fantasy
Pasos para subir nivel al estilo Final Fantasy
1.Lee con mucha atención los textos en rojo de este documento, el resto es solo copiar y pegar
2. Entra a la ventana de Scripts
3. Ve a la ventana Game_Actor y sustituye todo lo que hay por esto:
#================================================= =============================
# ■ Game_Actor
#------------------------------------------------------------------------------
# Esta clase trata los personajes.
#================================================= =============================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# - Creamos las variables...
#--------------------------------------------------------------------------
attr_reader :name # Nombre
attr_reader :character_name # Nombre del personaje
attr_reader :character_hue # Color del personaje
attr_reader :class_id # ID de profesion
attr_reader :weapon_id # ID de arma
attr_reader :armor1_id # ID de escudo
attr_reader :armor2_id # ID de casco
attr_reader :armor3_id # ID de armadura
attr_reader :armor4_id # ID de accesiorios
attr_reader :level # Nivel
attr_reader :exp # Experiencia (EXP)
attr_reader :skills # Habilidades
#--------------------------------------------------------------------------
# - Inicio de Objetos...
# actor_id : ID del Personaje
#--------------------------------------------------------------------------
def initialize(actor_id)
super()
setup(actor_id)
end
#--------------------------------------------------------------------------
# - Opciones
# actor_id : ID del Personaje
#--------------------------------------------------------------------------
def setup(actor_id)
actor = $data_actors[actor_id]
@actor_id = actor_id
@name = actor.name
@character_name = actor.character_name
@character_hue = actor.character_hue
@battler_name = actor.battler_name
@battler_hue = actor.battler_hue
@class_id = actor.class_id
@weapon_id = actor.weapon_id
@armor1_id = actor.armor1_id
@armor2_id = actor.armor2_id
@armor3_id = actor.armor3_id
@armor4_id = actor.armor4_id
@level = actor.initial_level
@exp_list = Array.new(101)
make_exp_list
@exp = @exp_list[@level]
@skills = []
@hp = maxhp
@sp = maxsp
@states = []
@states_turn = {}
@maxhp_plus = 0
@maxsp_plus = 0
@str_plus = 0
@dex_plus = 0
@agi_plus = 0
@int_plus = 0
# Uso de habilidades
for i in 1..@level
for j in $data_classes[@class_id].learnings
if j.level == i
learn_skill(j.skill_id)
end
end
end
# Actualizar estado auto.
update_auto_state(nil, $data_armors[@armor1_id])
update_auto_state(nil, $data_armors[@armor2_id])
update_auto_state(nil, $data_armors[@armor3_id])
update_auto_state(nil, $data_armors[@armor4_id])
end
#--------------------------------------------------------------------------
# - Uso de ID de Personaje
#--------------------------------------------------------------------------
def id
return @actor_id
end
#--------------------------------------------------------------------------
# - Uso de Indice
#--------------------------------------------------------------------------
def index
return $game_party.actors.index(self)
end
#--------------------------------------------------------------------------
# - Calculo de EXP
#--------------------------------------------------------------------------
def make_exp_list
actor = $data_actors[@actor_id]
@exp_list[1] = 0
pow_i = 2.4 + actor.exp_inflation / 100.0
for i in 2..100
if i > actor.final_level
@exp_list[i] = 0
else
n = actor.exp_basis * ((i + 3) ** pow_i) / (5 ** pow_i)
@exp_list[i] = @exp_list[i-1] + Integer(n)
end
end
end
#--------------------------------------------------------------------------
# - Uso del valor compensado del atributo
# element_id : ID de elemento
#--------------------------------------------------------------------------
def element_rate(element_id)
# Uso del valor numerico que correspondiente al grado de atributo
table = [0,200,150,100,50,0,-100]
result = table[$data_classes[@class_id].element_ranks[element_id]]
# Partir en 2 cuando se defiende con el protector
for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
armor = $data_armors[i]
if armor != nil and armor.guard_element_set.include?(element_id)
result /= 2
end
end
# Partir en 2 cuando se defiende con el estado
for i in @states
if $data_states[i].guard_element_set.include?(element_id)
result /= 2
end
end
# Fin del Metodo
return result
end
#--------------------------------------------------------------------------
# - Uso del grado de estado
#--------------------------------------------------------------------------
def state_ranks
return $data_classes[@class_id].state_ranks
end
#--------------------------------------------------------------------------
# - Juicio de estado de defensa
# state_id : ID de estado
#--------------------------------------------------------------------------
def state_guard?(state_id)
for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
armor = $data_armors[i]
if armor != nil
if armor.guard_state_set.include?(state_id)
return true
end
end
end
return false
end
#--------------------------------------------------------------------------
# - Uso del atributo de un ataque normal
#--------------------------------------------------------------------------
def element_set
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.element_set : []
end
#--------------------------------------------------------------------------
# - Uso del cambio de estado de un ataque normal (+)
#--------------------------------------------------------------------------
def plus_state_set
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.plus_state_set : []
end
#--------------------------------------------------------------------------
# - Uso del cambio de estado de un ataque normal (-)
#--------------------------------------------------------------------------
def minus_state_set
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.minus_state_set : []
end
#--------------------------------------------------------------------------
# - Uso de MaxPV
#--------------------------------------------------------------------------
def maxhp
n = [[base_maxhp + @maxhp_plus, 1].max, 9999].min
for i in @states
n *= $data_states[i].maxhp_rate / 100.0
end
n = [[Integer(n), 1].max, 9999].min
return n
end
#--------------------------------------------------------------------------
# - Uso basico de MaxPV
#--------------------------------------------------------------------------
def base_maxhp
return $data_actors[@actor_id].parameters[0, @level]
end
#--------------------------------------------------------------------------
# - Uso basico de MaxPM
#--------------------------------------------------------------------------
def base_maxsp
return $data_actors[@actor_id].parameters[1, @level]
end
#--------------------------------------------------------------------------
# - Uso basico de Fuerza Fisica
#--------------------------------------------------------------------------
def base_str
n = $data_actors[@actor_id].parameters[2, @level]
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
n += weapon != nil ? weapon.str_plus : 0
n += armor1 != nil ? armor1.str_plus : 0
n += armor2 != nil ? armor2.str_plus : 0
n += armor3 != nil ? armor3.str_plus : 0
n += armor4 != nil ? armor4.str_plus : 0
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# - Uso basico de Destreza
#--------------------------------------------------------------------------
def base_dex
n = $data_actors[@actor_id].parameters[3, @level]
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
n += weapon != nil ? weapon.dex_plus : 0
n += armor1 != nil ? armor1.dex_plus : 0
n += armor2 != nil ? armor2.dex_plus : 0
n += armor3 != nil ? armor3.dex_plus : 0
n += armor4 != nil ? armor4.dex_plus : 0
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# - Uso basico de Agilidad
#--------------------------------------------------------------------------
def base_agi
n = $data_actors[@actor_id].parameters[4, @level]
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
n += weapon != nil ? weapon.agi_plus : 0
n += armor1 != nil ? armor1.agi_plus : 0
n += armor2 != nil ? armor2.agi_plus : 0
n += armor3 != nil ? armor3.agi_plus : 0
n += armor4 != nil ? armor4.agi_plus : 0
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# - Uso basico de magia
#--------------------------------------------------------------------------
def base_int
n = $data_actors[@actor_id].parameters[5, @level]
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
n += weapon != nil ? weapon.int_plus : 0
n += armor1 != nil ? armor1.int_plus : 0
n += armor2 != nil ? armor2.int_plus : 0
n += armor3 != nil ? armor3.int_plus : 0
n += armor4 != nil ? armor4.int_plus : 0
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# - Uso basico de Ataque
#--------------------------------------------------------------------------
def base_atk
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.atk : 0
end
#--------------------------------------------------------------------------
# - Uso basico de defensa
#--------------------------------------------------------------------------
def base_pdef
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
pdef1 = weapon != nil ? weapon.pdef : 0
pdef2 = armor1 != nil ? armor1.pdef : 0
pdef3 = armor2 != nil ? armor2.pdef : 0
pdef4 = armor3 != nil ? armor3.pdef : 0
pdef5 = armor4 != nil ? armor4.pdef : 0
return pdef1 + pdef2 + pdef3 + pdef4 + pdef5
end
#--------------------------------------------------------------------------
# - Uso basico de defensa magica
#--------------------------------------------------------------------------
def base_mdef
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
mdef1 = weapon != nil ? weapon.mdef : 0
mdef2 = armor1 != nil ? armor1.mdef : 0
mdef3 = armor2 != nil ? armor2.mdef : 0
mdef4 = armor3 != nil ? armor3.mdef : 0
mdef5 = armor4 != nil ? armor4.mdef : 0
return mdef1 + mdef2 + mdef3 + mdef4 + mdef5
end
#--------------------------------------------------------------------------
# - Uso basico de Correccion de evasion
#--------------------------------------------------------------------------
def base_eva
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
eva1 = armor1 != nil ? armor1.eva : 0
eva2 = armor2 != nil ? armor2.eva : 0
eva3 = armor3 != nil ? armor3.eva : 0
eva4 = armor4 != nil ? armor4.eva : 0
return eva1 + eva2 + eva3 + eva4
end
#--------------------------------------------------------------------------
# - Ataque normal. Uso de la ID de la animacion de ataque lateral.
#--------------------------------------------------------------------------
def animation1_id
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.animation1_id : 0
end
#--------------------------------------------------------------------------
# - Ataque normal. Uso de la ID de la animacion de objeto lateral.
#--------------------------------------------------------------------------
def animation2_id
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.animation2_id : 0
end
#--------------------------------------------------------------------------
# - Uso del nombre de la Profesion
#--------------------------------------------------------------------------
def class_name
return $data_classes[@class_id].name
end
#--------------------------------------------------------------------------
# - Uso de secuencia de caracteres de EXP
#--------------------------------------------------------------------------
def exp_s
return @exp_list[@level+1] > 0 ? @exp.to_s : "-------"
end
#--------------------------------------------------------------------------
# - Siguiente nivel. Uso de secuencia de caracteres de EXP
#--------------------------------------------------------------------------
def next_exp_s
return @exp_list[@level+1] > 0 ? @exp_list[@level+1].to_s : "-------"
end
#--------------------------------------------------------------------------
# - Subir al siguiente nivel. Uso de secuencia de caracteres de EXP
#--------------------------------------------------------------------------
def next_rest_exp_s
return @exp_list[@level+1] > 0 ?
(@exp_list[@level+1] - @exp).to_s : "-------"
end
#--------------------------------------------------------------------------
# - Renovacion de Estado auto.
# old_armor : Protector removido
# new_armor : Protector equipado
#--------------------------------------------------------------------------
def update_auto_state(old_armor, new_armor)
# Estado autom. del protector removido es cancelado
if old_armor != nil and old_armor.auto_state_id != 0
remove_state(old_armor.auto_state_id, true)
end
# Estado autom. del protector equipado es cancelado
if new_armor != nil and new_armor.auto_state_id != 0
add_state(new_armor.auto_state_id, true)
end
end
#--------------------------------------------------------------------------
# - Juicio de equipo fijo
# equip_type : Tipo de equipo
#--------------------------------------------------------------------------
def equip_fix?(equip_type)
case equip_type
when 0 # Brazos
return $data_actors[@actor_id].weapon_fix
when 1 # Escudo
return $data_actors[@actor_id].armor1_fix
when 2 # Casco
return $data_actors[@actor_id].armor2_fix
when 3 # Armadura
return $data_actors[@actor_id].armor3_fix
when 4 # Accesorios
return $data_actors[@actor_id].armor4_fix
end
return false
end
#--------------------------------------------------------------------------
# - Cambio de equipamiento
# equip_type : Tipo de equipo
# id : ID de Brazos o protectores (Si es 0 lanzar equipamiento)
#--------------------------------------------------------------------------
def equip(equip_type, id)
case equip_type
when 0 # Brazos
if id == 0 or $game_party.weapon_number(id) > 0
$game_party.gain_weapon(@weapon_id, 1)
@weapon_id = id
$game_party.lose_weapon(id, 1)
end
when 1 # Escudo
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor1_id], $data_armors[id])
$game_party.gain_armor(@armor1_id, 1)
@armor1_id = id
$game_party.lose_armor(id, 1)
end
when 2 # Casco
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor2_id], $data_armors[id])
$game_party.gain_armor(@armor2_id, 1)
@armor2_id = id
$game_party.lose_armor(id, 1)
end
when 3 # Armadura
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor3_id], $data_armors[id])
$game_party.gain_armor(@armor3_id, 1)
@armor3_id = id
$game_party.lose_armor(id, 1)
end
when 4 # Accesorios
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor4_id], $data_armors[id])
$game_party.gain_armor(@armor4_id, 1)
@armor4_id = id
$game_party.lose_armor(id, 1)
end
end
end
#--------------------------------------------------------------------------
# - Juicio de equipamiento
# item : Objeto
#--------------------------------------------------------------------------
def equippable?(item)
# Si Brazos
if item.is_a?(RPG::Weapon)
# Cuando los brazos estan utilizados puedes equipar la clase presente
if $data_classes[@class_id].weapon_set.include?(item.id)
return true
end
end
# Si Protector
if item.is_a?(RPG::Armor)
# Cuando los protectores estan utilizados puedes equipar la clase presente
if $data_classes[@class_id].armor_set.include?(item.id)
return true
end
end
return false
end
#--------------------------------------------------------------------------
# - Cambio de EXP
# exp : Nueva EXP
#--------------------------------------------------------------------------
def exp=(exp)
@exp = [[exp, 9999999].min, 0].max
# Mejoracion
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
@level += 1
# Uso de habilidades
for j in $data_classes[@class_id].learnings
if j.level == @level
learn_skill(j.skill_id)
end
end
end
# Agravante
while @exp < @exp_list[@level]
@level -= 1
end
# El PV corriente se corregira, si el PM sobrepasa el maximo
@hp = [@hp, self.maxhp].min
@sp = [@sp, self.maxsp].min
end
#--------------------------------------------------------------------------
# - Cambio de nivel
# level : Nuevo nivel
#--------------------------------------------------------------------------
def level=(level)
# Subir chequeo minimo
level = [[level, $data_actors[@actor_id].final_level].min, 1].max
# Cambiar EXP
self.exp = @exp_list[level]
end
#--------------------------------------------------------------------------
# - Memorizar Habilidad
# skill_id : ID de la Habilidad
#--------------------------------------------------------------------------
def learn_skill(skill_id)
if skill_id > 0 and not skill_learn?(skill_id)
@skills.push(skill_id)
@skills.sort!
end
end
#--------------------------------------------------------------------------
# - Olvidar Habilidad
# skill_id : ID de la Habilidad
#--------------------------------------------------------------------------
def forget_skill(skill_id)
@skills.delete(skill_id)
end
#--------------------------------------------------------------------------
# - Juicio dominado de habilidad
# skill_id : ID de la Habilidad
#--------------------------------------------------------------------------
def skill_learn?(skill_id)
return @skills.include?(skill_id)
end
#--------------------------------------------------------------------------
# - Juicio de la habilidad que puede usarse
# skill_id : ID de la Habilidad
#--------------------------------------------------------------------------
def skill_can_use?(skill_id)
if not skill_learn?(skill_id)
return false
end
return super
end
#--------------------------------------------------------------------------
# - Cambio de nombre
# name : Nuevo nombre
#--------------------------------------------------------------------------
def name=(name)
@name = name
end
#--------------------------------------------------------------------------
# - Cambio de ID de profesion
# class_id : ID de profesion
#--------------------------------------------------------------------------
def class_id=(class_id)
if $data_classes[class_id] != nil
@class_id = class_id
# Objeto imposible de equipar es removido
unless equippable?($data_weapons[@weapon_id])
equip(0, 0)
end
unless equippable?($data_armors[@armor1_id])
equip(1, 0)
end
unless equippable?($data_armors[@armor2_id])
equip(2, 0)
end
unless equippable?($data_armors[@armor3_id])
equip(3, 0)
end
unless equippable?($data_armors[@armor4_id])
equip(4, 0)
end
end
end
#--------------------------------------------------------------------------
# - Cambio de graficos
# character_name : Nombre de archivo del nuevo Personaje
# character_hue : Color de nuevo Personaje
# battler_name : Nombre de archivo del nuevo Personaje de Batalla
# battler_hue : Color de nuevo Personaje de Batalla
#--------------------------------------------------------------------------
def set_graphic(character_name, character_hue, battler_name, battler_hue)
@character_name = character_name
@character_hue = character_hue
@battler_name = battler_name
@battler_hue = battler_hue
end
#--------------------------------------------------------------------------
# - Pantalla de batalla. Uso de la coodenada X
#--------------------------------------------------------------------------
def screen_x
# Desde el orden de una fila en el grupo, las coor X se calculan y devuelven
if self.index != nil
return self.index * 160 + 80
else
return 0
end
end
#--------------------------------------------------------------------------
# - Pantalla de batalla. Uso de la coodenada Y
#--------------------------------------------------------------------------
def screen_y
return 464
end
#--------------------------------------------------------------------------
# - Pantalla de batalla. Uso de la coodenada Z
#--------------------------------------------------------------------------
def screen_z
# Desde el orden de una fila en el grupo, las coor Z se calculan y devuelven
if self.index != nil
return 4 - self.index
else
return 0
end
end
end
4. Debajo de la ventana Window_DebugRight , crea uno nuevo llamado Window_Level_Up y
pon esto:
#=================================
#Window_LevelUp
# Written by: David Schooley
#=================================
class Window_LevelUp < Window_Base
#----------------------------------------------------------------
def initialize(actor, pos)
@actor = actor
y = (pos * 120)
super(280, y, 360, 120)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.back_opacity = 255
if $d_dum == false
refresh
end
end
#----------------------------------------------------------------
def dispose
super
end
#----------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_graphic(@actor, 260, 75)
draw_actor_name(@actor, 0, 0)
draw_actor_level(@actor, 75, 0)
self.contents.font.color = system_color
self.contents.draw_text(0, 30, 80, 32, "EXP actual")
self.contents.draw_text(0, 60, 80, 32, "Siguiente Nivel")
self.contents.font.color = normal_color
self.contents.draw_text(84, 30, 84, 32, @actor.exp_s, 2)
self.contents.draw_text(84, 60, 84, 32, @actor.next_rest_exp_s, 2)
end
#----------------------------------------------------------------
def level_up
self.contents.font.color = system_color
self.contents.draw_text(230, 55, 80, 32, "Nivel arriba!")
end
#----------------------------------------------------------------
def learn_skill(skill)
self.contents.font.color = normal_color
self.contents.draw_text(160, 0, 80, 32, "Aprendes:")
self.contents.font.color = system_color
self.contents.draw_text(235, 0, 90, 32, skill)
end
#----------------------------------------------------------------
def draw_shadow
# Draw Shadow
end
#----------------------------------------------------------------
def update
super
end
end # of Window_LevelUp
5. Debajo de Window_Level_Up, crea uno nuevo llamado Window_Exp y pon o
siguiente:
#================================================= ===========
# After Battle Changes
#------------------------------------------------------------------------------
# by Slipknot
#================================================= ===========
module Battle_End_Options
#--------------------------------------------------------------------------
# Split experience received?
#--------------------------------------------------------------------------
Split_Exp = true
#--------------------------------------------------------------------------
# Full recover when actor increase level?
#--------------------------------------------------------------------------
Level_Up_Recover = true
#--------------------------------------------------------------------------
# End wait time, in frames
#--------------------------------------------------------------------------
End_Frames = 80
end
class Scene_Battle
#--------------------------------------------------------------------------
include Battle_End_Options
#--------------------------------------------------------------------------
def start_phase5
@phase = 5
$game_system.me_play($game_system.battle_end_me)
$game_system.bgm_play($game_temp.map_bgm)
exp = gold = 0
treasures = []
for enemy in $game_troop.enemies
unless enemy.hidden
exp += enemy.exp
gold += enemy.gold
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
end
end
end
treasures = treasures[0..5]
psize = $game_party.actors.size-1
if Split_Exp
can_get = 0
0.upto(psize) do can_get += 1 end
exp = (exp /= can_get).ceil if can_get > 0
end
for i in 0..psize
actor = $game_party.actors[i]
unless actor.cant_get_exp?
last_level = actor.level
actor.exp += exp
if actor.level > last_level
@status_window.level_up(i)
if Level_Up_Recover
actor.hp = actor.maxhp
actor.sp = actor.maxsp
end
end
end
end
$game_party.gain_gold(gold)
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
@result_window = Window_BattleResult.new(exp, gold, treasures)
@phase5_wait_count = End_Frames
end
end
#=================================
#Window_EXP
# Written by: David Schooley
#=================================
class Window_EXP < Window_Base
#----------------------------------------------------------------
def initialize(exp)
super(0, 0, 280, 60)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.back_opacity = 255
refresh(exp)
end
#----------------------------------------------------------------
def dispose
super
end
#----------------------------------------------------------------
def refresh(exp)
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 150, 32, "Experiencia:")
self.contents.font.color = normal_color
self.contents.draw_text(180, 0, 54, 32, exp.to_s, 2)
end
#----------------------------------------------------------------
def draw_shadow
# Draw Shadow
end
#----------------------------------------------------------------
def update
super
end
end # of Window_EXP
6. Debajo de Window_exp crea uno nuevo llamado Window_Money_Items y pon lo siguiente:
#=================================
#Window_Money_Items
# Written by: David Schooley
#=================================
class Window_Money_Items < Window_Base
#----------------------------------------------------------------
def initialize(money, treasures)
@treasures = treasures
super(0, 60, 280, 420)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.back_opacity = 255
refresh(money)
end
#----------------------------------------------------------------
def dispose
super
end
#----------------------------------------------------------------
def refresh(money)
@money = money
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 4, 100, 32, "Objetos Obtenidos:")
self.contents.font.color = normal_color
y = 32
for item in @treasures
draw_item_name(item, 4, y)
y += 32
end
cx = contents.text_size($data_system.words.gold).width
self.contents.font.color = normal_color
self.contents.draw_text(4, 340, 220-cx-2, 32, $game_party.gold.to_s, 2)
self.contents.font.color = normal_color
self.contents.draw_text(4, 300, 220-cx-2, 32, "+ " + @money.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(124-cx, 340, cx + 100, 32, $data_system.words.gold, 2)
end
#----------------------------------------------------------------
def draw_shadow
# Draw Shadow
end
#----------------------------------------------------------------
def update
super
end
end # of Window_Money_Items
7. Luego ve a Scene_battle 1 y sustituye todo por esto:
#================================================= =============================
# ■ Scene_Battle (1)
#------------------------------------------------------------------------------
class Scene_Battle
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
# NEW - David
#$battle_end = false
@lvup_window = []
@show_dummies = true # Show dummy windows or not?
# 戦闘用の各種一時データを初期化
$game_temp.in_battle = true
$game_temp.battle_turn = 0
$game_temp.battle_event_flags.clear
$game_temp.battle_abort = false
$game_temp.battle_main_phase = false
$game_temp.battleback_name = $game_map.battleback_name
$game_temp.forcing_battler = nil
# バトルイベント用インタプリタを初期化
$game_system.battle_interpreter.setup(nil, 0)
# トループを準備
@troop_id = $game_temp.battle_troop_id
$game_troop.setup(@troop_id)
# アクターコマンドウィンドウを作成
s1 = $data_system.words.attack
s2 = $data_system.words.skill
s3 = $data_system.words.guard
s4 = $data_system.words.item
@actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
@actor_command_window.y = 160
@actor_command_window.back_opacity = 160
@actor_command_window.active = false
@actor_command_window.visible = false
# その他のウィンドウを作成
@party_command_window = Window_PartyCommand.new
@help_window = Window_Help.new
@help_window.back_opacity = 160
@help_window.visible = false
@status_window = Window_BattleStatus.new
@message_window = Window_Message.new
# スプライトセットを作成
@spriteset = Spriteset_Battle.new
# ウェイトカウントを初期化
@wait_count = 0
# トランジション実行
if $data_system.battle_transition == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$data_system.battle_transition)
end
# プレバトルフェーズ開始
start_phase1
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# マップをリフレッシュ
$game_map.refresh
# トランジション準備
Graphics.freeze
# ウィンドウを解放
@actor_command_window.dispose
@party_command_window.dispose
@help_window.dispose
@status_window.dispose
@message_window.dispose
# NEW - David
@lvup_window = nil
@level_up = nil
@ch_stats = nil
@ch_compare_stats = nil
if @skill_window != nil
@skill_window.dispose
end
if @item_window != nil
@item_window.dispose
end
if @result_window != nil
@result_window.dispose
end
# スプライトセットを解放
# NEW - David
#@spriteset.dispose
# タイトル画面に切り替え中の場合
if $scene.is_a?(Scene_Title)
# 画面をフェードアウト
Graphics.transition
Graphics.freeze
end
# 戦闘テストからゲームオーバー画面以外に切り替え中の場合
if $BTEST and not $scene.is_a?(Scene_Gameover)
$scene = nil
end
end
#--------------------------------------------------------------------------
# ● 勝敗判定
#--------------------------------------------------------------------------
def judge
# 全滅判定が真、またはパーティ人数が 0 人の場合
if $game_party.all_dead? or $game_party.actors.size == 0
# 敗北可能の場合
if $game_temp.battle_can_lose
# バトル開始前の BGM に戻す
$game_system.bgm_play($game_temp.map_bgm)
# バトル終了
battle_end(2)
# true を返す
return true
end
# ゲームオーバーフラグをセット
$game_temp.gameover = true
# true を返す
return true
end
# エネミーが 1 体でも存在すれば false を返す
for enemy in $game_troop.enemies
if enemy.exist?
return false
end
end
# アフターバトルフェーズ開始 (勝利)
start_phase5
# true を返す
return true
end
#--------------------------------------------------------------------------
# ● バトル終了
# result : 結果 (0:勝利 1:敗北 2:逃走)
#--------------------------------------------------------------------------
def battle_end(result)
# 戦闘中フラグをクリア
$game_temp.in_battle = false
# パーティ全員のアクションをクリア
$game_party.clear_actions
# バトル用ステートを解除
for actor in $game_party.actors
actor.remove_states_battle
end
# エネミーをクリア
$game_troop.enemies.clear
# バトル コールバックを呼ぶ
if $game_temp.battle_proc != nil
$game_temp.battle_proc.call(result)
$game_temp.battle_proc = nil
end
# マップ画面に切り替え
$scene = Scene_Map.new
# NEW - David
@status_window.visible = false
@spriteset.dispose
Graphics.transition
if result == 0
display_lv_up(@exp, @gold, @treasures)
loop do
Graphics.update
Input.update
if Input.trigger?(Input::C)
break
end
end
trash_lv_up
end
end
#--------------------------------------------------------------------------
# ● バトルイベントのセットアップ
#--------------------------------------------------------------------------
def setup_battle_event
# バトルイベント実行中の場合
if $game_system.battle_interpreter.running?
return
end
# バトルイベントの全ページを検索
for index in 0...$data_troops[@troop_id].pages.size
# イベントページを取得
page = $data_troops[@troop_id].pages[index]
# イベント条件を c で参照可能に
c = page.condition
# 何も条件が指定されていない場合は次のページへ
unless c.turn_valid or c.enemy_valid or
c.actor_valid or c.switch_valid
next
end
# 実行済みの場合は次のページへ
if $game_temp.battle_event_flags[index]
next
end
# ターン 条件確認
if c.turn_valid
n = $game_temp.battle_turn
a = c.turn_a
b = c.turn_b
if (b == 0 and n != a) or
(b > 0 and (n < 1 or n < a or n % b != a % b))
next
end
end
# エネミー 条件確認
if c.enemy_valid
enemy = $game_troop.enemies[c.enemy_index]
if enemy == nil or enemy.hp * 100.0 / enemy.maxhp > c.enemy_hp
next
end
end
# アクター 条件確認
if c.actor_valid
actor = $game_actors[c.actor_id]
if actor == nil or actor.hp * 100.0 / actor.maxhp > c.actor_hp
next
end
end
# スイッチ 条件確認
if c.switch_valid
if $game_switches[c.switch_id] == false
next
end
end
# イベントをセットアップ
$game_system.battle_interpreter.setup(page.list, 0)
# このページのスパンが [バトル] か [ターン] の場合
if page.span <= 1
# 実行済みフラグをセット
$game_temp.battle_event_flags[index] = true
end
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# バトルイベント実行中の場合
if $game_system.battle_interpreter.running?
# インタプリタを更新
$game_system.battle_interpreter.update
# アクションを強制されているバトラーが存在しない場合
if $game_temp.forcing_battler == nil
# バトルイベントの実行が終わった場合
unless $game_system.battle_interpreter.running?
# 戦闘継続の場合、バトルイベントのセットアップを再実行
unless judge
setup_battle_event
end
end
# アフターバトルフェーズでなければ
if @phase != 5
# ステータスウィンドウをリフレッシュ
@status_window.refresh
end
end
end
# システム (タイマー)、画面を更新
$game_system.update
$game_screen.update
# タイマーが 0 になった場合
if $game_system.timer_working and $game_system.timer == 0
# バトル中断
$game_temp.battle_abort = true
end
# ウィンドウを更新
@help_window.update
@party_command_window.update
@actor_command_window.update
@status_window.update
@message_window.update
# スプライトセットを更新
@spriteset.update
# トランジション処理中の場合
if $game_temp.transition_processing
# トランジション処理中フラグをクリア
$game_temp.transition_processing = false
# トランジション実行
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# メッセージウィンドウ表示中の場合
if $game_temp.message_window_showing
return
end
# エフェクト表示中の場合
if @spriteset.effect?
return
end
# ゲームオーバーの場合
if $game_temp.gameover
# ゲームオーバー画面に切り替え
$scene = Scene_Gameover.new
return
end
# タイトル画面に戻す場合
if $game_temp.to_title
# タイトル画面に切り替え
$scene = Scene_Title.new
return
end
# バトル中断の場合
if $game_temp.battle_abort
# バトル開始前の BGM に戻す
$game_system.bgm_play($game_temp.map_bgm)
# バトル終了
battle_end(1)
return
end
# ウェイト中の場合
if @wait_count > 0
# ウェイトカウントを減らす
@wait_count -= 1
return
end
# アクションを強制されているバトラーが存在せず、
# かつバトルイベントが実行中の場合
if $game_temp.forcing_battler == nil and
$game_system.battle_interpreter.running?
return
end
# フェーズによって分岐
case @phase
when 1
update_phase1
when 2
update_phase2
when 3
update_phase3
when 4
update_phase4
when 5
update_phase5
end
end
end
8. Luego ve a Scene_Battle 2 y sustituye todo por esto:
#================================================= =============================
# ■ Scene_Battle (2)
#------------------------------------------------------------------------------
class Scene_Battle
#--------------------------------------------------------------------------
def start_phase1
@phase = 1
$game_party.clear_actions
setup_battle_event
end
#--------------------------------------------------------------------------
def update_phase1
if judge
return
end
start_phase2
end
#--------------------------------------------------------------------------
def start_phase2
@phase = 2
@actor_index = -1
@active_battler = nil
@party_command_window.active = true
@party_command_window.visible = true
@actor_command_window.active = false
@actor_command_window.visible = false
$game_temp.battle_main_phase = false
$game_party.clear_actions
unless $game_party.inputable?
start_phase4
end
end
#--------------------------------------------------------------------------
def update_phase2
if Input.trigger?(Input::C)
case @party_command_window.index
when 0
$game_system.se_play($data_system.decision_se)
start_phase3
when 1
if $game_temp.battle_can_escape == false
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
update_phase2_escape
end
return
end
end
#--------------------------------------------------------------------------
def update_phase2_escape
enemies_agi = 0
enemies_number = 0
for enemy in $game_troop.enemies
if enemy.exist?
enemies_agi += enemy.agi
enemies_number += 1
end
end
if enemies_number > 0
enemies_agi /= enemies_number
end
actors_agi = 0
actors_number = 0
for actor in $game_party.actors
if actor.exist?
actors_agi += actor.agi
actors_number += 1
end
end
if actors_number > 0
actors_agi /= actors_number
end
success = rand(100) < 50 * actors_agi / enemies_agi
if success
$game_system.se_play($data_system.escape_se)
$game_system.bgm_play($game_temp.map_bgm)
battle_end(1)
else
$game_party.clear_actions
start_phase4
end
end
#--------------------------------------------------------------------------
def start_phase5
@phase = 5
$game_system.me_play($game_system.battle_end_me)
$game_system.bgm_play($game_temp.map_bgm)
exp = 0
gold = 0
treasures = []
for enemy in $game_troop.enemies
unless enemy.hidden
exp += enemy.exp
gold += enemy.gold
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
end
end
end
treasures = treasures[0..5]
# NEW - David
@treasures = treasures
@exp = exp
@gold = gold
# NEW - David
# for i in 0...$game_party.actors.size
# actor = $game_party.actors[i]
# if actor.cant_get_exp? == false
# last_level = actor.level
# actor.exp += exp
# if actor.level > last_level
# @status_window.level_up(i)
# NEW - David
# @level_up[i] = true
# @are_level_ups = true
# end
# end
# end
# $game_party.gain_gold(gold)
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
# NEW - David
#@result_window = Window_BattleResult.new(exp, gold, treasures)
@phase5_wait_count = 100
end
#--------------------------------------------------------------------------
def update_phase5
if @phase5_wait_count > 0
@phase5_wait_count -= 1
if @phase5_wait_count == 0
# NEW - David
#@result_window.visible = true
$game_temp.battle_main_phase = false
#@status_window.refresh
end
return
end
# NEW - David
# if Input.trigger?(Input::C)
battle_end(0)
# end
end
end
9. despues de Scene_Battle 4, crea uno nuevo llamado Scene_Battle D y pon lo
siguiente:
#================================================= =============================
# Scene_Battle D
# Written by: David Schooley
#================================================= =============================
class Scene_Battle
def display_lv_up(exp, gold, treasures)
$d_dum = false
d_extra = 0
i = 0
for actor in $game_party.actors
# Fill up the Lv up windows
@lvup_window[i] = Window_LevelUp.new($game_party.actors[i], i)
i += 1
end
# Make Dummies
if @show_dummies == true
$d_dum = true
for m in i..3
@lvup_window[m] = Window_LevelUp.new(m, m)
end
end
@exp_window = Window_EXP.new(exp)
@m_i_window = Window_Money_Items.new(gold, treasures)
@press_enter = nil
gainedexp = exp
@level_up = [0, 0, 0, 0]
@d_new_skill = ["", "", "", ""]
@d_breakout = false
@m_i_window.refresh(gold)
wait_for_OK
@d_remember = $game_system.bgs_memorize
Audio.bgs_play("Audio/SE/032-Switch01.ogg", 100, 300)
# NEW - David
for n in 0..gainedexp - 1
exp -= 1
if @d_breakout == false
Input.update
end
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.cant_get_exp? == false
last_level = actor.level
actor.exp += 1
# Fill up the Lv up windows
if @d_breakout == false
@lvup_window[i].refresh
@exp_window.refresh(exp)
end
if actor.level > last_level
@level_up[i] = 10
Audio.se_play("Audio/SE/056-Right02.ogg", 70, 150)
if $d_new_skill
@d_new_skill[i] = $d_new_skill
end
end
if @level_up[i] == 0
@d_new_skill[i] = ""
end
if @level_up[i] > 0
@lvup_window[i].level_up
if @d_new_skill[i] != ""
@lvup_window[i].learn_skill(@d_new_skill[i])
end
end
if Input.trigger?(Input::C)
@d_breakout = true
end
end
if @d_breakout == false
if @level_up[i] >0
@level_up[i] -= 1
end
Graphics.update
end
end
if @d_breakout == true
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.cant_get_exp? == false
actor.exp += exp
end
end
exp = 0
break
end
end
Audio.bgs_stop
@d_remember = $game_system.bgs_restore
for i in 0...$game_party.actors.size
@lvup_window[i].refresh
end
@exp_window.refresh(exp)
Audio.se_play("Audio/SE/006-System06.ogg", 70, 150)
$game_party.gain_gold(gold)
@m_i_window.refresh(0)
Graphics.update
end
def trash_lv_up
# NEW - David
i=0
for i in 0 ... 4
@lvup_window[i].visible = false
end
@exp_window.visible = false
@m_i_window.visible = false
@lvup_window = nil
@exp_window = nil
@m_i_window = nil
end
# Wait until OK key is pressed
def wait_for_OK
loop do
Input.update
Graphics.update
if Input.trigger?(Input::C)
break
end
end
end
end