CopyItemAndModify(object, int, int, int, int)

From NWN Lexicon
Jump to: navigation, search

Copies an item, making a single modification to it

object CopyItemAndModify(
    object oItem,
    int nType,
    int nIndex,
    int nNewValue,
    int bCopyVars = FALSE
);

Parameters

oItem
Item to copy and modify
nType
Type of modification to make
nIndex
Index of the modification to make
nNewValue
New value of the modified index
bCopyVars
If TRUE, all local variables are copied to the new weapon (Default: FALSE)

Description

Creates a new copy of an item, while making a single change to the appearance of the item.

Helmet models and simple items ignore nIndex.

Legal combinations:

nType nIndex nNewValue
ITEM_APPR_TYPE_SIMPLE_MODEL [Ignored] Model #
ITEM_APPR_TYPE_WEAPON_COLOR ITEM_APPR_WEAPON_COLOR_* 1-4
ITEM_APPR_TYPE_WEAPON_MODEL ITEM_APPR_WEAPON_MODEL_* Model #
ITEM_APPR_TYPE_ARMOR_MODEL ITEM_APPR_ARMOR_MODEL_* Model #
ITEM_APPR_TYPE_ARMOR_COLOR ITEM_APPR_ARMOR_COLOR_* 0-63

Remarks

Returns the copied object.

Note that the original item isn't destroyed by this function. You'll have to destroy it manually to really make it seem like the item is being modified.

This function does not copy Cursed (undroppable) flag on the item.

Warning icon orange.png Caution: This section documents NWN: Enhanced Edition content, not native BioWare scripts. It may not apply unless you're using NWN: Enhanced Edition.

In Neverwinter Nights: Enhanced Edition, this function has been modified to allow weapons to access color channels 1-9. Note that this will only apply to custom content weapons, as default weapon models only have four colors.

Version

1.61
1.74.8150 updated this function to support per-part coloring in Neverwinter Nights Enhanced Edition.

See Also

functions:  IPDyeArmor()
constants:  ITEM_APPR_* Constants

 author: Lilac Soul