Hello all. I was trying to find a script call for an Event Command to be able to finish out a script and was having a terrible time until I came across this amazing reference someone put together. Check it out! 🙂
RMMV Script Call Reference List
Learning JavascriptIt's already pinned in a forum thread in one of the mv or javascript forums.
I don't think so, but I'm not particularly fond of this database, because it is not too informative.
@Poryg Okay. Well...to each their own. I never shy away from a possible source of reference. Trying to get at a way to make the input for an experience formula be a number...as opposed to...NaN.
Thread here: https://forums.rpgmakerweb.com/inde...-experience-gain-with-yep.109939/#post-976833
Thread here: https://forums.rpgmakerweb.com/inde...-experience-gain-with-yep.109939/#post-976833
If it's an NaN, it means you're performing an illegal addition concerning numbers. For example you can't add 5 and "r" together. What are you trying to input?
@Poryg
var ExPts = 80 * Multiplier / $gameParty.members().length;
$gameActors.actor(i).gainExp(ExPts);
I figure the $gameParty.members().length is the problem. How do I convert to number?
EDIT: Here's the full script...
◆Script:for (var i = 1; i <= $gameParty.members().length; i++) {
: : var Difference = ($gameParty.members(i).level - $gameTroop.members(1).level + 6).clamp(0, 11);
: : var Multiplier = [5, 4.3, 3.7, 3.2, 2.8, 2.4, 2, 1.8, 1.6, 1.4, 1.2, 1][Difference];
: : var ExPts = 80 * Multiplier / $gameParty.members().length;
: : $gameActors.actor(i).gainExp(ExPts);
: :};
var ExPts = 80 * Multiplier / $gameParty.members().length;
$gameActors.actor(i).gainExp(ExPts);
I figure the $gameParty.members().length is the problem. How do I convert to number?
EDIT: Here's the full script...
◆Script:for (var i = 1; i <= $gameParty.members().length; i++) {
: : var Difference = ($gameParty.members(i).level - $gameTroop.members(1).level + 6).clamp(0, 11);
: : var Multiplier = [5, 4.3, 3.7, 3.2, 2.8, 2.4, 2, 1.8, 1.6, 1.4, 1.2, 1][Difference];
: : var ExPts = 80 * Multiplier / $gameParty.members().length;
: : $gameActors.actor(i).gainExp(ExPts);
: :};
Length is ok.
The problem is Multiplier.
You're dividing an Array by a number (not to mention trying to multiply it by 80).
Use Multiplier[0] or something instead.
Edit: Nevermind, my bad. Read the code wrong. Either way, length is ok and Multiplier is a problem. Console log Multiplier and Difference.
The problem is Multiplier.
You're dividing an Array by a number (not to mention trying to multiply it by 80).
Use Multiplier[0] or something instead.
Edit: Nevermind, my bad. Read the code wrong. Either way, length is ok and Multiplier is a problem. Console log Multiplier and Difference.
@Poryg Okay. I know the console comes up with F8 when the game is running. How do I log those variables? or does it just give their values automatically? Giving it a try.
I see the problem!
var Difference = ($gameParty.members(i).level - $gameTroop.members(1).level + 6).clamp(0, 11);
It's
and $gameParty.members()[1]. Hope it works, I'm going to stop now. It's off topic and would need its own thread.
var Difference = ($gameParty.members(i).level - $gameTroop.members(1).level + 6).clamp(0, 11);
It's
Code:
$gameParty.members()[i].level
Original thread: https://forums.rpgmakerweb.com/threads/rmmv-script-call-reference-list.109960/