SetActorOwner - ObjectReference: Difference between revisions

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Jlundin
No edit summary
 
m (Convert source tags to syntaxhighlight)
 
Line 6: Line 6:


== Syntax ==
== Syntax ==
<source lang="papyrus">
<syntaxhighlight lang="papyrus">
Function SetActorOwner(ActorBase akActorBase) native
Function SetActorOwner(ActorBase akActorBase) native
</source>
</syntaxhighlight>


== Parameters ==
== Parameters ==
Line 17: Line 17:


== Examples ==
== Examples ==
<source lang="papyrus">
<syntaxhighlight lang="papyrus">
; Clear ownership on the sword, which allows the player to take it without stealing it
; Clear ownership on the sword, which allows the player to take it without stealing it
SwordProperty.SetActorOwner(NONE)
SwordProperty.SetActorOwner(NONE)
</source>
</syntaxhighlight>
<br>
<br>
<source lang="papyrus">
<syntaxhighlight lang="papyrus">
; Set the player as the owner of the sword (other actors will "steal" it)
; Set the player as the owner of the sword (other actors will "steal" it)
SwordProperty.SetActorOwner(Game.GetPlayer().GetActorBase())
SwordProperty.SetActorOwner(Game.GetPlayer().GetActorBase())
</source>
</syntaxhighlight>
<br>
<br>
<source lang="papyrus">
<syntaxhighlight lang="papyrus">
; Make Bob the owner of the sword
; Make Bob the owner of the sword
SwordProperty.SetActorOwner(Bob.GetActorBase())
SwordProperty.SetActorOwner(Bob.GetActorBase())
</source>
</syntaxhighlight>


== See Also ==
== See Also ==
*[[ObjectReference Script]]
*[[ObjectReference Script]]
*[[GetActorOwner - ObjectReference]]
*[[GetActorOwner - ObjectReference]]

Latest revision as of 21:18, 5 September 2026

Member of: ObjectReference Script

Sets the actor base as the owner of this object.

Syntax[edit | edit source]

Function SetActorOwner(ActorBase akActorBase) native

Parameters[edit | edit source]

  • akActorBase: The ActorBase to set as this object's owner. If None, will clear ownership.

Return Value[edit | edit source]

None.

Examples[edit | edit source]

; Clear ownership on the sword, which allows the player to take it without stealing it
SwordProperty.SetActorOwner(NONE)


; Set the player as the owner of the sword (other actors will "steal" it)
SwordProperty.SetActorOwner(Game.GetPlayer().GetActorBase())


; Make Bob the owner of the sword
SwordProperty.SetActorOwner(Bob.GetActorBase())

See Also[edit | edit source]