Help with javascript for Notetags

Hi


So what I need to know is how to use javascript in the lunatic mode to make certain changes to an item.


For example in Yanfly's Tips and Tricks "Duplicity Augments" he uses this line


"item.params[0] += 200;"


to increace the param 0 (Max HP) by the value of 200.


What I need to know is how traits, other than base parameters can be modified in a similar way,


for example how to change a weapon's attack element, how to give an armor resistance against a certain state, etc.


I think that those traits are probably stored in an array in a similar way to the "params array" but I can't seem to figure it out.


If anyone can help me, I would really appreciate it.
If you go into you folder/data youll find your games database. Go to items.json and you can see what all of it's traits are labeled.
If you go into you folder/data youll find your games database. Go to items.json and you can see what all of it's traits are labeled.

I'm already working on that but thanks anyway.


Ok I got it. To apply a trait we use the command


"item.traits.push({"code": x, "dataId": y, "value": z})"


To remove it we need to use to lines:


"var index = this.getMatchingTraitIndex(item, 32, 4, 10.0);" - to find the trait in the array


"item.traits.splice(index, 1);" - to remove the trait


My question is solved.


Thank you anyway. 🙂

Original thread: https://forums.rpgmakerweb.com/threads/help-with-javascript-for-notetags.70900/