Save Screen Symbols

Labyrinthine

Artist/ Developer
Veteran
Joined
Jun 23, 2014
Messages
454
Reaction score
403
First Language
Finnish
Primarily Uses
I was wondering whether it would be possible to toggle pictures on the save screen with a switch? For example, if I were to turn "Switch Water" ON, I would get a certain image appearing on the save screen. If I were to turn it off, the symbol would also vanish. 


The red square would be (probably) the place where I'd like the symbol to appear in each save slot. To elaborate- What I'm aiming at is that each one of the five elemental worlds would have a distinctive symbol in the save scene. So, if the player saves in the world of water, there would be a symbol of water in the save screen, etc.


 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
If each save file can only have one element, you would be better off using a variable and set it to 1=Water, 2=Fire, etc.


Then the question is, where are you going to have the images to be shown?  Will they be icons?


Are you using the default save script?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
Okay, add the following to a new script slot below that one:

Code:
module Shaz
  #--------------------------------------------------------------------------------------
  # CONFIGURATION
  #--------------------------------------------------------------------------------------
  ELEMENT_X = 0
  ELEMENT_Y = 0
  ELEMENT_VARIABLE = 0
end

module DataManager
  class << self
    alias shaz_make_save_header make_save_header
  end 
  
  def self.make_save_header
    header = shaz_make_save_header
    header[:element_icon] = $game_variables[ELEMENT_VARIABLE] if ELEMENT_VARIABLE > 0
  end
end

class Window_SaveFile 
  alias shaz_draw_custom_items draw_custom_items
  def draw_custom_items
    shaz_draw_custom_items
    header = DataManager.load_header(@file_index)
    return unless header && header[:element_icon]
    draw_icon(header[:element_icon], ELEMENT_X, ELEMENT_Y)
  end
end
Change the ELEMENT_VARIABLE to a variable id you have available (and make sure you give it a name so you don't accidentally use it anywhere).  At any time you want to assign an icon to show up in the save file, use Control Variables to set that variable id to the icon index you want to use.


Play around with the values of ELEMENT_X and ELEMENT_Y until you can get the icon in the right spot.


I notice the script you're using overwrites a lot of methods rather than aliasing and adding to them.  This means there's a good chance that it's going to cause compatibility problems with other scripts.  Make sure to have it as high up in the custom scripts list as possible (but still below Materials), in the hopes that any other script you're using aliases rather than overwrites.
 

Labyrinthine

Artist/ Developer
Veteran
Joined
Jun 23, 2014
Messages
454
Reaction score
403
First Language
Finnish
Primarily Uses
Thank you so much! I'm going to test run it ASAP. :)
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
If you have any issues (errors) just post the full error message, and let me know what's on the line it refers to.  I didn't test it.
 

Labyrinthine

Artist/ Developer
Veteran
Joined
Jun 23, 2014
Messages
454
Reaction score
403
First Language
Finnish
Primarily Uses
Uhm, I assigned the variable to 1000 and named it Element Icons. In one autorun even before the first save point I made a call like this: Control Variables: [1000 : Element Icons] = 2


Now when I try to save, some of the save slots are suddenly empty, and I can't save in any slot. It just gives me the buzzing sound o_O
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
oh - I left a line out.   Replace it with the following, and see if it makes a difference:

Code:
module Shaz
  #--------------------------------------------------------------------------------------
  # CONFIGURATION
  #--------------------------------------------------------------------------------------
  ELEMENT_X = 0
  ELEMENT_Y = 0
  ELEMENT_VARIABLE = 0
end

module DataManager
  class << self
    alias shaz_make_save_header make_save_header
  end 
  
  def self.make_save_header
    header = shaz_make_save_header
    header[:element_icon] = $game_variables[ELEMENT_VARIABLE] if ELEMENT_VARIABLE > 0
    header
  end
end

class Window_SaveFile 
  alias shaz_draw_custom_items draw_custom_items
  def draw_custom_items
    shaz_draw_custom_items
    header = DataManager.load_header(@file_index)
    return unless header && header[:element_icon]
    draw_icon(header[:element_icon], ELEMENT_X, ELEMENT_Y)
  end
end
 

Labyrinthine

Artist/ Developer
Veteran
Joined
Jun 23, 2014
Messages
454
Reaction score
403
First Language
Finnish
Primarily Uses
Not working... instead it seems to be erasing the save files altogether when I try to save the game in the save screen. It just gives the buzzing sound, and the next time I open the save screen the slot I tried to save over is empty. I also tried to use it in a clean project just in case, but the results are the same.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
If you try to save a game and there is something that can't be saved (like an event or $game_system having a sprite due to something that happened in a script), you will get the buzzing sound and the save file will be deleted.


Can you disable my script and see if you are able to save, then enable my script and see if the problem happens again?  Try to save from exactly the same place each time, after doing exactly the same steps.


I really don't see anything in the script I gave you that would cause the file to not be saved.  


Oh - you just put 1000, didn't you?  You didn't put 01000 or anything like that, with leading zeros?  That would probably cause a problem.  Can you show a screenshot of the script in your script editor?  I still don't think that would cause the buzzer sound or for save files to be deleted - I think something else is going on there.  What other scripts have you recently added?
 
Last edited by a moderator:

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
823
First Language
Hungarian
Primarily Uses
RMVXA
You forgot to add the module's name before your constant names (happens to me all the time too :D), that's why the save files are corrupted.


The method you aliased would crash the game because of that, but that rescue in the other method calling it will instead delete the save file and play the buzzer sound.


Just add the module name before them and it will work.


Shaz::ELEMENT_X


For example.
 

Labyrinthine

Artist/ Developer
Veteran
Joined
Jun 23, 2014
Messages
454
Reaction score
403
First Language
Finnish
Primarily Uses
You forgot to add the module's name before your constant names (happens to me all the time too :D), that's why the save files are corrupted.


The method you aliased would crash the game because of that, but that rescue in the other method calling it will instead delete the save file and play the buzzer sound.


Just add the module name before them and it will work.



Shaz::ELEMENT_X


For example.


Thanks for the info! However, I'm really bad at scripting -.- I'm not sure where in the script exactly should I put that?
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
You forgot to add the module's name before your constant names (happens to me all the time too :D), that's why the save files are corrupted.


You are brilliant!


Here is the (again) modified version.  Let us know how it goes this time:

Code:
module Shaz
  #--------------------------------------------------------------------------------------
  # CONFIGURATION
  #--------------------------------------------------------------------------------------
  ELEMENT_X = 0
  ELEMENT_Y = 0
  ELEMENT_VARIABLE = 0
end

module DataManager
  class << self
    alias shaz_make_save_header make_save_header
  end 
  
  def self.make_save_header
    header = shaz_make_save_header
    header[:element_icon] = $game_variables[Shaz::ELEMENT_VARIABLE] if Shaz::ELEMENT_VARIABLE > 0
    header
  end
end

class Window_SaveFile 
  alias shaz_draw_custom_items draw_custom_items
  def draw_custom_items
    shaz_draw_custom_items
    header = DataManager.load_header(@file_index)
    return unless header && header[:element_icon]
    draw_icon(header[:element_icon], Shaz::ELEMENT_X, Shaz::ELEMENT_Y)
  end
end
 

Labyrinthine

Artist/ Developer
Veteran
Joined
Jun 23, 2014
Messages
454
Reaction score
403
First Language
Finnish
Primarily Uses
Works like a dream now! Thank you so much for this script  :)  
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,047
Messages
1,018,540
Members
137,834
Latest member
EverNoir
Top