GetRefs

From GECK
Jump to: navigation, search


A function added by the New Vegas Script Extender.

Description

Similar to using GetFirstRef and GetNextRef, and follows the same syntax. Returns an array containing all the references in the currently loaded cell(s), optional only of a specific form type. The optional cell depth argument specifies how many local cells to scan; passing -1 will use the uGridsToLoad value from Fallout.ini to calculate this.

The IncludeTakenRefs option will return items that have been picked up. However, this option is bugged; if it isn't set to 1 (true), then a lot more than just taken refs will be filtered out. This much is certain:

If the formType is 0 (or left at default), then the player can be included (if they are in the given cell(s). However, if the type is 42 (NPC formType), then the player will be filtered out, since they are not considered as an NPC by the function, even though the player's BaseForm's type is NPC.

If maxDistance is 0 (or left at default), then no distance check is performed. Otherwise, references that are farther away from the calling reference than the maxDistance are filtered out.

  • NOTE: this distance checking only works if the references are currently loaded in a cell next to the player.

Syntax

[help]
(array) reference.GetRefs FormTypeCode:int{0} CellDepth:int{0} IncludeTakenRefs:bool{0} maxDistance:float{0} 

Example

; Simple example
array_var Cell_Refs

let Cell_Refs:= GetRefs

; Suppose you want all the actors currently loaded

array_var All_Actors

let All_Actors := GetRefs 200, -1

See Also