Re: Aportes de Scripts RPG-Maker
Estoy Trabajando en un Script Hecho por un Tipo que sirve para crear a tu gusto el Pj antes de empezar a jugar,el script esta echo y muy bien echo lo malo es .. los recursos utilizados en este scrip,t asi que toy modificando algunas imagenes y otras cosas y lo pondre para compartir, el script se llama Easy Character creator!
Noche y Da
Spoiler
Descripcin:
Se hace de noche o de da dependiendo de la hora.
Instrucciones:
Poner encima de Main en una nueva clase.
Para que funcione es necesario poner un * al final del nombre de los mapas.
Script:
Cdigo:
#=======================================#
class Game_Time
attr_accessor :minute_length
attr_accessor :hours
attr_accessor :minutess
attr_accessor :timess
def initialize
@minute_length= 60.0 #length of game minute in real seconds
@hour_length= 60.0 #minute in an hour
@day_length=24.0 #hours in a day
@month_length=30.0 #days in a month
@year_length=12.0 #months in a year
@minutes=0 #starting minute count
@timess=Time.now #Real-Time Tweak
@hours=timess.strftime("%H").to_i #Real Hours
@minutess=timess.strftime("%M").to_i #Real Min
end
def get_time
@timess=Time.now #Real-Time Tweak
@hours=timess.strftime("%H").to_i #Real Hours
@minutess=timess.strftime("%M").to_i #Real Min
end
def get_tone
get_time
hour=hours
minutes=minutess + hour*@hour_length
phase_shift=Math::PI*(minutes/(@hour_length*@day_length))
illumination= -150+ 165*Math.sin(phase_shift)
tone=Tone.new(illumination,illumination,illumination,0)
return tone
end
end # of class Game_Time
#=======================================#
# “nbsp; class Window_Time #
# written by Deke #
#------------------------------------------------------------------------------#
#=======================================#
class Window_Time < Window_Base
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype # "Time" window font
self.contents.font.size = $defaultfontsize
refresh
end
#--------------------------------------------------------------------------
def refresh
$game_time.get_time
self.contents.clear
@total_sec = Graphics.frame_count / Graphics.frame_rate
@minute=$game_time.minutess
hour = $game_time.hours
pm_flag= hour >=12 ? true : false
hour= hour >= 12 ? hour-12 : hour
if hour.floor==0
text=sprintf("%02d:%02d",12,@minute)
else
text=sprintf("%02d:%02d",hour,@minute)
end
if pm_flag
text += " PM"
else
text += " AM"
end
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120, 32, text, 2)
end
#--------------------------------------------------------------------------
def update
$game_time.get_time
if $game_time.minutess != @minute
refresh
end
end
end # of class
#=======================================
class Game_Temp
#--------------------------------------------------------------------------
# ”? Refer setup to Game Temp
#--------------------------------------------------------------------------
alias dns_game_temp_initalize initialize
#--------------------------------------------------------------------------
# ”? Refer the Attr
#--------------------------------------------------------------------------
attr_reader :map_infos #Added Lines
attr_reader :outside_array #Added Lines
#--------------------------------------------------------------------------
# ”? Refer setup to Scene Map
#--------------------------------------------------------------------------
def initialize
dns_game_temp_initalize
@outside_array = Array.new
@map_infos = load_data("Data/MapInfos.rxdata")
for key in @map_infos.keys
@outside_array[key] = @map_infos[key].name.include?("*")
end
end
end
#=======================================
class Scene_Map
#--------------------------------------------------------------------------
# ”? Refer setup to Scene Map
#--------------------------------------------------------------------------
alias dns_scene_map_main main
alias dns_scene_map_update update
#--------------------------------------------------------------------------
# ”? Main
#--------------------------------------------------------------------------
def main
if $game_temp.outside_array[$game_map.map_id]
tone=$game_time.get_tone
$game_time.get_time
@minute=$game_time.minutess
$game_screen.start_tone_change(tone, 0)
end
# ‚'”'‚'ˆ‚'''ˆ‚’“ˆ?
@spriteset = Spriteset_Map.new
# '''‚'‚‚‚''‰‚‚’“ˆ?
@message_window = Window_Message.new
# 'ˆ''‚‚''Ÿ'
Graphics.transition
# '‚''''”
loop do
$light_effects.refresh
# ‚'' ”?‚’›“
Graphics.update
# … ›'… ‚’›“
Input.update
# '•''' ›“
update
# ”??'ˆ‡‚ ›‚???Ÿ‚‰'''”‚’*“*
if $scene != self
break
end
end
# 'ˆ''‚‚''“‚™
Graphics.freeze
# ‚'”'‚'ˆ‚'''ˆ‚’解”
@spriteset.dispose
# '''‚'‚‚‚''‰‚‚’解”
@message_window.dispose
# ‚‚'ˆ'”??ˆ‡‚ ›?ˆ*? ?ˆ
if $scene.is_a?(Scene_Title)
# ”?‚’'•‚''‰‚‚'ˆ
Graphics.transition
Graphics.freeze
end
$light_effects.hide
end
#--------------------------------------------------------------------------
# ”? Update
#--------------------------------------------------------------------------
def update
$game_time.get_time
$light_effects.update
conditional1 =$game_temp.outside_array[$game_map.map_id] and $game_time.minutess != @minute
conditional2 =$game_temp.outside_array[$game_map.map_id] and @current_id != $game_map.map_id
if conditional1 or conditional2
tone=$game_time.get_tone
$game_screen.start_tone_change(tone, 0)
@minute = $game_time.minutess
$game_map.need_refresh=true
@current_id=$game_map.map_id
end
if $game_temp.outside_array[$game_map.map_id] == false and @current_id != $game_map.map_id
$game_screen.start_tone_change(Tone.new(0,0,0,0),0)
@current_id=$game_map.map_id
end
dns_scene_map_update
end
end
#======================================================
class Scene_Title
#--------------------------------------------------------------------------
# ”? Refer setup to Scene Map
#--------------------------------------------------------------------------
alias dns_scene_title_update update
#--------------------------------------------------------------------------
# ”? Refer setup to Scene Map
#--------------------------------------------------------------------------
def update
$game_time=Game_Time.new
#Dubealex Addition (from XRXS) to show Map Name on screen
dns_scene_title_update
end
end
class Game_Map
#--------------------------------------------------------------------------
# ”? Refer the attr
#--------------------------------------------------------------------------
attr_reader :outside
attr_reader :map_id
#--------------------------------------------------------------------------
# ”? Outside
#--------------------------------------------------------------------------
def outside
return $game_temp.outside_array[@map_id]
end
end
#==============================================================================
# “nbsp; Light Effect System
#------------------------------------------------------------------------------
# €€By: Near Fantastica
# Date: 13/2/05
#
# Addes light Effects to the DNS so objects glow and have ground effect lighting...
#==============================================================================
class Light_Effect_System
#--------------------------------------------------------------------------
# ”? Refer the attr
#--------------------------------------------------------------------------
attr_accessor :picture_le
attr_accessor :event_list
attr_accessor :type_list
#--------------------------------------------------------------------------
# ”? Initialization
#--------------------------------------------------------------------------
def initialize
@event_counter = 0
@picture_le = Array.new
@event_list = Array.new
@type_list = Array.new
end
#--------------------------------------------------------------------------
# ”? Setup Light Effects on Map Change
#--------------------------------------------------------------------------
def setup
# Setup Event Max
@event_counter = 0
for i in 1..999
if $game_map.map.events[i].id > @event_counter
@event_counter = $game_map.map.events[i].id
end
end
#
for i in 1..@event_counter
if $game_map.map.events[i] == nil
next
end
case $game_map.map.events[i].name
when "Ground"
ground(i)
when "Fire"
fire(i)
when "Lamp Post"
lamp(i)
when "Left Lantern"
left_lantern(i)
when "Right Lantern"
right_lantern(i)
end
end
end
#--------------------------------------------------------------------------
# ”? Updates the Array based on time of day
#--------------------------------------------------------------------------
def update
$game_time.get_time
if $game_time.hours > 7 and $game_time.hours < 14
hide
else
show
end
end
#--------------------------------------------------------------------------
# ”? Updates the XY of the sprites
#--------------------------------------------------------------------------
def refresh
for i in 0..$light_effects.picture_le.size - 1
case $light_effects.type_list[i]
when "Ground"
$light_effects.picture_le[i].x = ($game_map.events[$light_effects.event_list[i]].real_x - 200 - $game_map.display_x) / 4
$light_effects.picture_le[i].y = ($game_map.events[$light_effects.event_list[i]].real_y - 200 - $game_map.display_y) / 4
$light_effects.picture_le[i].visible = true
when "Fire"
$light_effects.picture_le[i].x = ($game_map.events[$light_effects.event_list[i]].real_x - 300 - $game_map.display_x) / 4
$light_effects.picture_le[i].y = ($game_map.events[$light_effects.event_list[i]].real_y - 300 - $game_map.display_y) / 4
$light_effects.picture_le[i].visible = true
when "Left Lamp Post"
$light_effects.picture_le[i].x = (-0.25 * $game_map.display_x) + ($game_map.events[$light_effects.event_list[i]].x * 32) - 5
$light_effects.picture_le[i].y = (-0.25 * $game_map.display_y) + ($game_map.events[$light_effects.event_list[i]].y * 32) - 15
when "Right Lamp Post"
$light_effects.picture_le[i].x = (-0.25 * $game_map.display_x) + ($game_map.events[$light_effects.event_list[i]].x * 32) - 25
$light_effects.picture_le[i].y = (-0.25 * $game_map.display_y) + ($game_map.events[$light_effects.event_list[i]].y * 32) - 15
$light_effects.picture_le[i].visible = true
when "Left Lantern"
$light_effects.picture_le[i].x = (-0.25 * $game_map.display_x) + ($game_map.events[$light_effects.event_list[i]].x * 32) - 20
$light_effects.picture_le[i].y = (-0.25 * $game_map.display_y) + ($game_map.events[$light_effects.event_list[i]].y * 32) - 5
$light_effects.picture_le[i].visible = true
when "Right Lantern"
$light_effects.picture_le[i].x = (-0.25 * $game_map.display_x) + ($game_map.events[$light_effects.event_list[i]].x * 32) - 10
$light_effects.picture_le[i].y = (-0.25 * $game_map.display_y) + ($game_map.events[$light_effects.event_list[i]].y * 32) - 5
$light_effects.picture_le[i].visible = true
end
end
end
#--------------------------------------------------------------------------
# ”? Redraws the Array
#--------------------------------------------------------------------------
def redraw
if @picture_le != []
for i in 0..@picture_le.size - 1
@picture_le[i].bitmap.dispose
end
@picture_le = Array.new
@event_list = Array.new
@type_list = Array.new
end
end
#--------------------------------------------------------------------------
# ”? Shows Array
#--------------------------------------------------------------------------
def show
if @picture_le != []
for i in 0..@picture_le.size - 1
@picture_le[i].visible = true
end
end
end
#--------------------------------------------------------------------------
# ”? Hides Array
#--------------------------------------------------------------------------
def hide
if @picture_le != []
for i in 0..@picture_le.size - 1
@picture_le[i].visible = false
end
end
end
#--------------------------------------------------------------------------
# ”? Setup Light Effects for Ground
#--------------------------------------------------------------------------
def ground(event_index)
light_effects = Sprite.new
light_effects.bitmap = RPG::Cache.picture("LE.PNG")
light_effects.zoom_x = 200 / 100.0
light_effects.zoom_y = 200 / 100.0
light_effects.z = 1000
light_effects.opacity = 50
light_effects.visible = false
@picture_le.push(light_effects)
@event_list.push(event_index)
@type_list.push("Ground")
end
#--------------------------------------------------------------------------
# ”? Setup Light Effects for Fire
#--------------------------------------------------------------------------
def fire(event_index)
light_effects = Sprite.new
light_effects.bitmap = RPG::Cache.picture("LE.PNG")
light_effects.zoom_x = 300 / 100.0
light_effects.zoom_y = 300 / 100.0
light_effects.z = 1000
light_effects.opacity = 100
light_effects.visible = false
@picture_le.push(light_effects)
@event_list.push(event_index)
@type_list.push("Fire")
end
#--------------------------------------------------------------------------
# ”? Setup Light Effects for Lamp
#--------------------------------------------------------------------------
def lamp(event_index)
light_effects = Sprite.new
light_effects.bitmap = RPG::Cache.picture("LE.PNG")
light_effects.z = 1000
light_effects.opacity = 100
light_effects.visible = false
@picture_le.push(light_effects)
@event_list.push(event_index)
@type_list.push("Left Lamp Post")
light_effects = Sprite.new
light_effects.bitmap = RPG::Cache.picture("LE.PNG")
light_effects.z = 1000
light_effects.opacity = 100
light_effects.visible = false
@picture_le.push(light_effects)
@event_list.push(event_index)
@type_list.push("Right Lamp Post")
end
#--------------------------------------------------------------------------
# ”? Setup Light Effects for Lantern
#--------------------------------------------------------------------------
def left_lantern(event_index)
light_effects = Sprite.new
light_effects.bitmap = RPG::Cache.picture("LE.PNG")
light_effects.z = 1000
light_effects.opacity = 150
light_effects.visible = false
@picture_le.push(light_effects)
@event_list.push(event_index)
@type_list.push("Left Lantern")
end
#--------------------------------------------------------------------------
# ”? Setup Light Effects for Lantern
#--------------------------------------------------------------------------
def right_lantern(event_index)
light_effects = Sprite.new
light_effects.bitmap = RPG::Cache.picture("LE.PNG")
light_effects.z = 1000
light_effects.opacity = 150
light_effects.visible = false
@picture_le.push(light_effects)
@event_list.push(event_index)
@type_list.push("Right Lantern")
end
end
#==============================================================================
# “nbsp; Game_Map
#------------------------------------------------------------------------------
# €€Add defenision of the names to Game Map Class
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# ”? Refer the attr
#--------------------------------------------------------------------------
attr_accessor :map
#--------------------------------------------------------------------------
# ”? Refer setup to Game Map
#--------------------------------------------------------------------------
alias les_game_map_setup setup
#--------------------------------------------------------------------------
# ”? Refers the Map Setup
#--------------------------------------------------------------------------
def setup(map_id)
$light_effects.redraw
les_game_map_setup(map_id)
$light_effects.setup
end
end
#==============================================================================
# “nbsp; Scene_Title
#------------------------------------------------------------------------------
# €€It is the class which processes the title picture
#==============================================================================
class Scene_Title
#--------------------------------------------------------------------------
# ”? Refer setup to Scene Title
#--------------------------------------------------------------------------
alias les_scene_title_update update
#--------------------------------------------------------------------------
# ”? Sets up the ABS
#--------------------------------------------------------------------------
def update
$light_effects = Light_Effect_System.new
les_scene_title_update
end
end
Crditos a "Desconocido"
Advance Equip System
Spoiler
Descripcin:
Un sistema avanzado de la pantalla equipo, que sustituye a la que hay por defecto. Con la opcin de optimizar el equipo, para un personaje en concreto.
Instalacin:
Simplemente, pegar arriba del Main y probar el juego:
Cdigo:
#=============================================================
=================
# Harts Horn's Equip Screen
#------------------------------------------------------------------------------
# Ventana de Equipamiento personalizada con opcion para optimizar.
#==============================================================================
class Harts_Window_EquipTitle < Window_Base
#--------------------------------------------------------------------------
# Inicializacion de Objetos
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120, 32, $data_system.words.equip, 1)
end
end
#==============================================================================
# Ventana de comandos
#------------------------------------------------------------------------------
# Esta es la ventana que muestra los comandos =P
#==============================================================================
class Harts_Window_EquipCommand < Window_Selectable
#--------------------------------------------------------------------------
# Inicializacion de Objetos
#--------------------------------------------------------------------------
def initialize
super(160, 0, 480, 64)
self.contents = Bitmap.new(width - 32, height - 32)
@item_max = 3
@column_max = 3
@commands = ["Modificar", "Optimizar", "Salir"]
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# Actualizacion
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
x = index * 160 + 4
self.contents.draw_text(x, 0, 128, 32, @commands[index], 1)
end
end
#==============================================================================
# Harts_Window_EquipItem
#==============================================================================
class Harts_Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
# Inicializacion de Objetos
#--------------------------------------------------------------------------
def initialize(actor, equip_type)
super(272, 256, 368, 160)
@actor = actor
@equip_type = equip_type
@column_max = 1
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
def max_item_id
if @equip_type == 0
if @actor.weapon_id == 0
max = 0
else
max = $data_weapons[@actor.weapon_id].atk
end
elsif @equip_type == 1
if @actor.armor1_id == 0
max = 0
else
max = $data_armors[@actor.armor1_id].pdef
end
elsif @equip_type == 2
if @actor.armor2_id == 0
max = 0
else
max = $data_armors[@actor.armor2_id].pdef
end
elsif @equip_type == 3
if @actor.armor3_id == 0
max = 0
else
max = $data_armors[@actor.armor3_id].pdef
end
end
for i in 0...@data.size-1
if @equip_type == 0
if max <= $data_weapons[@data[i].id].atk
max = $data_weapons[@data[i].id].atk
item_id = @data[i].id
end
elsif @equip_type >= 1
if max <= $data_armors[@data[i].id].pdef
max = $data_armors[@data[i].id].pdef
item_id = @data[i].id
end
end
end
return item_id
end
#--------------------------------------------------------------------------
# Actualizacion
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
if @equip_type == 0
weapon_set = $data_classes[@actor.class_id].weapon_set
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
@data.push($data_weapons[i])
end
end
end
if @equip_type >= 1
armor_set = $data_classes[@actor.class_id].armor_set
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and armor_set.include?(i)
if $data_armors[i].kind == @equip_type-1
@data.push($data_armors[i])
end
end
end
end
@data.push(nil)
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max-1
draw_item(i)
end
end
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
x = 4
y = index * 32
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 280, y, 16, 32, ":", 1)
self.contents.draw_text(x + 296, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#==============================================================================
# Harts_Window_EquipLeft
#==============================================================================
class Harts_Window_EquipLeft < Window_Base
#--------------------------------------------------------------------------
# Inicializacion de Objetos
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 64, 272, 352)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_graphic(@actor, 32, 64)
draw_actor_name(@actor, 4 + 96, 0)
draw_actor_level(@actor, 4 + 96, 32)
draw_actor_parameter(@actor, 4, 80, 0)
draw_actor_parameter(@actor, 4, 112, 1)
draw_actor_parameter(@actor, 4, 144, 2)
draw_actor_parameter(@actor, 4, 192, 3)
draw_actor_parameter(@actor, 4, 224, 4)
draw_actor_parameter(@actor, 4, 256, 5)
draw_actor_parameter(@actor, 4, 288, 6)
if @new_atk != nil and @new_atk != @actor.atk
if @new_atk > @actor.atk
self.contents.font.color = system_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_text(160, 80, 40, 32, "?", 1)
self.contents.draw_text(200, 80, 36, 32, @new_atk.to_s, 2)
end
if @new_pdef != nil and @new_pdef != @actor.pdef
if @new_pdef > @actor.pdef
self.contents.font.color = system_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_text(160, 112, 40, 32, "?", 1)
self.contents.draw_text(200, 112, 36, 32, @new_pdef.to_s, 2)
end
if @new_mdef != nil and @new_mdef != @actor.mdef
if @new_mdef > @actor.mdef
self.contents.font.color = system_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_text(160, 144, 40, 32, "?", 1)
self.contents.draw_text(200, 144, 36, 32, @new_mdef.to_s, 2)
end
if @new_str != nil and @new_str != @actor.str
if @new_str > @actor.str
self.contents.font.color = system_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_text(160, 192, 40, 32, "?", 1)
self.contents.draw_text(200, 192, 36, 32, @new_str.to_s, 2)
end
if @new_dex != nil and @new_dex != @actor.dex
if @new_dex > @actor.dex
self.contents.font.color = system_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_text(160, 224, 40, 32, "?", 1)
self.contents.draw_text(200, 224, 36, 32, @new_dex.to_s, 2)
end
if @new_agi != nil and @new_agi != @actor.agi
if @new_agi > @actor.agi
self.contents.font.color = system_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_text(160, 256, 40, 32, "?", 1)
self.contents.draw_text(200, 256, 36, 32, @new_agi.to_s, 2)
end
if @new_int != nil and @new_int != @actor.int
if @new_int > @actor.int
self.contents.font.color = system_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_text(160, 288, 40, 32, "?", 1)
self.contents.draw_text(200, 288, 36, 32, @new_int.to_s, 2)
end
end
#--------------------------------------------------------------------------
def set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex, new_agi, new_int)
if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef or @new_str != new_str or @new_dex != new_dex or @new_agi != new_agi or @new_int != new_int
@new_atk = new_atk
@new_pdef = new_pdef
@new_mdef = new_mdef
@new_str = new_str
@new_dex = new_dex
@new_agi = new_agi
@new_int = new_int
refresh
end
end
end
#==============================================================================
# Harts_Scene_Equip
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# Inicializacion de Objetos
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = -1, command_index = 0, equip_active = false, command_active = true)
@actor_index = actor_index
@equip_index = equip_index
@command_index = command_index
@equip_active = equip_active
@command_active = command_active
end
#--------------------------------------------------------------------------
# Metodo principal
#--------------------------------------------------------------------------
def main
@actor = $game_party.actors[@actor_index]
@title_window = Harts_Window_EquipTitle.new
@command_window = Harts_Window_EquipCommand.new
@help_window = Window_Help.new
@help_window.y = 416
@left_window = Harts_Window_EquipLeft.new(@actor)
@right_window = Window_EquipRight.new(@actor)
@item_window0 = Harts_Window_EquipItem.new(@actor, -1)
@item_window1 = Harts_Window_EquipItem.new(@actor, 0)
@item_window2 = Harts_Window_EquipItem.new(@actor, 1)
@item_window3 = Harts_Window_EquipItem.new(@actor, 2)
@item_window4 = Harts_Window_EquipItem.new(@actor, 3)
@item_window5 = Harts_Window_EquipItem.new(@actor, 4)
@right_window.help_window = @help_window
@item_window0.help_window = @help_window
@item_window1.help_window = @help_window
@item_window2.help_window = @help_window
@item_window3.help_window = @help_window
@item_window4.help_window = @help_window
@item_window5.help_window = @help_window
@command_window.index = @command_index
@right_window.index = @equip_index
@command_window.active = @command_active
@right_window.active = @equip_active
refresh
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@title_window.dispose
@command_window.dispose
@help_window.dispose
@left_window.dispose
@right_window.dispose
@item_window0.dispose
@item_window1.dispose
@item_window2.dispose
@item_window3.dispose
@item_window4.dispose
@item_window5.dispose
end
#--------------------------------------------------------------------------
# Actualizacion
#--------------------------------------------------------------------------
def refresh
@item_window0.visible = (@right_window.index == -1)
@item_window1.visible = (@right_window.index == 0)
@item_window2.visible = (@right_window.index == 1)
@item_window3.visible = (@right_window.index == 2)
@item_window4.visible = (@right_window.index == 3)
@item_window5.visible = (@right_window.index == 4)
item1 = @right_window.item
case @right_window.index
when -1
@item_window = @item_window0
when 0
@item_window = @item_window1
when 1
@item_window = @item_window2
when 2
@item_window = @item_window3
when 3
@item_window = @item_window4
when 4
@item_window = @item_window5
end
if @right_window.active
@left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil)
end
if @item_window.active
item2 = @item_window.item
last_hp = @actor.hp
last_sp = @actor.sp
@actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
new_str = @actor.str
new_dex = @actor.dex
new_agi = @actor.agi
new_int = @actor.int
@actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
@left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex, new_agi, new_int)
end
end
#--------------------------------------------------------------------------
# Actualizacion
#--------------------------------------------------------------------------
def update
@title_window.update
@command_window.update
@left_window.update
@right_window.update
@item_window.update
refresh
if @command_window.active
update_command
return
end
if @right_window.active
update_right
return
end
if @item_window.active
update_item
return
end
end
#--------------------------------------------------------------------------
# Actualizacion de los comandos
#--------------------------------------------------------------------------
def update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(2)
return
end
if Input.trigger?(Input::C)
case @command_window.index
when 0
$game_system.se_play($data_system.decision_se)
@right_window.active = true
@command_window.active = false
@right_window.index = 0
@command_window.index = -1
return
when 1
$game_system.se_play($data_system.equip_se)
max_weapon_id = @item_window1.max_item_id
max_armor1_id = @item_window2.max_item_id
max_armor2_id = @item_window3.max_item_id
max_armor3_id = @item_window4.max_item_id
@actor.equip(0, max_weapon_id)
@actor.equip(1, max_armor1_id)
@actor.equip(2, max_armor2_id)
@actor.equip(3, max_armor3_id)
@right_window.refresh
@left_window.refresh
@item_window1.refresh
@item_window2.refresh
@item_window3.refresh
@item_window4.refresh
return
when 2
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(2)
return
end
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Equip.new(@actor_index, @right_window.index, @command_window.index)
return
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Equip.new(@actor_index, @right_window.index, @command_window.index)
return
end
end
#--------------------------------------------------------------------------
def update_right
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@right_window.active = false
@command_window.active = true
@right_window.index = -1
@command_window.index = 0
return
end
if Input.trigger?(Input::C)
if @actor.equip_fix?(@right_window.index)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
@right_window.active = false
@item_window.active = true
@item_window.index = 0
return
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Equip.new(@actor_index, @right_window.index, @command_window.index, true, false)
return
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Equip.new(@actor_index, @right_window.index, @command_window.index, true, false)
return
end
end
#--------------------------------------------------------------------------
def update_item
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@right_window.active = true
@item_window.active = false
@item_window.index = -1
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.equip_se)
item = @item_window.item
@actor.equip(@right_window.index, item == nil ? 0 : item.id)
@right_window.active = true
@item_window.active = false
@item_window.index = -1
@right_window.refresh
@item_window.refresh
return
end
end
end
Creditos: Harts Horn
|