NWN2Wiki
Advertisement
// MAP 3/28/2009
// Returns the armorrulesstats.2da row used by this armor.
// oItem is not armor, or is invalid, returns 0.
int GetArmorRulesType(object oItem);

Currently, the toolset description of this function is a little off. If oItem is invalid it will not return as zero (the row for cloth in armorrulesstats.2da). This is an important distinction as this function is often used in conjunction with Get2DAString and using a conversion function such as StringToInt will cause the entire script executing the function to shut down.

However, there is a simple workaround for this problem. For example, to find the Armor check penalty of oItem:

object oPC = OBJECT_SELF;
object oArmor = GetItemInSlot(INVENTORY_SLOT_CHEST, oPC);
int nArmor;

if (oArmor == OBJECT_INVALID)
{
	nArmor = 0;
}
else nArmor = GetArmorRulesType(oArmor);

int nArmorPenalty = StringToInt(Get2DAString("armorrulestats", "ACCHECK", nArmor));
  • Added in Patch 1.23
Advertisement