ItemPropertyHolyAvenger()

From NWN Lexicon
Jump to navigationJump to search

Sets up a holy avenger item property.

itemproperty ItemPropertyHolyAvenger();

Description

Returns the item property Holy Avenger, which, when added to a weapon, enhances it if the user is a Paladin or has the Use Magical Device skill.

If the user is a Paladin or passes an a Alignment Use Magical Device check against the weapons cost, the property applies this in the background:

If they are not a Paladin or fail the UMD check it has this property in the background:

The item properties hidden bonuses may clash with other bonuses applied to the weapon, for instance the games default Holy Avenger sword has a ItemPropertyEnhancementBonus(2) applied to it, which really doesn't do anything since the Holy Avenger item property applies +5 or +2 depending on the situation. This does increase the item cost significantly however.

Note the item property can be applied to standard weapons (and should work with ranged weapons mostly), non-standard weapons like creature weapons, and even the arms slot item (ie gloves, bracers) for unarmed attack bonuses.

Remarks

The main difference to applying the effects by hand (say OnPlayerEquipItem) is the dispel magic On Hit effect is automatic, and doesn't fire the spell script (rather annoyingly!).

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.


Version

1.61

Example

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

//Gives the first PC's onhand weapon the holy avenger property
void main()
{
    object oPC=GetFirstPC();
    object oItem = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);
    if (!GetIsObjectValid(oItem)) return;

    itemproperty ipAdd = ItemPropertyHolyAvenger();

    IPSafeAddItemProperty(oItem, ipAdd);
}

See Also

functions: 

IPSafeAddItemProperty



 author: Lilac Soul, editor: Peter Busby