Mundo Maker
¡Bienvenid@ a Mundo Maker!

¿Quieres aprender todo sobre el RPG Maker?



Regístrate y forma parte de Mundo Maker.

Obligar a guardar partida

Ver el tema anterior Ver el tema siguiente Ir abajo

Obligar a guardar partida

Mensaje por -GNS- el 2009-08-04, 18:40

Hola bueno este es un script que te obliga aguardar la parti es decir al momento que entras al menu y le das a salir no te dejara salir amenos que guardes los datos
ojala les guste

Spoiler:
Código:
#==============================================================================
# ** Scene_ForceSave2
#------------------------------------------------------------------------------
#  This class performs save screen processing and there's no cancelling out.
#==============================================================================

class Scene_ForceSave2 < Scene_File
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super("Which file would you like to save to?")
end
#--------------------------------------------------------------------------
# * Decision Processing
#--------------------------------------------------------------------------
def on_decision(filename)
# Play save SE
$game_system.se_play($data_system.save_se)
# Write save data
file = File.open(filename, "wb")
write_save_data(file)
file.close
# If called from event
if $game_temp.save_calling
# Clear save call flag
$game_temp.save_calling = false
# Switch to map screen
$scene = Scene_Map.new
return
end
# Switch to map screen
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# * Cancel Processing
#--------------------------------------------------------------------------
def on_cancel
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# If called from event
if $game_temp.save_calling
# Clear save call flag
$game_temp.save_calling = false
# Will not go to menu. It will redirect to this scene until the player has saved.
$scene = Scene_ForceSave2.new
return
end
# Will not go to menu.
$scene = Scene_ForceSave2.new
end
#--------------------------------------------------------------------------
# * Write Save Data
#   file : write file object (opened)
#--------------------------------------------------------------------------
def write_save_data(file)
# Make character data for drawing save file
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
end
# Write character data for drawing save file
Marshal.dump(characters, file)
# Wrire frame count for measuring play time
Marshal.dump(Graphics.frame_count, file)
# Increase save count by 1
$game_system.save_count += 1
# Save magic number
# (A random value will be written each time saving with editor)
$game_system.magic_number = $data_system.magic_number
# Write each type of game object
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
end
end
Para llamar al script solo pongan:$scene = Scene_ForceSave2
despues pongan esperar unos frames, gracias :)

-GNS-
Baneado

3/3

Créditos 230

Gracias : -2

Volver arriba Ir abajo

Ver el tema anterior Ver el tema siguiente Volver arriba


Permisos de este foro:
No puedes responder a temas en este foro.