CopyObject doesn't work on placeables

It seems that CopyObject doesn’t work for me when used on placeable. At first I thought that there is some exception for npc lootable corpses, but neither it is working with chest placeable.

code snippet

vector vPos = GetPosition(OBJECT_SELF);
vPos.z+= 20.0;
location lNew = Location(GetArea(OBJECT_SELF),vPos,GetFacing(OBJECT_SELF));
SendMessageToPC(oPC,APSLocationToString(lNew));
object oCopy = CopyObject(OBJECT_SELF,lNew,OBJECT_INVALID,"copy");
SendMessageToPC(oPC,"oCopy: "+ObjectToString(oCopy));
SetLocalObject(OBJECT_SELF,ObjectToString(oPC),oCopy);

OBJECT_SELF is placeable, script is called from OnUse event, the debug messages shows the location is/should be valid, yet oCopy is OBJECT_INVALID.

Despite the function header specifies only creature and item, Lexicon says it works with placeables as well. I cannot remember whether I copied any placeable before, but surely I had to, yet it doesn’t work now. What I am missing here?

Indeed it only copies creatures and items if you tried it in 1.69.

Information in Lexicon says this:

Duplicates the object (a Creature, Item, Placeable, Waypoint, Store, Door or Trigger) specified to the location locLocation.

It was edited August but the page carries no information that the behavior has changed with EE.

EDIT: thanks to @Daz

It used to only work for items and creatures, but EE added the ability to copy most other object types. I cannot recall which patch added it, offhand.

Probably patch 8193

Here’s the current toolset description for CopyObject:

// Duplicates the object specified by oSource.
// NOTE: this command can be used for copying Creatures, Items, Placeables, Waypoints, Stores, Doors, Triggers.
// If an owner is specified and the object is an item, it will be put into their inventory
// Otherwise, it will be created at the location.
// If a new tag is specified, it will be assigned to the new object.
object CopyObject(object oSource, location locLocation, object oOwner = OBJECT_INVALID, string sNewTag = “”)

2 Likes

Thanks, I got confused because the lexicon page did not have information about the behavior is different in EE (I am running under EE but old patch that doesn’t have this feature yet).