Difference between revisions of "CopyItemAndModify"

From NWN Lexicon
Jump to: navigation, search
m (Wikified article formatting)
Line 1: Line 1:
=CopyItemAndModify(object, int, int, int, int)=
 
 
 
Copies an item, making a single modification to it
 
Copies an item, making a single modification to it
  
Line 13: Line 11:
 
</nwscript>
 
</nwscript>
  
====Parameters====
+
===Parameters===
 
+
; oItem
''oItem''
+
: Item to copy and modify
 
 
Item to copy and modify
 
 
 
''nType''
 
 
 
Type of modification to make
 
 
 
''nIndex''
 
  
Index of the modification to make
+
; nType
 +
: Type of modification to make
  
''nNewValue''
+
; nIndex
 +
: Index of the modification to make
  
New value of the modified index
+
; nNewValue
 +
: New value of the modified index
  
''bCopyVars''
+
; bCopyVars
 
+
: If TRUE, all local variables are copied to the new weapon (Default: FALSE)
If TRUE, all local variables are copied to the new weapon (Default: FALSE)
 
 
 
====Description====
 
  
 +
===Description===
 
Creates a new copy of an item, while making a single change to the appearance of the item.
 
Creates a new copy of an item, while making a single change to the appearance of the item.
  
Helmet models and simple items ignore iIndex.
+
Helmet models and simple items ignore nIndex.
  
 
Legal combinations:
 
Legal combinations:
  
iType: ITEM_APPR_TYPE_SIMPLE_MODEL
+
{| class="wikitable padding-5"
iIndex: [Ignored]
+
! style="text-align: left;" | nType
iNewValue: Model #
+
! style="text-align: left;" | nIndex
 
+
! style="text-align: left;" | nNewValue
iType: ITEM_APPR_TYPE_WEAPON_COLOR
+
|-
iIndex: ITEM_APPR_WEAPON_COLOR_*
+
| ITEM_APPR_TYPE_SIMPLE_MODEL || [Ignored] || Model #
iNewValue: 1-4
+
|-
 
+
| ITEM_APPR_TYPE_WEAPON_COLOR || ITEM_APPR_WEAPON_COLOR_* || 1-4
iType: ITEM_APPR_TYPE_WEAPON_MODEL
+
|-
iIndex: ITEM_APPR_WEAPON_MODEL_*
+
| ITEM_APPR_TYPE_WEAPON_MODEL || ITEM_APPR_WEAPON_MODEL_* || Model #
iNewValue: Model #
+
|-
 
+
| ITEM_APPR_TYPE_ARMOR_MODEL || ITEM_APPR_ARMOR_MODEL_* || Model #
iType: ITEM_APPR_TYPE_ARMOR_MODEL
+
|-
iIndex: ITEM_APPR_ARMOR_MODEL_*
+
| ITEM_APPR_TYPE_ARMOR_COLOR || ITEM_APPR_ARMOR_COLOR_* || 0-63
iNewValue: Model #
+
|}
 
 
iType: ITEM_APPR_TYPE_ARMOR_COLOR
 
iIndex: ITEM_APPR_ARMOR_COLOR_*
 
iNewValue: 0-63
 
 
 
====Remarks====
 
  
 +
===Remarks===
 
Returns the copied object.
 
Returns the copied object.
  
Line 71: Line 57:
 
This function does not copy Cursed (undroppable) flag on the item.  
 
This function does not copy Cursed (undroppable) flag on the item.  
  
====Version====
+
===Version===
  
 
1.61
 
1.61
  
====See Also====
+
===See Also===
  
 
{| class="seealso"
 
{| class="seealso"
 
| width="1px" align="right" valign="top" | <font color="gray">functions: </font>
 
| width="1px" align="right" valign="top" | <font color="gray">functions: </font>
|
+
| [[IPDyeArmor]]
[[ IPDyeArmor  | IPDyeArmor ]]
 
|-
 
 
|-
 
|-
 
| width="1px" align="right" valign="top" | <font color="gray">constants: </font>
 
| width="1px" align="right" valign="top" | <font color="gray">constants: </font>
|
+
| [[item_appr|ITEM_APPR_* Constants]]
[[ item_appr | ITEM_APPR_* Constants ]]
 
 
|}
 
|}
  
Line 91: Line 74:
 
<font color="gray">  author: Lilac Soul</font>
 
<font color="gray">  author: Lilac Soul</font>
 
[[Category:Functions]]
 
[[Category:Functions]]
[[Category:Item_Creation_Functions]]
+
[[Category:Item_Creation_Functions]]{{DISPLAYTITLE:CopyItemAndModify(object, int, int, int, int)}}

Revision as of 06:50, 16 February 2018

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.

Version

1.61

See Also

functions:  IPDyeArmor
constants:  ITEM_APPR_* Constants

 author: Lilac Soul