IPUpgradeWeaponEnhancementBonus
From NWN Lexicon
Jump to navigationJump to search
IPUpgradeWeaponEnhancementBonus(object, int)
Upgrades a weapon's enhancement bonus.
Parameters
oWeapon
Weapon to upgrade.
nUpgradeBy
Upgrade weapon's enhancement bonus by this much.
Description
Shortcut function to upgrade the enhancement bonus of a weapon by the number specified in nUpgradeBy. If the resulting new enhancement bonus would be out of bounds (>+20), it will be set to +20.
Remarks
You can also use this function to degrade a weapon's enhancement bonus by providing a negative number as nUpgradeBy. If the enhancement bonus would then be set to lower than 1, it is set to 1 instead.
Only melee weapons can have enhancement bonuses - neither ranged weapons nor ammunition can hold such an itemproperty.
Requirements
#include " x2_inc_itemprop "
Version
1.62
Example
<nowiki>#include "x2_inc_itemprop"
</nowiki>
//Give the PC's weapon an additional +13 enhancement
void main()
{
object oPC=GetPCSpeaker();
object oOnHand=GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);
IPUpgradeWeaponEnhancementBonus(oOnHand, 3);
}
</nowiki>
//Give the PC's weapon an additional +13 enhancement
void main()
{
object oPC=GetPCSpeaker();
object oOnHand=GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);
IPUpgradeWeaponEnhancementBonus(oOnHand, 3);
}
See Also
functions: |
author: Lilac Soul, additional contributor(s): hbunny