IPSetWeaponEnhancementBonus

From NWN Lexicon



Contents

[edit] IPSetWeaponEnhancementBonus(object, int, int)

Sets an enhancement bonus on a weapon.

void IPSetWeaponEnhancementBonus(
    object oWeapon,
    int nBonus,
    int bOnlyIfHigher = TRUE
);

[edit] Parameters

oWeapon

Weapon to set the bonus on.

nBonus

Bonus to add. 1 to 20 are valid.

bOnlyIfHigher

TRUE or FALSE. See description. (Default: TRUE)


[edit] Description

Shortcut function to set the enhancement bonus of a weapon to a certain bonus
Specifying bOnlyIfHigher as TRUE will prevent a bonus lower than the requested bonus from being applied. Valid values for nBonus are 1 to 20.



[edit] Remarks

A good alternative to IPSafeAddItemProperty or AddItemProperty when wanting to improve a PC's weapon.

If nBonus is not between 1 and 20, nothing happens.


[edit] Requirements

#include " x2_inc_itemprop "

[edit] Version

1.61

[edit] Example

<nowiki>#include "x2_inc_itemprop"
</nowiki>
//Give the PC's weapon a +10 enhancement, unless it is already better than that
void main()
{
object oPC=GetPCSpeaker();
object oOnHand=GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);
 
IPSetWeaponEnhancementBonus(oOnHand, 10);
}

[edit] See Also

functions: 

ItemPropertyEnhancementBonus



 author: Lilac Soul
 

Personal tools
Categories