Author Topic: New Revised Blinding Speed Script  (Read 764 times)

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
New Revised Blinding Speed Script
« Reply #15 on: May 11, 2012, 01:53:26 pm »


               

_Guile wrote...

int GetMainHandAPR(object oCreature = OBJECT_SELF)
{
int nAPR, nAB, nHD, nMonk;
nHD = GetHitDice(oCreature);
nAB = GetBaseAttackBonus(oCreature);
if(nHD > 20) nAB -= (nHD - 19)/2;
nMonk = GetLevelByclass(class_TYPE_MONK, oCreature);
if(nMonk>=1) nAPR = (nAB + 2)/3;
else nAPR = (nAB + 4)/5;
if(nAPR < 1) nAPR = 1;
if(nAPR > 6) nAPR = 6;
return nAPR;
}

Minor error you had there, if(nMonk), should be if(nMonk>=1)


The if(nMonk) he'd used was correct.  Since the GetLevelByclass will return a zero for no monk levels, which is FALSE in the evaluation of it , and all other returns evaluate as TRUE.
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
New Revised Blinding Speed Script
« Reply #16 on: May 11, 2012, 04:59:05 pm »


               

_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.
               
               

               
            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
New Revised Blinding Speed Script
« Reply #17 on: May 12, 2012, 02:41:01 pm »


               Very nice, thanks for sharing guys '<img'>