Hello!
I'm mainly an artist and not a programmer, so I got stumped when trying to use a script call in my attack skill's damage formula and it didn't work.
Basically, I want most skills to increase a variable based on which actor is using that skill by a random amount (1-3 currently).
I've been using iterations of this code in the attack skill's damage formula:
However, it doesn't increment the specified variables at all. I've tested this code outside of battle and it works fine, so I'm not sure what I'm doing wrong.
Any help would be appreciated! 😅
Edit:
I also previously had it at:
It didn't work that way either.
Edit 2:
So I didn't figure out how to make the code work, so I used a work-around.
I made separate "attack" skills for each actor that call common events that add to the variable when used.
I changed the actor's attacks by using YEP_WeaponUnleash, which allows you to replace attack and guard skills with other skills.
I'm mainly an artist and not a programmer, so I got stumped when trying to use a script call in my attack skill's damage formula and it didn't work.
Basically, I want most skills to increase a variable based on which actor is using that skill by a random amount (1-3 currently).
I've been using iterations of this code in the attack skill's damage formula:
JavaScript:
a.atk - b.def; if (a.actorId() == 1) {var oldValue = $gameVariable.Value(42); $gameVariables.setValue(42,oldValue+Math.randomInt(3)+1);} else {var oldValue = $gameVariable.Value(62); $gameVariables.setValue(62,oldValue+Math.randomInt(3)+1);}
However, it doesn't increment the specified variables at all. I've tested this code outside of battle and it works fine, so I'm not sure what I'm doing wrong.
Any help would be appreciated! 😅
Edit:
I also previously had it at:
JavaScript:
a.atk - b.def; if (a.actorId() == 1) {$gameVariables.setValue(42,$gameVariable.Value(42)+Math.randomInt(3)+1);} else { $gameVariables.setValue(62,$gameVariable.Value(62)+Math.randomInt(3)+1);}
Edit 2:
So I didn't figure out how to make the code work, so I used a work-around.
I made separate "attack" skills for each actor that call common events that add to the variable when used.
I changed the actor's attacks by using YEP_WeaponUnleash, which allows you to replace attack and guard skills with other skills.