How are item effects represented in the JavaScript? I have been trying to figure out how to choose which aspects of an item are randomized when using Yanfly's independent items. I have already read through Yanfly's plugin's code and did not see anything there about it. Although, maybe I missed it. Some of the effects that I care about the most are HP and MP recovery and Damage. I am currently reading through the rpg_core.js and have not found anything yet. Although I am only about 1/3 of the way through and by no means understand it all. If anyone could show me where I could find the names used for these properties in the script.
How are item effects represented in the JavaScript?
Learning JavascriptYou won't find a definition of an effect in the JavaScript files - they're just a plain object with four fixed keys. (Technically, only the "code" key matters, you could dump anything you want in there if you defined a custom code, as I've done a few times.)
It is documented however - if you open the user manual (Help -> Contents) and scroll down the bottom, there is a "JS Library" section. Expand that, scroll down almost to the bottom, and click on "~ Effect". In general the entries beginning with a "~" describe the format of the database objects, while other entries are the classes defined in the JavaScript files.
In the case of effects, the "code" key is a magic value describing the type of the effect. These magic values are listed in the JavaScript files - search "function Game_Action" in rpg_objects.cpp and you should find the list.
It is documented however - if you open the user manual (Help -> Contents) and scroll down the bottom, there is a "JS Library" section. Expand that, scroll down almost to the bottom, and click on "~ Effect". In general the entries beginning with a "~" describe the format of the database objects, while other entries are the classes defined in the JavaScript files.
In the case of effects, the "code" key is a magic value describing the type of the effect. These magic values are listed in the JavaScript files - search "function Game_Action" in rpg_objects.cpp and you should find the list.
Thank you for your help.
Original thread: https://forums.rpgmakerweb.com/threads/how-are-item-effects-represented-in-the-javascript.122697/