NEO_GABMiér Ago 22, 2012 3:29 pm
Usuario Nv7
Aqui les traigo un script que hice
AUTOR: Yo.
NOMBRE: GAB_BASE.
INSTRUCCIONES: Pegar encima de main.
permite cambiar la resolucion de la pantalla.
corrige el error al cambiar el tono de la pantalla al cambiar la resolucion de la misma.
entre otras cosas...
SCRIPT
NOTA:Agradecimientos a KHAS por su script de SMOOTH SLIDING.
Eso es todo espero que le sirva.
AUTOR: Yo.
NOMBRE: GAB_BASE.
INSTRUCCIONES: Pegar encima de main.
permite cambiar la resolucion de la pantalla.
corrige el error al cambiar el tono de la pantalla al cambiar la resolucion de la misma.
entre otras cosas...
SCRIPT
- Código:
#===============================================================================
# GAB_BASE.
#===============================================================================
#~ SCRIPT CREADO POR: ~#
#~ ~#
#~---------------------<<NEO_GAB>>-----------------------~#
#~-------------------------------------------------------~#
#~------------------Fecha:20/08/2012---------------------~#
#~-------------------------------------------------------~#
#~-------------------------------------------------------~#
#===============================================================================
# Instrucciones:
# Pegar encima de main.
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Cambios y mejoras a algunos metodos del juego.
#===============================================================================
#==============================================================================
# Configuraciones Basicas.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
module GAB_BASE
# Las medidas norales son 17 * 13.
TILES_WIDTH = 20 # Ancho de la ventana en tiles.
TILES_HEIGHT = 13 # Alto de la ventana en tiles.
FONT_NAME = ["Georgia", "Verdana", "Arial", "Courier"]
FONT_SIZE = 24 # Tamaño de la fuente.
FONT_BOLD = false # Negrita.
FONT_ITALIC = false # Cursiva.
FONT_SHADOW = false # Sombra.
FONT_OUTLINE = true # Borde.
$USE_MESSAGE_IMAGE = true # En el RpgMakerVx se usaba una
# imagen como fondo oscuro, esta opcion habilita esa imagen y
# debe de estar en la carpeta system con el nombre de "MessageBack"
# PONER FALSE SI SE QUIERE DESABILITAR STA OPCION.
USE_SLICE_MENU = false # Usar movimiento de entrada de
# las ventanas en el menu.
USE_VENTANA_LOCATION = true # Activar la ventana de ubicacion en el menu.
end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Fin de las configuraciones
#==============================================================================
#==============================================================================
# Aqui se editan algunos metodos como el tamaño de pantalla
# y la fuente del juego.
#==============================================================================
Graphics.resize_screen(GAB_BASE::TILES_WIDTH * 32, GAB_BASE::TILES_HEIGHT * 32)
Font.default_name = GAB_BASE::FONT_NAME
Font.default_size = GAB_BASE::FONT_SIZE
Font.default_bold = GAB_BASE::FONT_BOLD
Font.default_italic = GAB_BASE::FONT_ITALIC
Font.default_shadow = GAB_BASE::FONT_SHADOW
Font.default_outline = GAB_BASE::FONT_OUTLINE
#==============================================================================
# Game_Event.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#==============================================================================
class Game_Event < Game_Character
def near_the_screen?(dx = nil, dy = nil)
dx = [Graphics.width, $game_map.width * 256].min/32 - 5 if dx.nil?
dy = [Graphics.height, $game_map.height * 256].min/32 - 5 if dy.nil?
ax = $game_map.adjust_x(@real_x) - Graphics.width / 2 / 32
ay = $game_map.adjust_y(@real_y) - Graphics.height / 2 / 32
ax >= -dx && ax <= dx && ay >= -dy && ay <= dy
end
end
#==============================================================================
# Spriteset_Map.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#==============================================================================
class Spriteset_Map
def create_viewports
if Graphics.width > $game_map.width * 32 && !$game_map.loop_horizontal?
dx = (Graphics.width - $game_map.width * 32) / 2
else
dx = 0
end
dw = [Graphics.width, $game_map.width * 32].min
dw = Graphics.width if $game_map.loop_horizontal?
if Graphics.height > $game_map.height * 32 && !$game_map.loop_vertical?
dy = (Graphics.height - $game_map.height * 32) / 2
else
dy = 0
end
dh = [Graphics.height, $game_map.height * 32].min
dh = Graphics.height if $game_map.loop_vertical?
@viewport1 = Viewport.new(dx, dy, dw, dh)
@viewport2 = Viewport.new(dx, dy, dw, dh)
@viewport3 = Viewport.new(dx, dy, dw, dh)
@viewport2.z = 50
@viewport3.z = 100
end
def update_viewport_sizes
if Graphics.width > $game_map.width * 32 && !$game_map.loop_horizontal?
dx = (Graphics.width - $game_map.width * 32) / 2
else
dx = 0
end
dw = [Graphics.width, $game_map.width * 32].min
dw = Graphics.width if $game_map.loop_horizontal?
if Graphics.height > $game_map.height * 32 && !$game_map.loop_vertical?
dy = (Graphics.height - $game_map.height * 32) / 2
else
dy = 0
end
dh = [Graphics.height, $game_map.height * 32].min
dh = Graphics.height if $game_map.loop_vertical?
rect = Rect.new(dx, dy, dw, dh)
for viewport in [@viewport1, @viewport2, @viewport3]
viewport.rect = rect
end
end
alias randShake update
def update()
randShake();
if (defined?(RPG::Cache))
@viewport1.ox = (rand(2) == 0 ? 1 : -1) * rand($game_screen.shake);
@viewport1.oy = (rand(2) == 0 ? 1 : -1) * rand($game_screen.shake);
else
@viewport1.ox = (rand(2) == 0 ? 1 : -1) * rand($game_map.screen.shake);
@viewport1.oy = (rand(2) == 0 ? 1 : -1) * rand($game_map.screen.shake);
end
end
end
#==============================================================================
# Window_Base.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#==============================================================================
class Window_Base < Window
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Restaurar fuente del juego.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def reset_font_settings
change_color(normal_color)
contents.font.size = Font.default_size
contents.font.bold = Font.default_bold
contents.font.italic = Font.default_italic
contents.font.out_color = Font.default_out_color
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Barra.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def draw_gauge(x, y, width, rate, color1, color2)
back_color = Color.new(50,50,50)
fill_w = (width * rate).to_i
gauge_y = y + line_height - 8
contents.gradient_fill_rect(x - 2, gauge_y - 1, width + 4, 8, gauge_back_color,back_color,back_color)
contents.gradient_fill_rect(x, gauge_y, fill_w, 3, color1, color2, color2)
contents.gradient_fill_rect(x, gauge_y+3, fill_w, 3, color2, color1, color1)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Barra de HP.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def draw_actor_hp(actor, x, y, width = 100)
draw_gauge(x, y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
change_color(system_color)
draw_text(x, y, 30, line_height, Vocab::hp_a)
change_color(normal_color)
draw_text(x + 95, y , 212, 22, actor.hp)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Barra de MP.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def draw_actor_mp(actor, x, y, width = 100)
draw_gauge(x, y, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
change_color(system_color)
draw_text(x, y, 30, line_height, Vocab::mp_a)
change_color(normal_color)
draw_text(x + 95, y , 212, 22, actor.mp)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Barra de EXP.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def draw_actor_exp(actor, x, y, width = 50)
gc1 = Color.new(205,255,205)
gc2 = Color.new(10,220,45)
contents.gradient_fill_rect(x, y + 15, width, 5, Color.new(0,0,0),Color.new(50,50,50),Color.new(50,50,50))
contents.gradient_fill_rect(x + 2, y + 16, width*actor.exp/actor.next_level_exp, 3, gc1, gc2, gc2)
change_color(system_color)
draw_text(x, y, 90, 32, "Exp")
change_color(normal_color)
draw_text(x + width - 42, y , 212, 22, actor.exp)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Nivel.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def draw_actor_level(actor, x, y)
change_color(system_color)
draw_text(x, y, 32, 24, "Nv")
change_color(normal_color)
draw_text(x + 20, y, 24, 24, actor.level, 2)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Parametros del actor.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def draw_actor_param(actor, x, y, param_id)
change_color(system_color)
draw_text(x, y, 120, line_height, Vocab::param(param_id))
change_color(normal_color)
draw_text(x + 120, y, 36, line_height, actor.param(param_id), 2)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Status simple del personaje.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def draw_actor_simple_status(actor, dx, dy)
draw_actor_name(actor, dx, dy)
draw_actor_level(actor, dx, dy + line_height * 1)
draw_actor_icons(actor, dx, dy + line_height * 2)
dw = contents.width - dx - 124
draw_actor_class(actor, dx + 120, dy, dw)
draw_actor_hp(actor, dx + 120, dy + line_height * 1, dw)
draw_actor_mp(actor, dx + 120, dy + line_height * 2, dw)
draw_actor_exp(actor, dx + 120, dy + line_height * 3, dw - 60)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Oro en el mapa.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def draw_currency_value_map(value, x, y, width)
cx = contents.text_size(Vocab::currency_unit).width
contents.font.color = Color.new(255,255,0)
contents.draw_text(x, y, width-cx-2, 24, value, 2)
contents.font.color = normal_color
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Movimiento en ls ventanas del menu.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def ssx(tx,time)
@ax = self.x
@dx = (tx.to_f - @ax)/2
@phase_x = Math::PI
@speed_x = @phase_x/time
@scroll_x = true
end
def ssy(ty,time)
@ay = self.y
@dy = (ty.to_f - @ay)/2
@phase_y = Math::PI
@speed_y = @phase_y/time
@scroll_y = true
end
def update_scroll
unless @phase_x.nil?
@phase_x -= @speed_x
if @phase_x > 0
self.x = @ax + @dx*(Math.cos(@phase_x)+1)
else
self.x = @ax + @dx*2
@phase_x = nil
@scroll_x = false
end
end
unless @phase_y.nil?
@phase_y -= @speed_y
if @phase_y > 0
self.y = @ay + @dy*(Math.cos(@phase_y)+1)
else
self.y = @ay + @dy*2
@phase_y = nil
@scroll_y = false
end
end
end
end
#==============================================================================
# Ventana_Comprar.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Aqui se le hace una pequeña edicion.
#==============================================================================
class Window_ShopBuy < Window_Selectable
def draw_item(index)
item = @data[index]
rect = item_rect(index)
draw_item_name(item, rect.x, rect.y, enable?(item))
rect.width -= 4
draw_text(rect, price(item), 2)
end
end
#==============================================================================
# Ventana_location
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Esta ventana muestra tu ubicacion
#==============================================================================
class Map_Location < Window_Base
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Inicializacion.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize(x=0, y=0)
super(x, y, 160, 80)
refresh
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Actualizacion.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def refresh
contents.clear
change_color(system_color)
contents.draw_text(10, -5, 150, 32, "Ubicacion:")
change_color(normal_color)
data = load_data("Data/MapInfos.rvdata2")
contents.font.size = Font.default_size - 5
contents.draw_text(0, 25, self.width, 32, data[$game_map.map_id].name)
end
end
#==============================================================================
# Spriteset_Battle.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Cambios para que el fondo se acomode con el tamño de la ventana.
#==============================================================================
class Spriteset_Battle
def create_battleback1
@back1_sprite = Sprite.new(@viewport1)
@back1_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
background = battleback1_bitmap
screen = Rect.new(0, 0, Graphics.width, Graphics.height)
@back1_sprite.bitmap.stretch_blt(screen, background, background.rect)
@back1_sprite.z = 0
center_sprite(@back1_sprite)
end
def create_battleback2
@back2_sprite = Sprite.new(@viewport1)
@back2_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
background = battleback2_bitmap
screen = Rect.new(0, 0, Graphics.width, Graphics.height)
@back1_sprite.bitmap.stretch_blt(screen, background, background.rect)
@back2_sprite.z = 1
center_sprite(@back2_sprite)
end
end
#==============================================================================
# Scene_Map.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#==============================================================================
class Scene_Map < Scene_Base
alias scene_map_post_transfer_ace post_transfer
def post_transfer
@spriteset.update_viewport_sizes
scene_map_post_transfer_ace
end
end
#==============================================================================
# Scene_Title.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Cambios para que el fondo se acomode con el tamño de la ventana.
#==============================================================================
class Scene_Title < Scene_Base
def create_background
@sprite1 = Sprite.new
@sprite1.bitmap = Bitmap.new(Graphics.width, Graphics.height)
background = Cache.title1($data_system.title1_name)
screen = Rect.new(0, 0, Graphics.width, Graphics.height)
@sprite1.bitmap.stretch_blt(screen, background, background.rect)
@sprite2 = Sprite.new
@sprite2.bitmap = Bitmap.new(Graphics.width, Graphics.height)
background = Cache.title2($data_system.title2_name)
screen = Rect.new(0, 0, Graphics.width, Graphics.height)
@sprite2.bitmap.stretch_blt(screen, background, background.rect)
center_sprite(@sprite1)
center_sprite(@sprite2)
end
end
#==============================================================================
# Scene_Menu.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#==============================================================================
class Scene_Menu < Scene_MenuBase
def start
super
create_command_window
create_gold_window
create_status_window
if GAB_BASE::USE_VENTANA_LOCATION
create_loc_window
end
if GAB_BASE::USE_SLICE_MENU
@gold_window.y = Graphics.height
@status_window.x = -@status_window.width
@command_window.x = Graphics.width
@loc_window.y = - @loc_window.width
@gold_window.ssy(Graphics.height - @gold_window.height,20)
@status_window.ssx(@command_window.width,20)
@command_window.ssx(0,20)
@loc_window.ssy(@command_window.height,20)
end
def update
super
@gold_window.update_scroll
@status_window.update_scroll
@command_window.update_scroll
@loc_window.update_scroll
end
end
def create_loc_window
@loc_window = Map_Location.new(0,@command_window.height)
end
end
if GAB_BASE::USE_SLICE_MENU
#==============================================================================
# Scene_Status
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#==============================================================================
class Scene_Status < Scene_MenuBase
def start
super
@status_window = Window_Status.new(@actor)
@status_window.y = -@status_window.height
@status_window.ssy(0, 20)
@status_window.set_handler(:cancel, method(:return_scene))
@status_window.set_handler(:pagedown, method(:next_actor))
@status_window.set_handler(:pageup, method(:prev_actor))
end
def on_actor_change
@status_window.actor = @actor
@status_window.activate
end
def update
super
@status_window.update_scroll
end
end
#==============================================================================
# Scene_Equip
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#==============================================================================
class Scene_Equip < Scene_MenuBase
def start
super
create_help_window
create_status_window
create_command_window
create_slot_window
create_item_window
@help_window.y = - @help_window.height
@status_window.x = -@status_window.width
@command_window.x = Graphics.width
@slot_window.x = Graphics.width
@item_window.y = Graphics.height
@help_window.ssy(0,20)
@status_window.ssx(0,20)
@command_window.ssx(@status_window.width,20)
@slot_window.ssx(@status_window.width,20)
@item_window.ssy(@slot_window.y + @slot_window.height,20)
end
def update
super
@help_window.update_scroll
@status_window.update_scroll
@command_window.update_scroll
@slot_window.update_scroll
@item_window.update_scroll
end
end
#==============================================================================
# Scene_Skill
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#==============================================================================
class Scene_Skill < Scene_ItemBase
def start
super
create_help_window
create_command_window
create_status_window
create_item_window
@help_window.y = - @help_window.height
@command_window.x = -@command_window.width
@status_window.x = Graphics.width
@item_window.y = Graphics.height
@help_window.ssy(0,20)
@command_window.ssx(0,20)
@status_window.ssx(@command_window.width,20)
@item_window.ssy(@status_window.y + @status_window.height,20)
end
def update
super
@help_window.update_scroll
@command_window.update_scroll
@status_window.update_scroll
@item_window.update_scroll
end
end
class Scene_Item < Scene_ItemBase
def start
super
create_help_window
create_category_window
create_item_window
@help_window.y = -@help_window.height
@category_window.y = -(@help_window.height + @category_window.height)
@item_window.y = Graphics.height
@help_window.ssy(0,20)
@category_window.ssy(@help_window.height,30)
@item_window.ssy(@help_window.height + @category_window.height,20)
end
def update
super
@help_window.update_scroll
@category_window.update_scroll
@item_window.update_scroll
end
end
end
#==============================================================================
# Window_Message
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#==============================================================================
class Window_Message < Window_Base
if $USE_MESSAGE_IMAGE
def create_back_sprite
@back_sprite = Sprite.new
@back_sprite.bitmap = Bitmap.new(Graphics.width,Graphics.height)
@back_sprite.visible = (@background == 1)
background = Cache.system("MessageBack")
screen = Rect.new(0, 0, Graphics.width, background.height)
@back_sprite.bitmap.stretch_blt(screen, background, background.rect)
@back_sprite.z = 190
end
def update_back_sprite
@back_sprite.visible = (@background == 1)
@back_sprite.y = y - 26
@back_sprite.opacity = openness
@back_sprite.update
end
end
end
#===============================================================================
# Game Party.
#-------------------------------------------------------------------------------
class Game_Party < Game_Unit
def gain_gold(amount)
@gold = [[@gold + amount, 0].max, max_gold].min
Audio.se_play("Audio/SE/Shop",200)
end
end
#==============================================================================
# Fin del script.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#==============================================================================
NOTA:Agradecimientos a KHAS por su script de SMOOTH SLIDING.
Eso es todo espero que le sirva.