Difference between revisions of "GetNumRefs - Cell"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>PurpleLunchbox
(Created page with "Category:Scripting Category:Papyrus Category:SKSE '''SKSE Member of:''' Cell Script Returns the number of ObjectReferences in the Cell based on the FormType f...")
 
imported>Thynar
 
(3 intermediate revisions by 2 users not shown)
Line 12: Line 12:


== Parameters ==
== Parameters ==
*formTypeFilter: FormType filter to return the number of a specific form type see [[Form - GetType]] for a list of FormTypes
*formTypeFilter: FormType filter to return the number of a specific form type see [[GetType - Form]] for a list of FormTypes.


== Return Value ==
== Return Value ==
Line 20: Line 20:
*Using a filter type of zero results in returning all object references in the cell.
*Using a filter type of zero results in returning all object references in the cell.
*If using a filter type make sure to use the same filter when retrieving the references.
*If using a filter type make sure to use the same filter when retrieving the references.
*If the cell that references are called from is not loaded, non-persistent references will not be called.


== Examples ==
== Examples ==
<source lang="papyrus">
<source lang="papyrus">Function PickEveryFlowerInCell(Actor akFlowerPicker) Global
int numFlora = Cell.GetNumRefs(39) ; kFlora = 39
Cell kCell = akFlowerPicker.GetParentCell()
int index = 0
Int iIndex = kCell.GetNumRefs(39) ; kFlora = 39
While index < numFlora
While iIndex
ObjectReference objRef = Cell.GetNthRef(index, 39)
iIndex -= 1
Debug.Trace("Flora Found in cell: " + objRef)
kCell.GetNthRef(iIndex, 39).Activate(akFlowerPicker)
index += 1
EndWhile
EndWhile
EndFunction</source>
</source>


== See Also ==
== See Also ==
*[[Cell Script]]
*[[Cell Script]]
*[[GetNthRef - Cell]]
*[[GetNthRef - Cell]]
*[[Form - GetType]]
*[[GetType - Form]]

Latest revision as of 09:49, 6 January 2020

SKSE Member of: Cell Script

Returns the number of ObjectReferences in the Cell based on the FormType filter. (This function requires SKSE)

Syntax[edit | edit source]

int Function GetNumRefs(int formTypeFilter = 0) native

Parameters[edit | edit source]

  • formTypeFilter: FormType filter to return the number of a specific form type see GetType - Form for a list of FormTypes.

Return Value[edit | edit source]

Returns the number of ObjectReferences in the Cell based on the FormType filter.

Notes[edit | edit source]

  • Using a filter type of zero results in returning all object references in the cell.
  • If using a filter type make sure to use the same filter when retrieving the references.
  • If the cell that references are called from is not loaded, non-persistent references will not be called.

Examples[edit | edit source]

Function PickEveryFlowerInCell(Actor akFlowerPicker) Global
	Cell kCell = akFlowerPicker.GetParentCell()
	Int iIndex = kCell.GetNumRefs(39) ; kFlora = 39
	While iIndex
		iIndex -= 1
		kCell.GetNthRef(iIndex, 39).Activate(akFlowerPicker)
	EndWhile
EndFunction

See Also[edit | edit source]