NWNX:EE  8193.36.12
Item

readme

Functions exposing additional item properties.

Files

file  nwnx_item.nss
 

Functions

void NWNX_Item_SetWeight (object oItem, int weight)
 Set an item's weight. More...
 
void NWNX_Item_SetBaseGoldPieceValue (object oItem, int gold)
 Set an item's base value in gold pieces. More...
 
void NWNX_Item_SetAddGoldPieceValue (object oItem, int gold)
 Set an item's additional value in gold pieces. More...
 
int NWNX_Item_GetBaseGoldPieceValue (object oItem)
 Get an item's base value in gold pieces. More...
 
int NWNX_Item_GetAddGoldPieceValue (object oItem)
 Get an item's additional value in gold pieces. More...
 
void NWNX_Item_SetBaseItemType (object oItem, int nBaseItem)
 Set an item's base item type. More...
 
void NWNX_Item_SetItemAppearance (object oItem, int nType, int nIndex, int nValue, int bUpdateCreatureAppearance=FALSE)
 Make a single change to the appearance of an item. More...
 
string NWNX_Item_GetEntireItemAppearance (object oItem)
 Return a string containing the entire appearance for an item. More...
 
void NWNX_Item_RestoreItemAppearance (object oItem, string sApp)
 Restores an item's appearance using the value retrieved through NWNX_Item_GetEntireItemAppearance(). More...
 
int NWNX_Item_GetBaseArmorClass (object oItem)
 Get an item's base armor class. More...
 
int NWNX_Item_GetMinEquipLevel (object oItem)
 Get an item's minimum level required to equip. More...
 
int NWNX_Item_MoveTo (object oItem, object oTarget, int bHideAllFeedback=FALSE)
 Move oItem to oTarget. More...
 
void NWNX_Item_SetMinEquipLevelModifier (object oItem, int nModifier, int bPersist=TRUE)
 Set a modifier to the Minimum Level to Equip (Item Level Restriction). More...
 
int NWNX_Item_GetMinEquipLevelModifier (object oItem)
 Gets the applied modifier to the Minimum Level to Equip (Item Level Restriction). More...
 
void NWNX_Item_SetMinEquipLevelOverride (object oItem, int nOverride, int bPersist=TRUE)
 Set an override to the Minimum Level to Equip (Item Level Restriction). More...
 
int NWNX_Item_GetMinEquipLevelOverride (object oItem)
 Gets the applied override to the Minimum Level to Equip (Item Level Restriction). More...
 

Function Documentation

◆ NWNX_Item_SetWeight()

void NWNX_Item_SetWeight ( object  oItem,
int  weight 
)

Set an item's weight.

Note
Will not persist through saving.
Parameters
oItemThe item object.
weightThe weight, note this is in tenths of pounds.

Definition at line 135 of file nwnx_item.nss.

◆ NWNX_Item_SetBaseGoldPieceValue()

void NWNX_Item_SetBaseGoldPieceValue ( object  oItem,
int  gold 
)

Set an item's base value in gold pieces.

Remarks
Total cost = base_value + additional_value.
Equivalent to SetGoldPieceValue NWNX2 function.
Note
Will not persist through saving.
This value will also revert if item is identified or player relogs into server.
Parameters
oItemThe item object.
goldThe base gold value.

Definition at line 145 of file nwnx_item.nss.

◆ NWNX_Item_SetAddGoldPieceValue()

void NWNX_Item_SetAddGoldPieceValue ( object  oItem,
int  gold 
)

Set an item's additional value in gold pieces.

Remarks
Total cost = base_value + additional_value.
Note
Will persist through saving.
Parameters
oItemThe item object.
goldThe additional gold value.

Definition at line 155 of file nwnx_item.nss.

◆ NWNX_Item_GetBaseGoldPieceValue()

int NWNX_Item_GetBaseGoldPieceValue ( object  oItem)

Get an item's base value in gold pieces.

Parameters
oItemThe item object.
Returns
The base gold piece value for the item.

Definition at line 165 of file nwnx_item.nss.

◆ NWNX_Item_GetAddGoldPieceValue()

int NWNX_Item_GetAddGoldPieceValue ( object  oItem)

Get an item's additional value in gold pieces.

Parameters
oItemThe item object.
Returns
The additional gold piece value for the item.

Definition at line 175 of file nwnx_item.nss.

◆ NWNX_Item_SetBaseItemType()

void NWNX_Item_SetBaseItemType ( object  oItem,
int  nBaseItem 
)

Set an item's base item type.

Warning
This will not be visible until the item is refreshed (e.g. drop and take the item, or logging out and back in).
Parameters
oItemThe item object.
nBaseItemThe new base item.

Definition at line 185 of file nwnx_item.nss.

◆ NWNX_Item_SetItemAppearance()

void NWNX_Item_SetItemAppearance ( object  oItem,
int  nType,
int  nIndex,
int  nValue,
int  bUpdateCreatureAppearance = FALSE 
)

Make a single change to the appearance of an item.

Warning
This will not be visible to PCs until the item is refreshed for them (e.g. by logging out and back in).

Helmet models and simple items ignore nIndex.

