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:
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
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!');
};
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