GetNumRefs

From GECK
Jump to: navigation, search


A function added by the Fallout Script Extender.

Description

Returns the number of references of a given type in the currently loaded cell(s). 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 misnamed; 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]
(numRefs:int) GetNumRefs formType:int cellDepth:int includeTakenRefs:0/1 

See Also