Advertisement
Guest User

Untitled

a guest
Jul 19th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.31 KB | None | 0 0
  1. // Duplicates the placeable specified by oSource and creates the copy
  2. // at location lLoc
  3. // ONLY placeables can be specified.
  4. // If a new ResRef is specified it will be used as the base placeable
  5. // (useful if the resref of the placeable oSource does not exists)
  6. // If a new tag is specified, it will be assigned to the new object.
  7. object CopyPlaceable(object oSource, location lLoc, string sNewResRef = "", string sNewTag = "");
  8.  
  9. object CopyPlaceable(object oSource, location lLoc, string sNewResRef = "", string sNewTag = "")
  10. {
  11.    
  12.     string sResRef = (sNewResRef=="") ? GetResRef(oSource) : sNewResRef;
  13.     string sTag    = (sNewTag=="")    ? GetTag(oSource)    : sNewTag;
  14.    
  15.     object oNew = CreateObject(OBJECT_TYPE_PLACEABLE, sResRef, lLoc, FALSE, sTag);
  16.     if(GetIsObjectValid(oNew))
  17.     {
  18.         NWNX_Object_SetAppearance(oNew, NWNX_Object_GetAppearance(oSource));
  19.         SetPlotFlag(oNew, GetPlotFlag(oSource));
  20.         SetUseableFlag(oNew, GetUseableFlag(oSource));
  21.         SetName(oNew, GetName(oSource));
  22.         SetDescription(oNew, GetDescription(oSource));
  23.  
  24.         int k;
  25.         for(k=EVENT_SCRIPT_PLACEABLE_ON_CLOSED; k<=EVENT_SCRIPT_PLACEABLE_ON_LEFT_CLICK; k++)
  26.         {
  27.             SetEventScript(oNew, k, GetEventScript(oSource, k));    
  28.         }        
  29.     }
  30.     return oNew;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement