CopyItem(object, object, int)

Duplicates an item.

object CopyItem(
    object oItem,
    object oTargetInventory = OBJECT_INVALID,
    int bCopyVars
);

Parameters

oItem

Item to copy.

oTargetInventory

Create the item within this inventory (Default: OBJECT_INVALID)

bCopyVars

If TRUE, local variables on item are copied


Description

duplicates the item and returns a new object
returns the new item
returns OBJECT_INVALID for non-items.
can only copy empty item containers. will return OBJECT_INVALID if oItem contains other items.
if it is possible to merge this item with any others in the target location, then it will do so and return the merged object.



Remarks

This function doesn't seem to be able to do anything that CopyObject can't do, but it leaves out the mandatory input of a location.

Can be used for custom treasure systems by finding an item in a treasureholder container, and then calling CopyItem to make a copy of the item in the container or creature calling the function.


Version

1.61

See Also

functions: CopyItemAndModify | CopyObject | CreateItemOnObject
categories: Item Creation Functions


 author: Charles Feduke, editor: Lilac Soul
 Send comments on this topic.