Difference between revisions of "GetActorOwner - Cell"

Jump to navigation Jump to search
716 bytes added ,  01:56, 7 September 2015
add note with a function to take in account for inherited cell ownership.
imported>Rhavlovick
m (1 revision: Clobber re-import by Henning)
 
imported>Terra Nova2
(add note with a function to take in account for inherited cell ownership.)
 
Line 20: Line 20:
; Does the emperor's base actor own the non-life star?
; Does the emperor's base actor own the non-life star?
bool ownsNonLifeStar = (NonLifeStarProperty.GetActorOwner() == Emperor.GetActorBase())
bool ownsNonLifeStar = (NonLifeStarProperty.GetActorOwner() == Emperor.GetActorBase())
</source>
== 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: [http://forums.bethsoft.com/topic/1530780-wipz-skyrim-script-extender-skse/page-4#entry24300488 Source]
<source lang="papyrus">
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
</source>
</source>


Anonymous user

Navigation menu