Script Call to Increase a Variable

Is there any way/script call so that when an enemy attacks you or vice versa, it increases a Variable?
Yanfly's Skill Core can help you do it: http://yanfly.moe/2015/10/13/yep-8-skill-core/
Just put some simple javascript codes into <Pre-Damage Eval> from lunatic mode and you will be fine.
Or add a common event into skill's traits and this common event will have one command.
Yanfly's Skill Core can help you do it: http://yanfly.moe/2015/10/13/yep-8-skill-core/
Just put some simple javascript codes into <Pre-Damage Eval> from lunatic mode and you will be fine.
How exactly do I do that? I'm not that "literate" in Javascript. What lines of code/variables do I have to input?
For your skill that you want to change the value of a variable upon use, put this into its note box. It will run the codes when damage is inflicted (or if it deals no damage, those codes will run after you use the skill):
Code:
<Pre-Damage Eval>
//For example, i want to add 1 to my Variable 9 everytime this skill is used. Change 9 into whatever you want.
$gameVariables.setValue(9, $gameVariables.value(9) + 1);
</Pre-Damage Eval>
For your skill that you want to change the value of a variable upon use, put this into its note box. It will run the codes when damage is inflicted (or if it deals no damage, those codes will run after you use the skill):
Code:
<Pre-Damage Eval>
//For example, i want to add 1 to my Variable 9 everytime this skill is used. Change 9 into whatever you want.
$gameVariables.setValue(9, $gameVariables.value(9) + 1);
</Pre-Damage Eval>
How about increasing a variable everytime an enemy attacks you?
Just do the same to enemy's attack skill.
Just do the same to enemy's attack skill.
Ok thanks for the help, but let me ask one last thing. Is there script call that determines what ARMOR TYPE the player equips? I'm gonna use it as a Conditional Branch, so when an enemy attacks my player it will determine which skill to increase. For example, if my player has LIGHT ARMOR equipped, the LIGHT armor variable will increase. But if the player equips HEAVY ARMOR the enemy's attack will increase the HEAVY armor variable.
Unfortunately, I don't really have a method for this.

Original thread: https://forums.rpgmakerweb.com/threads/script-call-to-increase-a-variable.82662/