_Guile wrote...
Minor error you had there, if(nMonk), should be if(nMonk>=1)
nMonk is correct. To look at BioWare's free use of the understanding that 0 is the inapplicable return see the ability determination for Shelgarn's persistant blade posted below.
int GetIsMagicStatBonus(object oCaster)
{
//Declare major variables
int nclass;
int nAbility;
if(nclass = GetLevelByclass(class_TYPE_WIZARD, oCaster))
{
if(nclass > 0)
{
nAbility = ABILITY_INTELLIGENCE;
}
}
if(nclass = GetLevelByclass(class_TYPE_BARD, oCaster) || GetLevelByclass(class_TYPE_SORCERER, oCaster))
{
if(nclass > 0)
{
nAbility = ABILITY_CHARISMA;
}
}
else if(nclass = GetLevelByclass(class_TYPE_CLERIC, oCaster) || GetLevelByclass(class_TYPE_DRUID, oCaster)
|| GetLevelByclass(class_TYPE_PALADIN, oCaster) || GetLevelByclass(class_TYPE_RANGER, oCaster))
{
if(nclass > 0)
{
nAbility = ABILITY_WISDOM;
}
}
return GetAbilityModifier(nAbility, oCaster);
}
Note that the if clauses have only a single "=" rather than a double for comparison. The value of nclass is not being compared, rather nclass is storing the compared value. The later comparison of (nclass>0) is entirely redundant unless somehow the game fluked by returning a negative number. But since level drain does not affect GetLevelByclass() this is not going to happen.