GetNumRefsInCell
A function added by the Oblivion Script Extender.
Syntax:
(numRefs:int) GetNumRefsInCell cell:ref type:int cellDepth:int includeInactiveRefs:int
Works the same as GetNumRefs but takes an additional parameter specifying the cell to scan. Only counts persistent references if the cell is not loaded in memory.
The optional cellDepth argument is used outdoors to specify the radius of adjacent cells that will be scanned by this function.
This function is dynamic and indicates how many references of that type are in the cell currently, not necessarily how many were placed there in the Construction Set. This is particularly important (and useful) in counting the number of Actors (or Creatures or NPCs) in the cell. In the case of Actors, the player does not count against the total.
Temporary note
- As of OBSE 21 (March 2015), the compiler gives you an error if you use this function with LET ("let n := GetNumRefsInCell MyActorsCell 35"). Using SET is fine ("Set n to GetNumRefsInCell MyActorsCell 35"). If you have the latest version of OBSE and do not experience this problem, please remove this note, as it means the problem has been fixed.
Form Type Codes
The following values are shorts that are used and/or returned by this function, as indicated by its Syntax. These values correspond to the listed type of form:
0 None 1 TES4 2 Group 3 GMST 4 Global 5 Class 6 Faction 7 Hair 8 Eyes 9 Race 10 Sound 11 Skill 12 Effect 13 Script 14 LandTexture 15 Enchantment 16 Spell 17 BirthSign 18 Activator 19 Apparatus 20 Armor 21 Book 22 Clothing 23 Container 24 Door 25 Ingredient 26 Light 27 Misc 28 Stat 29 Grass 30 Tree 31 Flora 32 Furniture 33 Weapon 34 Ammo 35 NPC 36 Creature 37 LeveledCreature 38 SoulGem 39 Key 40 AlchemyItem 41 SubSpace 42 SigilStone 43 LeveledItem 44 SNDG 45 Weather 46 Climate 47 Region 48 Cell 49 REFR 50 ACHR 51 ACRE 52 PathGrid 53 WorldSpace 54 Land 55 TLOD 56 Road 57 Dialog 58 DialogInfo 59 Quest 60 Idle 61 Package 62 CombatStyle 63 LoadScreen 64 LeveledSpell 65 ANIO 66 WaterForm 67 EffectShader 68 TOFT 69 Actors 70 Inventory items