Jump to content
Rpg²S Forum
  • 0

Caricare dal menù


Squall_Leonheart
 Share

Question

Salve,sono qui per chiedervi come modificare lo scene_load in modo da permettere di caricare anche dal menù...Richiamandola con $scene_load.new,una volta entrati se premo esc torna al titolo al posto del menù...Siccome uso la stessa scene anche dal titolo volevo chiedervi se era possibile modificarla evitando di creare una scene load solo per il menù...

 

Ecco la scene_load:

#==============================================================================# ** Scene_Load#------------------------------------------------------------------------------#  This class performs load screen processing.#============================================================================== class Scene_Load < Scene_File  #--------------------------------------------------------------------------  # * Object Initialization  #--------------------------------------------------------------------------  def initialize	# Remake temporary object	$game_temp = Game_Temp.new	# Timestamp selects new file	$game_temp.last_file_index = 0	latest_time = Time.at(0)	for i in 0..3	  filename = make_filename(i)	  if FileTest.exist?(filename)		file = File.open(filename, "r")		if file.mtime > latest_time		  latest_time = file.mtime		  $game_temp.last_file_index = i		end		file.close	  end	end	super("Quale slot vuoi caricare?")  end  #--------------------------------------------------------------------------  # * Decision Processing  #--------------------------------------------------------------------------  def on_decision(filename)	# If file doesn't exist	unless FileTest.exist?(filename)	  # Play buzzer SE	  $game_system.se_play($data_system.buzzer_se)	  return	end	# Play load SE	$game_system.se_play($data_system.load_se)	# Read save data	file = File.open(filename, "rb")	read_save_data(file)	file.close	# Restore BGM and BGS	$game_system.bgm_play($game_system.playing_bgm)	$game_system.bgs_play($game_system.playing_bgs)	# Update map (run parallel process event)	$game_map.update	# 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)	# Switch to title screen	$scene = Scene_Title.new  end  #--------------------------------------------------------------------------  # * Read Save Data  #	 file : file object for reading (opened)  #--------------------------------------------------------------------------  def read_save_data(file)	# Read character data for drawing save file	characters = Marshal.load(file)	# Read frame count for measuring play time	Graphics.frame_count = Marshal.load(file)	# Read each type of game object	$game_system		= Marshal.load(file)	$game_switches	  = Marshal.load(file)	$game_variables	 = Marshal.load(file)	$game_self_switches = Marshal.load(file)	$game_screen		= Marshal.load(file)	$game_actors		= Marshal.load(file)	$game_party		 = Marshal.load(file)	$game_troop		 = Marshal.load(file)	$game_map		   = Marshal.load(file)	$game_player		= Marshal.load(file)	Marshal.load($max_picture,file)	# If magic number is different from when saving	# (if editing was added with editor)	if $game_system.magic_number != $data_system.magic_number	  # Load map	  $game_map.setup($game_map.map_id)	  $game_player.center($game_player.x, $game_player.y)	end	# Refresh party members	$game_party.refresh  endend

 

Credo che la modifica và fatta del def on_cancel..

Iscriviti sul mio canale youtube -

https://www.youtube.com/channel/UCYOxXExvlXiOFfYD1fTFpww?view_as=subscriber

Seguimi su Instagram -

https://www.instagram.com/ancestralguitarist/

---------------------------------------------------------------------------------------------------------------------------------------
Contest vinti
---------------------------------------------------------------------------------------------------------------------------------------

FACE CONTEST # 3
BANNER CONTEST #69

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Io farei così: modifica la scene title e la scene menu in modo che quando si accede alla schermata di caricamento una varaibile assuma un certo valore, ad esempio $var= 1 per il title e $var = 2 per il menu.

Nella Scene_Load poi metti un if in on_cancel che controlla il valore della variabile e ti porta al title o al menu a seconda del valore. (non l'ho testato ma dovrebbe andare...)

Link to comment
Share on other sites

  • 0
Si ci avevo pensato...Volevo evitare però di usare una variabile..

Iscriviti sul mio canale youtube -

https://www.youtube.com/channel/UCYOxXExvlXiOFfYD1fTFpww?view_as=subscriber

Seguimi su Instagram -

https://www.instagram.com/ancestralguitarist/

---------------------------------------------------------------------------------------------------------------------------------------
Contest vinti
---------------------------------------------------------------------------------------------------------------------------------------

FACE CONTEST # 3
BANNER CONTEST #69

Link to comment
Share on other sites

  • 0
Copia e incolla il codice e al posto di scene_load metti metti scene_load2 e metti nell'input B del def update al posto di scene_title, scene_menu.

Per qualsiasi motivo non aprite questo spoiler.

 

 

Ho detto di non aprirlo !

 

 

Se lo apri ancora esplode il mondo.

 

 

Aaaaaa è un vizio.

 

 

Contento? Il mondo è esploso, sono tutti morti

per colpa della tua curiosità .

 

 

Vuoi che ti venga anche il morbillo, la varicella e l'AIDS???

 

 

O bravo ora sei un malato terminale e nessuno

ti puo curare, sono tutti morti !

 

 

Se clicchi ancora una volta il PC esplode.

 

 

E dai smettila !!

 

Uff!! Hai cliccato tante volte che ho dovuto sostituirlo con un codebox.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

http://s8.postimg.org/yntv9nxld/Banner.png

http://img204.imageshack.us/img204/8039/sccontest3octpl3.gif

Link to comment
Share on other sites

  • 0
Ho già risolto con la variabile...Come dicevi te creavo uno script in + inutile..

Iscriviti sul mio canale youtube -

https://www.youtube.com/channel/UCYOxXExvlXiOFfYD1fTFpww?view_as=subscriber

Seguimi su Instagram -

https://www.instagram.com/ancestralguitarist/

---------------------------------------------------------------------------------------------------------------------------------------
Contest vinti
---------------------------------------------------------------------------------------------------------------------------------------

FACE CONTEST # 3
BANNER CONTEST #69

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...