ItemPropertyACBonusVsRace(int, int)

Sets an "armor class bonus against racial type" itemproperty.

itemproperty ItemPropertyACBonusVsRace(
    int nRace,
    int nACBonus
);

Parameters

nRace

IP_CONST_RACIALTYPE_*

nACBonus

AC bonus to add; 1 to 20 are valid.


Description

Sets item property AC bonus vs. racial group, such as Dwarf or Dragon. You need to specify the racial group constant(IP_CONST_RACIALTYPE_*) and the AC bonus, which should be an integer between 1 and 20.

The type of AC bonus depends on the type of the item. Thanks to Nailog for providing this information:

Items that gain a Deflection bonus: Creature Skins, staves, rings, melee weapons, helmets, cloaks, belts, gloves, and ranged weapons that use ammunition.

Items that gain an Armor bonus: Armors and bracers.

Items that gain a Natural Armor bonus: Amulets.

Items that gain a Shield bonus: Shields.

Items that gain a Dodge bonus: Boots.



Remarks

The itemproperty commands are special constructors - they construct an itemproperty "object" which can then be applied to an item using the AddItemProperty command, much like effects need to be first constructed, then applied with ApplyEffectToObject.

It will often be a good idea to remove similar itemproperties from the item first. There's a command in the "x2_inc_itemprop" include file called IPSafeAddItemProperty which will do that for you. Check IPSafeAddItemProperty for current bug report.

The IP_CONST_RACIALTYPE_* constant can be retrieved off this type of item property using GetItemPropertySubType. The bonus can be retrieved using GetItemPropertCostTableValue.


Version

1.62

Example

#include "x2_inc_itemprop"
//The include is for the IPSafeAddItemProperty function

//Gives the first PC's armor a +15 AC bonus against undead
void main()
{
object oPC=GetFirstPC();
object oItem=GetItemInSlot(INVENTORY_SLOT_CHEST, oPC);
if (!GetIsObjectValid(oItem)) return; //stop if no armor/clothing

itemproperty ipAdd=ItemPropertyACBonusVsRace(IP_CONST_RACIALTYPE_UNDEAD, 15);

IPSafeAddItemProperty(oItem, ipAdd);
}

See Also

functions: AddItemProperty | IPSafeAddItemProperty
categories: Item Creation Functions
constants: IP_CONST_RACIALTYPE_* Constants


 author: Lilac Soul, editor: Peter Busby, additional contributor(s): Nailog