Storing modified array in savefile for Yanfly's Learn Skill Engine

Hello RGSS3-savvy folks, I'd like to request a modification/add-on for Yanfly's Learn Skill Engine.
The script allows the user to create a list of skills the actor can learn by spending points earned in battle, however if I add a skill to an actor's skill list via Script Call $game_actors[x].class.learn_skills.push(y) the updated list doesn't get saved.
 
So could anyone figure out how to store the updated skill list in the savefile? Thanks in advance.
It's modifying the class, so you should be saving the class into the save file too... IDK if that's a good idea though, I can't check without RM on my side...

A quicker way (maybe) is that instead of trying to modify the list on the fly, just utilize the 

<learn require eval>tag... 

or the 

<learn require switch: x>Like if in one part of the game you should be adding the skill to the list, just activate a switch and use that switch on the learn require switch tag... If you need other conditions, better use the learn require eval tag..

This way you can still achieve "adding skills on the fly", while not tampering with the save file. 

PS: I always thought that all members/attributes inside the $game_actors object would be saved into the save file since you save $game_actors into the save file... 
That would be a perfectly viable solution if there were only one actor and one handful of skills to add, then all I would need would be enough available Switch slots. However I mean to make more than a couple dozens skills available to learn to anyone in a group of 6-8 actors (in place of x and y in my Script Call I just use two variables) and thus I would need to have 6-8 switches for every skill, this would require hundreds of switches...

Of course it's still doable, but I hoped I could streamline the process instead of having hundreds of Conditional Branches checking hundreds of switches.
You could always use the <learn require eval> and use custom conditions though... You could also make a hash into $game_system and use that. It will be saved as $game_system is saved into the save file...

so like

class Game_System    attr_accessor :skills_hash   alias initialize_add_skills initialize  def initialize    initialize_add_skills    @skills_hash = {}  endendthen do something like this on the notetag

<learn require eval>  $game_system.skills_hash[@actor.id,skill_id]</learn require eval>and change skill_id to the ID of the skill,

then when you want to activate this skill (skill 1 for example) for Actor 1

Script Call: $game_system.skills_hash[1,1] = truePS: It's untested. 🙂

PS 2: I just have some reservations about saving the class data, which I cannot check right now because I don't have RM here at work. Also, saving it means that if you decide to edit the classes later on, those changes won't be reflected anymore.
Would <learn require eval> work just like the text field of Script Calls? The conditional branches would be for checking the two variables and turning the correct switch on.

I determine the skill ID by checking the map notetags, then store the ID in the first variable, then a simple show choice command to chose the party member, then store the actor ID in the second variable, then I use those two variables in the script call of the first post. It's all in one common event so I can just reuse the same text settings and choices.

EDIT: Whoops, posted before seeing your edit, I'm gonna try that.
Would <learn require eval> work just like the text field of Script Calls?
Yes, it will run any valid script calls.

The codes I posted above might work. You could even use three keys instead of two for the hash so that you can also account for the class.

I really just don't suggest saving database-based objects that aren't saved by default to avoid some problems down the line, after all they weren't saved for a reason. 🙂
Three keys you say? Probably that's why it gives this error?

Error_Learn_Skill.png

 
If I use three keys as in $game_system.skills_hash[1,1,1] = true the the error is <4 for 2>.

With just one key nothing happens.
ah wait, I think you'd need to make the key as an array... It only takes 1 key, I forgot...

it should be

$game_system.skills_hash[[1,1,1]]

Been awake since 6AM yesterday, and is currently on work. The effects seem to show. :3

PS: I have made a script in the past that saves all the other database objects, but it seems to be archived now and I can't find it..
Nothing happens.
where did you use it? and did you set up the notetags etc?

anyway, here's the last resort... to be used in times of real need.

Code:
module DataManagerclass <<self; alias make_save_contents_adik_rawr make_save_contents; enddef self.make_save_contentscontents = make_save_contents_adik_rawrcontents[:classes] = $data_classescontentsendclass <<self; alias extract_save_contents_adik_rawr extract_save_contents; enddef self.extract_save_contents(contents)extract_save_contents_adik_rawr(contents)$data_classes = contents[:classes]endend
The script call I just used in a random event, put the <learn require eval> thing in skill 1 notebox, changed skill_id to 1, pasted the class Game_System thing in the script editor. I didn't use variables but just actor1/class1/skill1.

anyway, here's the last resort... to be used in times of real need.
This is real need. Game making is srs bsns  😎

Gonna try this!

EDIT: Works!
I just hope it doesn't break something in your game... Take note that it means that any future updates on the classes won't reflect on saved files.
Let's hope so! in case that happens there's still good old method of eventing a bajillion conditional branches...sigh
By future updates on the classes you mean modifying the database tab?
 
Thanks a lot for the help Adiktuzmiko.
Yup, since the saved games will now load the classed data from the save file itself instead of the database... Any changes made in the database will only affect new playthrus. And oh, you won't be able to load files made before adding that script. As it won't find the saved data for classes.

Original thread: https://forums.rpgmakerweb.com/threads/storing-modified-array-in-savefile-for-yanflys-learn-skill-engine.35377/