- Joined
- Apr 29, 2013
- Messages
- 10
- Reaction score
- 1
- First Language
- Indonesian
- Primarily Uses
Hello everyone, I'm trying to learn how to utilize javascript in RMMV
However I have a problem regarding increasing or decreasing parameter when using a skill.
For example, I would like to create a stacking decrease defense to the enemy.
Usually you just can do something like this, right?
target.def = target.def - someNumber;
However, that code does not work. The result is always NaN when I use console.log. I don't know what's wrong.
Then, I looked at one of Yanfly Tips and Tricks and I realize that he was using addDebuff.
I really want to know how debuff works in RMMV. This is my code:
<Custom Apply Effect>
target._stackingBreak = target._stackingBreak || 0;
target._stackingBreak += 1;
var defRatio = target._stackingBreak * 0.2;
var defReduct = Math.floor(defRatio * target.def);
//This is working (I use console.log to return the value)
var currentDefense = target.def - defReduct;
//These are not working (The target.def won't change its value)
target.def -= defReduct;
target.def = currentDefense;
</Custom Apply Effect>
The plugin I used is Yanfly Buff and State Core
Thanks for the help!
However I have a problem regarding increasing or decreasing parameter when using a skill.
For example, I would like to create a stacking decrease defense to the enemy.
Usually you just can do something like this, right?
target.def = target.def - someNumber;
However, that code does not work. The result is always NaN when I use console.log. I don't know what's wrong.
Then, I looked at one of Yanfly Tips and Tricks and I realize that he was using addDebuff.
I really want to know how debuff works in RMMV. This is my code:
<Custom Apply Effect>
target._stackingBreak = target._stackingBreak || 0;
target._stackingBreak += 1;
var defRatio = target._stackingBreak * 0.2;
var defReduct = Math.floor(defRatio * target.def);
//This is working (I use console.log to return the value)
var currentDefense = target.def - defReduct;
//These are not working (The target.def won't change its value)
target.def -= defReduct;
target.def = currentDefense;
</Custom Apply Effect>
The plugin I used is Yanfly Buff and State Core
Thanks for the help!

