Difference between revisions of "PlaceAtMe"

From the Fallout3 GECK Wiki
Jump to navigation Jump to search
imported>Geckbot
m (Robot: Automated text replacement (-Link to TES4 Construction Set Wiki +{{Incomplete}}\n\nLink to TES4 Construction Set Wiki))
imported>Dandys
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Incomplete}}
{{Function
|CSWikiPage = PlaceAtMe
|origin = GECK1
|summary = Places a given number of the specified object in the world at the location of the calling reference. Two optional parameters allow the object to be offset from this location.
|name = PlaceAtMe
|referenceType = [Object]
|arguments =
  {{FunctionArgument
  |Name = ObjectID
  |Type = ref
  }}{{FunctionArgument
  |Name = Count
  |Type = int
  }}{{FunctionArgument
  |Name = Distance
  |Type = float
  |Optional = y
  }}{{FunctionArgument
  |Name = Direction
  |Type = int
  |Value = 0, 1, 2, 3
  |Optional = y
  }}
|example = PlaceAtMe NinjaActor 1
Player.PlaceAtMe NinjaActor 3
}}
==Parameters==
Direction options:
{|border="1" cellpadding="5" cellspacing="0" align="center"
|-
! style="background:#efefef;" | Direction Value
! style="background:#efefef;" | Location relative to calling reference   
|-
|0           
|In front of 
|-
|1       
|Behind 
|-
|2
|To the left of   
|-
|3 
|To the right of     
|}
==Getting the Created Object's Reference==
Often, you may want to use the object you've created in a script. Use the following syntax:


Link to TES4 Construction Set Wiki: [http://cs.elderscrolls.com/constwiki/index.php/PlaceAtMe PlaceAtMe]
  ref placedObject
  set placedObject to Player.PlaceAtMe objectToPlace 1
 
*The placedObject variable will now have a reference to the new objectToPlace.
*This reference is only reliable for objects that can't be picked up (when they're picked up the reference is destroyed). Accessing the reference of an inventory-item after someone picked it up can cause a CTD.
*Note that [[GetSelf]] won't return the correct reference when used on PlaceAtMe objects.
 
==Caution==
*Using the PlaceAtMe function in scripts without cleaning them up later is considered bad modding etiquette. This is because too many calls to PlaceAtMe leaves objects in the game and will lead to bloated save-games after a while, which impacts game performance and loading times.
*To avoid this problem, clean up unneeded references using [[MarkForDelete]]:
  placedObject.Disable
  placedObject.MarkForDelete
 
*Actor references created using this function that are not set to respawn are removed upon cell reset.
*Projectile references created using this function are removed upon cell reset.
*Misc. items, weapons, armor, and possibly other playable items created using this function are also unloaded/destroyed if picked up.
*Explosion references created using this function are unloaded after their animation plays once.
 
== Notes ==
*Trying to run script commands on objects created in the same frame may not work, since it takes some time to place the object in the world. It is advised to wait a few frames or use a timed pause before attempting to manipulate these objects through scripts.
*The placed object gets the same XYZ angle values as the calling object. Note that world objects placed at the player will be tilted if the player is looking up or down (player X angle not zero ... object X angle not zero).
*This function can be used with leveled creature lists.
*This function can NOT be used with leveled items. Leveled items are not supposed to be placed into the world - you can use them exclusively inside containers. Trying to create an item from a leveled list this way will just cause the yellow exclamation mark (Marker_Error.NIF) to appear.
*The ''Distance'' and ''Direction'' parameters do not work. No matter what is specified for them, the created reference will be placed in safe location nearby the calling reference.
 
==See Also==
*[[MoveTo]]
*[[Rotate]]
*[[SetPos]]
*[[GetPos]]
*[[GetAngle]]
*[[SetAngle]]
*[[GetHeadingAngle]]


[[Category:Functions]]
[[Category:Functions]]
[[Category:Functions (GECK 1.1)]]
[[Category:Miscellaneous Functions]]
[[Category:Miscellaneous Functions]]
[[Category:Miscellaneous Functions (GECK 1.1)]]

Latest revision as of 21:45, 28 November 2012

< [[::Category:Functions|Category:Functions]]

Link to TES4 Construction Set Wiki: PlaceAtMe.

A function included in the GECK version 1.1.0.36.

Description

Places a given number of the specified object in the world at the location of the calling reference. Two optional parameters allow the object to be offset from this location.

Syntax

[help]
[Object].PlaceAtMe ObjectID:ref Count:int Distance:float Direction:int{0, 1, 2, 3}

Example

PlaceAtMe NinjaActor 1
Player.PlaceAtMe NinjaActor 3

Parameters

Direction options:

Direction Value Location relative to calling reference
0 In front of
1 Behind
2 To the left of
3 To the right of

Getting the Created Object's Reference

Often, you may want to use the object you've created in a script. Use the following syntax:

 ref placedObject
 set placedObject to Player.PlaceAtMe objectToPlace 1
  • The placedObject variable will now have a reference to the new objectToPlace.
  • This reference is only reliable for objects that can't be picked up (when they're picked up the reference is destroyed). Accessing the reference of an inventory-item after someone picked it up can cause a CTD.
  • Note that GetSelf won't return the correct reference when used on PlaceAtMe objects.

Caution

  • Using the PlaceAtMe function in scripts without cleaning them up later is considered bad modding etiquette. This is because too many calls to PlaceAtMe leaves objects in the game and will lead to bloated save-games after a while, which impacts game performance and loading times.
  • To avoid this problem, clean up unneeded references using MarkForDelete:
 placedObject.Disable
 placedObject.MarkForDelete
  • Actor references created using this function that are not set to respawn are removed upon cell reset.
  • Projectile references created using this function are removed upon cell reset.
  • Misc. items, weapons, armor, and possibly other playable items created using this function are also unloaded/destroyed if picked up.
  • Explosion references created using this function are unloaded after their animation plays once.

Notes

  • Trying to run script commands on objects created in the same frame may not work, since it takes some time to place the object in the world. It is advised to wait a few frames or use a timed pause before attempting to manipulate these objects through scripts.
  • The placed object gets the same XYZ angle values as the calling object. Note that world objects placed at the player will be tilted if the player is looking up or down (player X angle not zero ... object X angle not zero).
  • This function can be used with leveled creature lists.
  • This function can NOT be used with leveled items. Leveled items are not supposed to be placed into the world - you can use them exclusively inside containers. Trying to create an item from a leveled list this way will just cause the yellow exclamation mark (Marker_Error.NIF) to appear.
  • The Distance and Direction parameters do not work. No matter what is specified for them, the created reference will be placed in safe location nearby the calling reference.

See Also