GetActorOwner - Cell

From the CreationKit Wiki
Revision as of 01:56, 7 September 2015 by imported>Terra Nova2 (add note with a function to take in account for inherited cell ownership.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Member of: Cell Script

Gets the ActorBase that owns this cell. Will return None if the cell isn't owned by an actor.

Syntax

ActorBase Function GetActorOwner() native

Parameters

None.

Return Value

The ActorBase that owns this cell.

Examples

; Does the emperor's base actor own the non-life star?
bool ownsNonLifeStar = (NonLifeStarProperty.GetActorOwner() == Emperor.GetActorBase())

Notes

As this function doesn't return ownership for items in containers that also inherit ownership from the cell, you have to use the following function: Source

Actor Function GetInheritedOwner(ObjectReference aObj, ObjectReference aContainer)
  Actor owner = aObj.GetActorOwner()
  if !owner
    if aContainer
      owner = aContainer.GetActorOwner()
    endIf
    if !owner
      if aContainer
        owner = aContainer.GetParentCell().GetActorOwner()
      else
        owner = aObj.GetParentCell().GetActorOwner()
      endIf
    endIf
  endIf
  return owner
EndFunction

See Also