PlaceAtMe

Revision as of 14:30, 22 May 2006 by imported>JOG (It works fine with creatures, NOT with leveled items of course.)

Syntax:

PlaceAtMe ItemID, count, distance, direction 

Example:

player.PlaceAtMe Ninja Man, 1, 256, 1 


Places the object at the calling object, in the direction you specify and the distance. If that location is not safe (in the air, in a wall, etc), the object will be placed at one of the other axes or at the object's exact location.

Direction is:

0 = front
1 = back
2 = left
3 = right

You can use this function to create leveled creatures, but it can't be used with leveled items, as those are supposed to be put in a container. Trying to create an item from a leveled list this way will just cause the yellow exclamation mark (Marker_Error.NIF) to appear.

Getting the Created Object's Reference

When used to create a single object, this function will return a reference to the created object so that it can be used with additional function calls.

Example:

scn scriptName

ref refName

begin blockName
     set refName to refCreatingObject.PlaceAtMe ObjectToBeCreated 1, 0, 0
end

The refName variable will now have a reference to ObjectToBeCreated.


Console Use

When using PlaceAtMe with the console, you must use the desired item's FormID, not the EditorID.

So, instead of using

player.PlaceAtMe lockpick 1, 256, 0

to give yourself a lockpick, you must use

player.PlaceAtMe 00000A 1, 256, 0

The FormID can be found on the tab just to the right of the EditorID tab in the Construction Set. This is true for all items and actors, although the FormID tab may need to be enlarged.