[VX Ace] Keeping object data when saving (without using lots of switches)

I recognize what the problem here is, and the code otherwise works fine, so I'm not asking for the problem, just a solution.

The setup

One member of the party is a telepath and has an ability called "Detect". This is an enemy scan that first shows stats for the individual monster, and then has a follow-up where the telepath describes the monster, gives suggestions on strategy, describes its attacks, and so on, which is customized to each monster.

That part works exactly the way I want it to. I do not need help with that part.

If you use Detect on a monster type that you have already used it on in the past, the telepath gives the individual stats and then says (paraphrased) "I've described one of these before. Want to hear it again?" Say yes and she repeats the follow-up for that monster. Say no and she doesn't.

The problem

This part seemed to work just fine... until I realized that this doesn't save properly. She only remembers whether she described the monster in the current session - if you save, completely close the game, and completely re-open it, she'll forget she ever used Detect on anything.

On the flip side, if you, say, use Detect on a boss, get a Game Over, re-start the save (from before you fought the boss), and use Detect on the boss again, she'll insist that she has talked about that boss even though there's logically no way she should know that.

I recognize that the reason for this is because I set a has_scanned? flag on the enemy object in my Ruby script, and the Save/Load function doesn't actually pay any attention to that since it's not exactly built-in.

One solution would be to use Switches, but that carries the problem that I'd need to devote one switch per monster type on that - and I currently have no idea how many monster types there could be. Potentially hundreds! And I'd need to be careful to have no collisions with the other switches I'm using, which is hardly a simple matter when I haven't yet worked out how many monsters there are or how many non-"I've used Detect on this monster" switches I'll need yet. All in all, it would be the exact sort of hassle I was hoping to avoid by using a Ruby script in the first place!

Obvious other solutions would be "always have the telepath ask" or "never have the telepath ask", but is there another more elegant solution I'm overlooking?
Mayhap set something up like the following :

Code:
#==============================================================================# ** Game_Party#==============================================================================class Game_Party < Game_Unit  #--------------------------------------------------------------------------  # * Public Instance Variables  #--------------------------------------------------------------------------  attr_accessor   :detect_monster    #--------------------------------------------------------------------------  # * ALIAS - Object Initialization  #--------------------------------------------------------------------------  unless method_defined?(:detect_UnDEMHZo_gp_initialize)    alias_method(:detect_UnDEMHZo_gp_initialize, :initialize)  end      def initialize(*args, &block)    detect_UnDEMHZo_gp_initialize(*args, &block)        init_detect_monster  end    #--------------------------------------------------------------------------  # * NEW - Initialize Detect Hash  #--------------------------------------------------------------------------  def init_detect_monster    @detect_monster = {}  end    #--------------------------------------------------------------------------  # * NEW - Add Detected Monster  #--------------------------------------------------------------------------  def detect_add(enemy_id, succ_fail)    @detect_monster[enemy_id] = succ_fail  end    #--------------------------------------------------------------------------  # * NEW - Monster Detected?  #--------------------------------------------------------------------------  def detected?(enemy_id)    @detect_monster.has_key?(enemy_id)  end  end
Since $game_party is a part of the save file, you can keep a running database of what monsters have been detected.
Ah, of course. I can work with that. I'll try it out. Thanks.

EDIT: Perfect, so far appears to work like a charm. I'll have to remember storing data in $game_party in the future if I do anything else like this. Thanks a ton!
You could also just make it an array, where you push the id of the enemies encountered.

Original thread: https://forums.rpgmakerweb.com/threads/vx-ace-keeping-object-data-when-saving-without-using-lots-of-switches.40708/