Talk:GetNthRef - Cell
Handling references without namesEdit
This function as well as GetNumRefs - Cell doesn't take names in account when you're looking for a specific type. Furthermore, if you narrow down the amount in order to fit an array(not doing so will take the array out of bounds) it will also fill the array with forms that don't have a name, if you're trying to fill an array based on names.
For handling the ones without names.. do this:
Actor property PlayerRef auto
Cell kCell = PlayerRef.GetParentCell()
Int n
Int iRefs = kCell.GetNumRefs(38) ; trees
Function SomeFunction()
While (n < iRefs)
ObjectReference kRefs = kCell.GetNthRef(n, 38)
if kRefs.GetBaseObject().GetName() ; by default, strings are true if they a not empty.
; add to alias, array, etc. ONLY filled with references that have names!
endif
n += 1
EndWhile
EndFunction
--Terra Nova2 (talk) 2015-02-28T07:11:07 (EST)
Peeking in another cell externallyEdit
So long as the previous cell you entered from was not an exterior cell(GetParentCell - ObjectReference will return none), you can use this function to walk through that cell while in another. --Rasikko (talk) 2018-01-06T13:51:10 (EST)
none refsEdit
It's best to check if each ref isn't none. --Rasikko (talk) 2021-09-30T16:07:18 (EDT)