RPG Maker Forums

Straightforward, nested for loops don't seem to be doing anything, and I can't for the life of me figure out why.

Code in question is:
var setTWGains = BattleManager.startBattle;
BattleManager.startBattle = function() {
setTWGains.call(this);
console.log('Start!');

for (id = 0; id < $gameParty.battleMembers(); id++) { // Uses ES5
console.log('Loop one!');
for (val = 0; val < $dataActors.length; val++) {
console.log('Loop two!');
var actor = $gameActors.actor($gameParty.battleMembers()[id]._actorId);
actor._healGain[val] = twHeal;
actor._buffGain[val] = twBuff;
actor._debuffGain[val] = twDebuff;
if (actor.isStateAffected($dataActors[actor].favstate)) actor._buffActive = true;
else actor._buffActive = false;
actor._debuffRemoved = false;
actor._hasDebuff = false;
actor._startHP = actor._hp;
}
}
console.log('Battle!');
};

And the console logs 'Loop one!' and 'Loop two!' never hit the console. I don't get any errors, but when I try to read the variables defined in here during the battle, they come up as undefined. So what am I overlooking? Because I swear this worked for awhile, and I don't remember changing anything about it XD.

Appreciate the time and help!

~ Zephyr

Latest Threads

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,040
Messages
1,018,470
Members
137,821
Latest member
Capterson
Top