Background for Skyrim SE
Member of the Cell script
ObjectReferencefunctionGetNthRef(intn, intformTypeFilter=0)Native

Description

Wiki Description

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

Documentation Comment

returns the ref at the specified index


Caveats

CK Wiki - Notes

  • 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.

Parameters

intn

CK Wiki Description

The index at which the ObjectReference is located in the Cell with respect to the FormType filter.

intformTypeFilter=0

CK Wiki Description

Filters the list of which ObjectReferences are able to be retrieved, see Form.GetType() for a list of FormTypes.


Examples

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

Auto-Generated Example

int myInt__n
int myInt__formTypeFilter

ObjectReference returnedValue = myCell__toCallFunctionOn.GetNthRef(myInt__n, myInt__formTypeFilter)

Related Pages


Additional References

View this function’s page on the Skyrim Creation Kit Wiki

Some data provided by the Skyrim Creation Kit Wiki. Licensed under the Creative Commons Attribution-ShareAlike license.