MV How to Set Traits Through Scripts?

Hello again!

So, it's kinda a continuation of this post.

After seeing this HimeWorks plugin, it turned out to me that checking for a Trait instead of a State would do better for my script.

The question is, how can I check and add/remove Traits directly through a script?
Traits are stored as an array of Trait objects. If you do a grep for "trait" in your js folder you'll find all of the methods about looking for them and the various kinds of calculations the engine does when asked to reference them.

You can also go to the MV library I linked you before, click into the Game_Actor object on the right, and look at everything in there that says "trait."

The trick is that traits are stored in the database, so you adding your own or changing their values won't be saved when the player closes the game.

A number of people (I think Shaz and Galv) have written dynamic traits plugins.
Thanks again ATT_Turan!

The trick is that traits are stored in the database, so you adding your own or changing their values won't be saved when the player closes the game.

Well, for what I'm trying to do, I won't need them to be kept after battle. The idea is that I can add a Trait to the State only during the battle, then, it will be removed right after.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-set-traits-through-scripts.153264/