I'm having trouble trying to set up some stats using a for loop. I'm getting an array index is out of range. The thing is I know for sure that I've set up all the arrays in the inspector and all the other arrays are acting normally (at least for now).
The code is kinda long so here's the affected function, it's giving me this error once for line 5 and then every update for line 6.
function SetStats()
{
for(var stats : float in health)
{
health[stats] = ((baseHealth[stats] + itemHealth[stats]) * healthBoost[stats]);
energy[stats] = ((baseEnergy[stats] + itemEnergy[stats]) * energyBoost[stats]);
shield[stats] = ((baseShield[stats] + itemShield[stats]) * shieldBoost[stats]);
attack[stats] = ((baseAttack[stats] + itemAttack[stats]) * attackBoost[stats]);
steal[stats] = ((baseSteal[stats] + itemSteal[stats]) * stealBoost[stats]);
buff[stats] = ((baseBuff[stats] + itemBuff[stats]) * buffBoost[stats]);
}
for(var stats : float in attackDamage)
{
attackDamage[stats] = ((baseAttackDamage[stats] + itemAttackDamage[stats]) * attackBoost[stats]);
penetration[stats] = ((basePenetration[stats] + itemPenetration[stats]) * penetrationBoost[stats]);
armor[stats] = ((baseArmor[stats] + itemArmor[stats]) * armorBoost[stats]);
}
for(var stats : float in ability)
{
ability[stats] = ((baseAbility[stats] + itemAbility[stats]) * abilityBoost[stats]);
}
for(var stats : float in movement)
{
movement[stats] = ((baseMovement[stats] + itemMovement[stats]) * movementBoost[stats]);
}
}
↧