// Duplicates the placeable specified by oSource and creates the copy // at location lLoc // ONLY placeables can be specified. // If a new ResRef is specified it will be used as the base placeable // (useful if the resref of the placeable oSource does not exists) // If a new tag is specified, it will be assigned to the new object. object CopyPlaceable(object oSource, location lLoc, string sNewResRef = "", string sNewTag = ""); object CopyPlaceable(object oSource, location lLoc, string sNewResRef = "", string sNewTag = "") { string sResRef = (sNewResRef=="") ? GetResRef(oSource) : sNewResRef; string sTag = (sNewTag=="") ? GetTag(oSource) : sNewTag; object oNew = CreateObject(OBJECT_TYPE_PLACEABLE, sResRef, lLoc, FALSE, sTag); if(GetIsObjectValid(oNew)) { NWNX_Object_SetAppearance(oNew, NWNX_Object_GetAppearance(oSource)); SetPlotFlag(oNew, GetPlotFlag(oSource)); SetUseableFlag(oNew, GetUseableFlag(oSource)); SetName(oNew, GetName(oSource)); SetDescription(oNew, GetDescription(oSource)); int k; for(k=EVENT_SCRIPT_PLACEABLE_ON_CLOSED; k<=EVENT_SCRIPT_PLACEABLE_ON_LEFT_CLICK; k++) { SetEventScript(oNew, k, GetEventScript(oSource, k)); } } return oNew; }