GetRefsInCell

From GECK
Jump to: navigation, search


A function added by the New Vegas Script Extender.

Description

Similar to using GetFirstRefInCell and GetNextRef, and follows the same syntax. Returns an array containing all the references in the specified 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.GetRefsInCell Target:Cell FormTypeCode:int{0} CellDepth:int IncludeTakenRefs:bool{0} maxDistance:float{0} 

Example

; To get all the actors in the Goodsprings prospector saloon
array_var Saloon_Refs

let Saloon_Refs := GetRefsInCell GSProspectorSaloonInterior, 200

See Also