message: Updated NWScript function
diff: @@ -282,7 +282,13 @@ void NWNX_Creature_SetChallengeRating(object creature, float fCR);
  // Returns the creature's highest attack bonus based on its own stats
  // NOTE: AB vs. <Type> and +AB on Gauntlets are excluded
  -int NWNX_Creature_GetAttackBonus(object creature, int isMelee, int isTouchAttack = FALSE, int isOffhand = FALSE, int includeBaseAttackBonus = TRUE);
  +//
  +// int isMelee values:
  +// TRUE: Get Melee/Unarmed Attack Bonus
  +// FALSE: Get Ranged Attack Bonus
  +// -1: Get Attack Bonus depending on the weapon creature has equipped in its right hand
  +// Defaults to Melee Attack Bonus if weapon is invalid or no weapon
  +int NWNX_Creature_GetAttackBonus(object creature, int isMelee = -1, int isTouchAttack = FALSE, int isOffhand = FALSE, int includeBaseAttackBonus = TRUE);
  const string NWNX_Creature = "NWNX_Creature";
  @@ -998,9 +1004,24 @@ void NWNX_Creature_SetChallengeRating(object creature, float fCR)
  NWNX_CallFunction(NWNX_Creature, sFunc);
  }
  -int NWNX_Creature_GetAttackBonus(object creature, int isMelee, int isTouchAttack = FALSE, int isOffhand = FALSE, int includeBaseAttackBonus = TRUE)
  +int NWNX_Creature_GetAttackBonus(object creature, int isMelee = -1, int isTouchAttack = FALSE, int isOffhand = FALSE, int includeBaseAttackBonus = TRUE)
  {
  string sFunc = "GetAttackBonus";
  +
  + if (isMelee == -1)
  + {
  + object oWeapon = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, creature);
  +
  + if (GetIsObjectValid(oWeapon))
  + {
  + isMelee = !GetWeaponRanged(oWeapon);
  + }
  + else
  + {// Default to melee for unarmed
  + isMelee = TRUE;
  + }
  + }
  +
  NWNX_PushArgumentInt(NWNX_Creature, sFunc, includeBaseAttackBonus);
  NWNX_PushArgumentInt(NWNX_Creature, sFunc, isOffhand);
  NWNX_PushArgumentInt(NWNX_Creature, sFunc, isTouchAttack);
  