Difference between revisions of "GetNthRef - Cell"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>JustinOther
(→‎Examples: Reworked example (kCell.CellFunction() vs. Cell.CellFunction()))
imported>Thynar
 
Line 21: Line 21:
*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 determining the maximum amount.
*If using a filter type make sure to use the same filter when determining the maximum amount.
*If the cell that references are called from is not loaded, non-persistent references will not be called.


== Examples ==
== Examples ==

Latest revision as of 09:50, 6 January 2020

SKSE Member of: Cell Script

Returns the ObjectReference at the Nth index in the Cell based on the FormType filter. (This function requires SKSE)

Syntax[edit | edit source]

ObjectReference Function GetNthRef(int n, int formTypeFilter = 0)

Parameters[edit | edit source]

  • n: The index at which the ObjectReference is located in the Cell with respect to the FormType filter.
  • formTypeFilter: Filters the list of which ObjectReferences are able to be retrieved, see GetType - Form for a list of FormTypes.

Return Value[edit | edit source]

Returns the ObjectReferences in the Cell at the Nth index 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 determining the maximum amount.
  • 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]