GetNumRefsInCell
A function added by the Fallout Script Extender.
Description
Returns the number of references of a given type in the specified cell. 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:
- Forms modified via SetScale / ModScale are treated as "taken"
- Same for forms that were Disabled at least once.
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
(numRefs:int) GetNumRefsInCell cell:baseform formtype:int cellDepth:int includeTakenRefs:0/1