Editing
PlaceActorAtMe - ObjectReference
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
[[Category:Scripting]] [[Category:Papyrus]] '''Member of:''' [[ObjectReference Script]] Places a new [[Actor Script|Actor]] at this object's location. == Syntax == <syntaxhighlight lang="papyrus"> Actor Function PlaceActorAtMe(ActorBase akActorToPlace, int aiLevelMod = 4, EncounterZone akZone = None) native </syntaxhighlight> == Parameters == *akActorToPlace: The [[ActorBase Script|ActorBase]] to base the new actor on. *aiLevelMod: The level modifier to use. **Must be one of the following: ***0: Easy ***1: Medium ***2: Hard ***3: Boss ***4: None **'''Default''': 4 *akZone: The [[EncounterZone Script|EncounterZone]] to use when placing the new actor. **'''Default''': None == Return Value == The new [[Actor Script|Actor]] that was just placed. == Examples == <syntaxhighlight lang="papyrus"> ; Place a new wolf at this location - and have it attack the player MarkerProperty.PlaceActorAtMe(WolfBaseProperty).StartCombat(Game.GetPlayer()) </syntaxhighlight> <br/> <syntaxhighlight lang="papyrus"> ; Place a new boss bear at this location MarkerProperty.PlaceActorAtMe(BearBaseProperty, 3) </syntaxhighlight> ==Notes== <ul> <li> A common mistake with PlaceActorAtMe is passing an object of type Actor as its akActorToPlace parameter. Attempting to do so will result in this compilation error: <pre>type mismatch on parameter 1 (did you forget a cast?)</pre> This is the same error as you would see if you were to use an [[ObjectReference Script|ObjectReference]] as the first parameter of [[PlaceAtMe - ObjectReference|PlaceAtMe]], which should be of type [[Form_Script|Form]]. The first parameter of PlaceActorAtMe should be of type [[ActorBase Script|ActorBase]]. If you need to get an ActorBase from an Actor, use the [[GetBaseObject - ObjectReference|GetBaseObject]] function. <syntaxhighlight lang="papyrus"> Actor Property MyActor Auto ActorBase MyActorBase Event OnInit() MyActorBase = MyActor.GetBaseObject() as ActorBase EndEvent ; ... PlaceActorAtMe(MyActorBase) ; ... </syntaxhighlight> GetBaseObject returns an object of type Form, which is the parent of ActorBase, so if you need to use any functions or properties defined in the ActorBase script make sure to cast the object before using it. Note that [[GetActorBase - Actor|GetActorBase]] can be used as shorthand for GetBaseObject when you're expecting an ActorBase: <syntaxhighlight lang="papyrus"> MyActorBase = MyActor.GetBaseObject() as ActorBase ; Is functionally equivalent to... MyActorBase = MyActor.GetActorBase() </syntaxhighlight> However, this shorthand function is the slower option and therefore not recommended. </li> </ul> == See Also == *[[ObjectReference Script]] *[[PlaceAtMe - ObjectReference]]
Summary:
Please note that all contributions to the CreationKit Wiki are considered to be released under the Creative Commons Attribution-ShareAlike (see
CreationKit:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
Edit source
View history
More
Search
Navigation
Landing page
Tutorials
Game Systems
Editor Reference
Scripting Reference
Recent changes
Help
Tools
What links here
Related changes
Special pages
Page information
Page values