Difference between revisions of "CloneForm"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Scruggs
imported>Behippo
(Correct function syntax)
Line 2: Line 2:


'''Syntax:'''
'''Syntax:'''
  [''Ref.'']CloneForm ''[objectID]''
  [nuObjectID] CloneForm [objectID]
 
This function creates an exact duplicate of the referenced base object supplied in objectID and returns the new objectID. Cloned forms are saved in the save game. Cloning an object allows you to then make changes to the clone without affecting the original object.


This function creates a new base object, identical to the base object supplied as the calling object or objectID. Cloned objects are saved in the savegame. Cloning an object allows you to then make changes to the clone without affecting the original object. Optional syntax returns the base object ID of the clone:
<pre>
<pre>
ref clone
ref clone
set clone to myReference.cloneForm ; clone the base object of myReference
ref originalObject
 
set originalObject to myReference.GetBaseObject
set clone to CloneForm original object; clone the base object of myReference
player.placeAtMe clone 1 0 0 ; place a reference to the clone at the player's location
player.placeAtMe clone 1 0 0 ; place a reference to the clone at the player's location
</pre>
</pre>


This function also works for non-game objects like spells and enchantments.
This function works for any game type (objects, spells, enchantments, NPCs).  If called on an Inventory Object (weapon, armor, light, potion, book, ingredient etc.) you may pass the CS EditorID directly into the function.  For any other type you must first set a ref variable to the appropriate objectID before calling CloneForm.


Notes:
Notes:

Revision as of 21:09, 5 December 2006

A command for Oblivion Script Extender

Syntax:

[nuObjectID] CloneForm [objectID]

This function creates an exact duplicate of the referenced base object supplied in objectID and returns the new objectID. Cloned forms are saved in the save game. Cloning an object allows you to then make changes to the clone without affecting the original object.

ref clone
ref originalObject

set originalObject to myReference.GetBaseObject
set clone to CloneForm original object; clone the base object of myReference
player.placeAtMe clone 1 0 0 ; place a reference to the clone at the player's location

This function works for any game type (objects, spells, enchantments, NPCs). If called on an Inventory Object (weapon, armor, light, potion, book, ingredient etc.) you may pass the CS EditorID directly into the function. For any other type you must first set a ref variable to the appropriate objectID before calling CloneForm.

Notes:

  • Cloned NPCs have no items in their inventories.