ok well my post is fixed i hope sombody will like it
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Game_System
#--------------------------------------------------------------------------
# * Variables Globales
#--------------------------------------------------------------------------
attr_reader :map_interpreter # Int�rprete de eventos en mapa
attr_reader :battle_interpreter # Int�rprete de eventos en batalla
attr_accessor :timer # Temporizador
attr_accessor :timer_working # Temporizador funcionando
attr_accessor :save_disabled # Llamada a Guardar deshabilitado
attr_accessor :menu_disabled # Llamada a Men� deshabilitado
attr_accessor :encounter_disabled # Encuentro de enemigos deshabilitado
attr_accessor :message_position # Opci�n de Mensaje:Posici�n de la Ventana
attr_accessor :message_frame # Opci�n de Mensaje: Marco
attr_accessor :save_count # Contador de Partidas Guardadas
attr_accessor :magic_number # N�mero de Magia
attr_accessor :unshowedphotos
attr_reader :photos
#--------------------------------------------------------------------------
# * Inicio de Objetos (Aqu� se agrega el valor inicial a cada variable)
#--------------------------------------------------------------------------
def initialize
@map_interpreter = Interpreter.new(0, true)
@battle_interpreter = Interpreter.new(0, false)
@timer = 0
@timer_working = false
@save_disabled = false
@menu_disabled = false
@encounter_disabled = false
@message_position = 2
@message_frame = 0
@save_count = 0
@magic_number = 0
@photos = ['1.jpg','2.jpg','4.jpg',5jpg','6.jpg','7.jpg','8.jpg']
@unshowedphotos = @photos
end
#--------------------------------------------------------------------------
# * Play Background Music
# bgm : background music to be played
#--------------------------------------------------------------------------
def bgm_play(bgm)
@playing_bgm = bgm
if bgm != nil and bgm.name != ""
Audio.bgm_play("Audio/BGM/" + bgm.name, bgm.volume, bgm.pitch)
else
Audio.bgm_stop
end
Graphics.frame_reset
end
#--------------------------------------------------------------------------
# * Stop Background Music
#--------------------------------------------------------------------------
def bgm_stop
Audio.bgm_stop
end
#--------------------------------------------------------------------------
# * Fade Out Background Music
# time : fade-out time (in seconds)
#--------------------------------------------------------------------------
def bgm_fade(time)
@playing_bgm = nil
Audio.bgm_fade(time * 1000)
end
#--------------------------------------------------------------------------
# * Background Music Memory
#--------------------------------------------------------------------------
def bgm_memorize
@memorized_bgm = @playing_bgm
end
#--------------------------------------------------------------------------
# * Restore Background Music
#--------------------------------------------------------------------------
def bgm_restore
bgm_play(@memorized_bgm)
end
#--------------------------------------------------------------------------
# * Play Background Sound
# bgs : background sound to be played
#--------------------------------------------------------------------------
def bgs_play(bgs)
@playing_bgs = bgs
if bgs != nil and bgs.name != ""
Audio.bgs_play("Audio/BGS/" + bgs.name, bgs.volume, bgs.pitch)
else
Audio.bgs_stop
end
Graphics.frame_reset
end
#--------------------------------------------------------------------------
# * Fade Out Background Sound
# time : fade-out time (in seconds)
#--------------------------------------------------------------------------
def bgs_fade(time)
@playing_bgs = nil
Audio.bgs_fade(time * 1000)
end
#--------------------------------------------------------------------------
# * Background Sound Memory
#--------------------------------------------------------------------------
def bgs_memorize
@memorized_bgs = @playing_bgs
end
#--------------------------------------------------------------------------
# * Restore Background Sound
#--------------------------------------------------------------------------
def bgs_restore
bgs_play(@memorized_bgs)
end
#--------------------------------------------------------------------------
# * Play Music Effect
# me : music effect to be played
#--------------------------------------------------------------------------
def me_play(me)
if me != nil and me.name != ""
Audio.me_play("Audio/ME/" + me.name, me.volume, me.pitch)
else
Audio.me_stop
end
Graphics.frame_reset
end
#--------------------------------------------------------------------------
# * Play Sound Effect
# se : sound effect to be played
#--------------------------------------------------------------------------
def se_play(se)
if se != nil and se.name != ""
Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
end
end
#--------------------------------------------------------------------------
# * Stop Sound Effect
#--------------------------------------------------------------------------
def se_stop
Audio.se_stop
end
#--------------------------------------------------------------------------
# * Get Playing Background Music
#--------------------------------------------------------------------------
def playing_bgm
return @playing_bgm
end
#--------------------------------------------------------------------------
# * Get Playing Background Sound
#--------------------------------------------------------------------------
def playing_bgs
return @playing_bgs
end
#--------------------------------------------------------------------------
# * Get Windowskin File Name
#--------------------------------------------------------------------------
def windowskin_name
if @windowskin_name == nil
return $data_system.windowskin_name
else
return @windowskin_name
end
end
#--------------------------------------------------------------------------
# * Set Windowskin File Name
# windowskin_name : new windowskin file name
#--------------------------------------------------------------------------
def windowskin_name=(windowskin_name)
@windowskin_name = windowskin_name
end
#--------------------------------------------------------------------------
# * Get Battle Background Music
#--------------------------------------------------------------------------
def battle_bgm
if @battle_bgm == nil
return $data_system.battle_bgm
else
return @battle_bgm
end
end
#--------------------------------------------------------------------------
# * Set Battle Background Music
# battle_bgm : new battle background music
#--------------------------------------------------------------------------
def battle_bgm=(battle_bgm)
@battle_bgm = battle_bgm
end
#--------------------------------------------------------------------------
# * Get Background Music for Battle Ending
#--------------------------------------------------------------------------
def battle_end_me
if @battle_end_me == nil
return $data_system.battle_end_me
else
return @battle_end_me
end
end
#--------------------------------------------------------------------------
# * Set Background Music for Battle Ending
# battle_end_me : new battle ending background music
#--------------------------------------------------------------------------
def battle_end_me=(battle_end_me)
@battle_end_me = battle_end_me
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# reduce timer by 1
if @timer_working and @timer > 0
@timer -= 1
end
end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs map screen processing.
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make sprite set
@spriteset = Spriteset_Map.new
# Make message window
@message_window = Window_Message.new
################################################################################1
@window_photo = Window_Photo.new
@window_photo.visible = false
@window_photo.active = false
$photo = 0
################################################################################2
# Transition run
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of sprite set
@spriteset.dispose
# Dispose of message window
@message_window.dispose
# If switching to title screen
if $scene.is_a?(Scene_Title)
# Fade out screen
Graphics.transition
Graphics.freeze
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
################################################################################1
if @window_photo.active == true
if Input.trigger?(Input::C) or Input.trigger?(Input::B)
$photo = 0
@window_photo.visible = false
@window_photo.active = false
end
else
################################################################################2
# Loop
loop do
# Update map, interpreter, and player order
# (this update order is important for when conditions are fulfilled
# to run any event, and the player isn't provided the opportunity to
# move in an instant)
$game_map.update
$game_system.map_interpreter.update
$game_player.update
# Update system (timer), screen
$game_system.update
$game_screen.update
# Abort loop if player isn't place moving
unless $game_temp.player_transferring
break
end
# Run place move
transfer_player
# Abort loop if transition processing
if $game_temp.transition_processing
break
end
end
# Update sprite set
@spriteset.update
# Update message window
@message_window.update
# If game over
if $game_temp.gameover
# Switch to game over screen
$scene = Scene_Gameover.new
return
end
# If returning to title screen
if $game_temp.to_title
# Change to title screen
$scene = Scene_Title.new
return
end
# If transition processing
if $game_temp.transition_processing
# Clear transition processing flag
$game_temp.transition_processing = false
# Execute transition
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# If showing message window
if $game_temp.message_window_showing
return
end
# If encounter list isn't empty, and encounter count is 0
if $game_player.encounter_count == 0 and $game_map.encounter_list != []
# If event is running or encounter is not forbidden
unless $game_system.map_interpreter.running? or
$game_system.encounter_disabled
# Confirm troop
n = rand($game_map.encounter_list.size)
troop_id = $game_map.encounter_list[n]
# If troop is valid
if $data_troops[troop_id] != nil
# Set battle calling flag
$game_temp.battle_calling = true
$game_temp.battle_troop_id = troop_id
$game_temp.battle_can_escape = true
$game_temp.battle_can_lose = false
$game_temp.battle_proc = nil
end
end
end
# If B button was pressed
if Input.trigger?(Input::B)
# If event is running, or menu is not forbidden
unless $game_system.map_interpreter.running? or
$game_system.menu_disabled
# Set menu calling flag or beep flag
$game_temp.menu_calling = true
$game_temp.menu_beep = true
end
end
# If debug mode is ON and F9 key was pressed
if $DEBUG and Input.press?(Input::F9)
# Set debug calling flag
$game_temp.debug_calling = true
end
################################################################################1
if $photo == 0
@window_photo.visible = false
@window_photo.active = false
elsif $photo == 1
@window_photo.refresh
$photo = 2
elsif $photo == 2
@window_photo.visible = true
@window_photo.active = true
end
################################################################################2
# If player is not moving
unless $game_player.moving?
# Run calling of each screen
if $game_temp.battle_calling
call_battle
elsif $game_temp.shop_calling
call_shop
elsif $game_temp.name_calling
call_name
elsif $game_temp.menu_calling
call_menu
elsif $game_temp.save_calling
call_save
elsif $game_temp.debug_calling
call_debug
end
end
################################################################################1
end
################################################################################2
end
#--------------------------------------------------------------------------
# * Battle Call
#--------------------------------------------------------------------------
def call_battle
# Clear battle calling flag
$game_temp.battle_calling = false
# Clear menu calling flag
$game_temp.menu_calling = false
$game_temp.menu_beep = false
# Make encounter count
$game_player.make_encounter_count
# Memorize map BGM and stop BGM
$game_temp.map_bgm = $game_system.playing_bgm
$game_system.bgm_stop
# Play battle start SE
$game_system.se_play($data_system.battle_start_se)
# Play battle BGM
$game_system.bgm_play($game_system.battle_bgm)
# Straighten player position
$game_player.straighten
# Switch to battle screen
$scene = Scene_Battle.new
end
#--------------------------------------------------------------------------
# * Shop Call
#--------------------------------------------------------------------------
def call_shop
# Clear shop call flag
$game_temp.shop_calling = false
# Straighten player position
$game_player.straighten
# Switch to shop screen
$scene = Scene_Shop.new
end
#--------------------------------------------------------------------------
# * Name Input Call
#--------------------------------------------------------------------------
def call_name
# Clear name input call flag
$game_temp.name_calling = false
# Straighten player position
$game_player.straighten
# Switch to name input screen
$scene = Scene_Name.new
end
#--------------------------------------------------------------------------
# * Menu Call
#--------------------------------------------------------------------------
def call_menu
# Clear menu call flag
$game_temp.menu_calling = false
# If menu beep flag is set
if $game_temp.menu_beep
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Clear menu beep flag
$game_temp.menu_beep = false
end
# Straighten player position
$game_player.straighten
# Switch to menu screen
$scene = Scene_Menu.new
end
#--------------------------------------------------------------------------
# * Save Call
#--------------------------------------------------------------------------
def call_save
# Straighten player position
$game_player.straighten
# Switch to save screen
$scene = Scene_Save.new
end
#--------------------------------------------------------------------------
# * Debug Call
#--------------------------------------------------------------------------
def call_debug
# Clear debug call flag
$game_temp.debug_calling = false
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Straighten player position
$game_player.straighten
# Switch to debug screen
$scene = Scene_Debug.new
end
#--------------------------------------------------------------------------
# * Player Place Move
#--------------------------------------------------------------------------
def transfer_player
# Clear player place move call flag
$game_temp.player_transferring = false
# If move destination is different than current map
if $game_map.map_id != $game_temp.player_new_map_id
# Set up a new map
$game_map.setup($game_temp.player_new_map_id)
end
# Set up player position
$game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
# Set player direction
case $game_temp.player_new_direction
when 2 # down
$game_player.turn_down
when 4 # left
$game_player.turn_left
when 6 # right
$game_player.turn_right
when 8 # up
$game_player.turn_up
end
# Straighten player position
$game_player.straighten
# Update map (run parallel process event)
$game_map.update
# Remake sprite set
@spriteset.dispose
@spriteset = Spriteset_Map.new
# If processing transition
if $game_temp.transition_processing
# Clear transition processing flag
$game_temp.transition_processing = false
# Execute transition
Graphics.transition(20)
end
# Run automatic change for BGM and BGS set on the map
$game_map.autoplay
# Frame reset
Graphics.frame_reset
# Update input information
Input.update
end
end
class Window_Photo < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
@photos = ['1.jpg','2.jpg','4.jpg',5jpg','6.jpg','7.jpg','8']
@usedphotos = [21]
choose
#@bitmap = @photos[rand(@photos.length)]
#@usedphotos.push(@bitmap)
@showedphoto = RPG::Cache.picture(@bitmap)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
choose
@showedphoto = RPG::Cache.picture(@bitmap)
self.contents.blt(x, y, @showedphoto, Rect.new(0, 0, 640, 480), 255)
end
def choose
@bitmap = @photos[rand(@photos.length)]
@usedphotos.push(@bitmap)
end
end
class Window_Photo < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
#$photos = ['photo1', 'photo2', 'photo3', 'photo4']
#@unshowedphotos = $photos
@bitmap = ""
@showedphoto = RPG::Cache.picture(@bitmap)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
if $photo == 1 or $photo == 2
choose
@showedphoto = RPG::Cache.picture(@bitmap)
self.contents.blt(x, y, @showedphoto, Rect.new(0, 0, 640, 480), 255)
end
end
def choose
@bitmap = $game_system.unshowedphotos[rand($game_system.unshowedphotos.length) - 1]
begin
@delphoto = $game_system.unshowedphotos.rindex(@bitmap)
$game_system.unshowedphotos.slice!(@delphoto)
rescue
print "No more pictures"
@bitmap = ""
end
end
end