MV Adding object to object

Hello!

I am trying to add certain properties to $dataSkills[x].myProp

I just can't seem to figure it out. For pictures I did like below.
Game_Picture.prototype.imgPath = function(imgId).

But I do not know how to do the same for $dataSkills...

Thanks in advance!

Best regards,
Moved to: Learning Javascript

$dataSkills is an array, not an object, and the elements in the array are not set up with class functions like Game_Picture.

Additionally, $dataSkills will be overwritten every time you save your project in the editor, and do not persist in the save file - it is read when you launch your game and any changes you make will affect the current game, any new games started during the current play session, and any saved games continued during the current play session.

If you just want to add some new static/constant parameters, you can either put them in notes, and they will be loaded into the $dataSkills[x].meta["myProp"] property (I think that syntax is right, but I haven't confirmed), or you will have to write a DataManager function to call out to when Skills.json is read.
Moved to: Learning Javascript

$dataSkills is an array, not an object, and the elements in the array are not set up with class functions like Game_Picture.

Additionally, $dataSkills will be overwritten every time you save your project in the editor, and do not persist in the save file - it is read when you launch your game and any changes you make will affect the current game, any new games started during the current play session, and any saved games continued during the current play session.

If you just want to add some new static/constant parameters, you can either put them in notes, and they will be loaded into the $dataSkills[x].meta["myProp"] property (I think that syntax is right, but I haven't confirmed), or you will have to write a DataManager function to call out to when Skills.json is read.
My skills are created in google sheets and then transferred into my .js plugin. So it doesn't matter too much that it doesn't save since I anyways run my skill-initializer every time the game loads what I want to add is essentially flags to see if the skill only applies an effect.
So like $dataSkills.onlyEffect == true.

And there might be quite a lot of flags that could be useful. The notes might work tho.

But I might try the Datamanager fuction, can't get better if I don't dive into every challenge lol

I am also curious, is there anything wrong with just editing the skills.json directly? The format in there seems very straight forward.

Best regards,
I am also curious, is there anything wrong with just editing the skills.json directly? The format in there seems very straight forward.
Try it and see.

What I expect is that you will spend a lot of time editing it, trying to get it in the right format, and either your skills file will be corrupted so your project won't load, or it will load successfully but as soon as you save (in the editor) it will replace the file and your additions will be lost.

If you are only after a true/false value, I'd definitely go the note tag route. Then you can refer to it using $dataSkills[x].meta["onlyEffect"] or maybe $dataSkills[x].meta.onlyEffect which will both return true if you have this note tag:
<onlyEffect>
and false if you don't.

Original thread: https://forums.rpgmakerweb.com/threads/adding-object-to-object.138005/