nType nIndex nValue
ITEM_APPR_TYPE_SIMPLE_MODEL [Ignored] Model #
ITEM_APPR_TYPE_WEAPON_COLOR ITEM_APPR_WEAPON_COLOR_* 0-255
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] 0-255 [1]

[0] Where ITEM_APPR_TYPE_ARMOR_COLOR is specified, if per-part coloring is desired, the following equation can be used for nIndex to achieve that:

ITEM_APPR_ARMOR_NUM_COLORS + (ITEM_APPR_ARMOR_MODEL_ * ITEM_APPR_ARMOR_NUM_COLORS) + ITEM_APPR_ARMOR_COLOR_

For example, to change the CLOTH1 channel of the torso, nIndex would be:

6 + (7 * 6) + 2 = 50

[1] When specifying per-part coloring, the value 255 corresponds with the logical function 'clear colour override', which clears the per-part override for that part.

Parameters
oItemThe item
nTypeThe type
nIndexThe index
nValueThe value
bUpdateCreatureAppearanceIf TRUE, also update the appearance of oItem's possessor. Only works for armor/helmets/cloaks. Will remove the item from the quickbar as side effect.

Definition at line 195 of file nwnx_item.nss.

◆ NWNX_Item_GetEntireItemAppearance()

string NWNX_Item_GetEntireItemAppearance ( object  oItem)

Return a string containing the entire appearance for an item.

See also
NWNX_Item_RestoreItemAppearance
Parameters
oItemThe item object.
Returns
A string representing the item's appearance.

Definition at line 209 of file nwnx_item.nss.

◆ NWNX_Item_RestoreItemAppearance()

void NWNX_Item_RestoreItemAppearance ( object  oItem,
string  sApp 
)

Restores an item's appearance using the value retrieved through NWNX_Item_GetEntireItemAppearance().

Parameters
oItemThe item object.
sAppA string representing the item's appearance.

Definition at line 219 of file nwnx_item.nss.

◆ NWNX_Item_GetBaseArmorClass()

int NWNX_Item_GetBaseArmorClass ( object  oItem)

Get an item's base armor class.

Parameters
oItemThe item object.
Returns
The base armor class.

Definition at line 229 of file nwnx_item.nss.

◆ NWNX_Item_GetMinEquipLevel()

int NWNX_Item_GetMinEquipLevel ( object  oItem)

Get an item's minimum level required to equip.

Parameters
oItemThe item object.
Returns
The minimum level required to equip the item.

Definition at line 239 of file nwnx_item.nss.

◆ NWNX_Item_MoveTo()

int NWNX_Item_MoveTo ( object  oItem,
object  oTarget,
int  bHideAllFeedback = FALSE 
)

Move oItem to oTarget.

Remarks
Moving items from a container to the inventory of the container's owner (or the other way around) is always "silent" and won't trigger feedback messages
Parameters
oItemThe item object.
oTargetThe target bag/creature/placeable or store object to move oItem to.
bHideAllFeedbackHides all feedback messages generated by losing/acquiring items
Returns
TRUE if the item was successfully moved to the target, otherwise FALSE

Definition at line 249 of file nwnx_item.nss.

◆ NWNX_Item_SetMinEquipLevelModifier()

void NWNX_Item_SetMinEquipLevelModifier ( object  oItem,
int  nModifier,
int  bPersist = TRUE 
)

Set a modifier to the Minimum Level to Equip (Item Level Restriction).

Parameters
oItemThe item object.
nModifierthe modifier to apply (After any Override)
bPersistWhether the modifier should persist to gff field. Strongly Recommended to be TRUE (See warning)
Note
This function (or override partner) must be used each server reset to reenable persistence. Recommended use on OBJECT_INVALID OnModuleLoad.
Warning
if Persistence is FALSE, or not renabled, beware characters may trigger ELC logging in with now-invalid ItemLevelRestrictions equipped.

Definition at line 262 of file nwnx_item.nss.

◆ NWNX_Item_GetMinEquipLevelModifier()

int NWNX_Item_GetMinEquipLevelModifier ( object  oItem)

Gets the applied modifier to the Minimum Level to Equip (Item Level Restriction).

Parameters
oItemThe item object.

Definition at line 273 of file nwnx_item.nss.

◆ NWNX_Item_SetMinEquipLevelOverride()

void NWNX_Item_SetMinEquipLevelOverride ( object  oItem,
int  nOverride,
int  bPersist = TRUE 
)

Set an override to the Minimum Level to Equip (Item Level Restriction).

Parameters
oItemThe item object.
nOverridethe nOverride to apply (Before any Modifier)
bPersistWhether the modifier should persist to gff field. Strongly Recommended to be TRUE (See warning)
Note
This function (or modifier partner) must be used each server reset to reenable persistence. Recommended use on OBJECT_INVALID OnModuleLoad.
Warning
if Persistence is FALSE, or not renabled, beware characters may trigger ELC logging in with now-invalid ItemLevelRestrictions equipped.

Definition at line 283 of file nwnx_item.nss.

◆ NWNX_Item_GetMinEquipLevelOverride()

int NWNX_Item_GetMinEquipLevelOverride ( object  oItem)

Gets the applied override to the Minimum Level to Equip (Item Level Restriction).

Parameters
oItemThe item object.

Definition at line 294 of file nwnx_item.nss.