Talk:IsInInterior - ObjectReference

From the CreationKit Wiki
Revision as of 03:31, 8 December 2014 by imported>Terra Nova2 (Added Chesko's method for getting around this function not checking for exteriors acting as interiors.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

IsInInteriorActual - ObjectReference

This function is created by Chesko, the author of Frostfall. I will copy/paste his instructions for this function here.




Hey everyone. So, if you haven't noticed by now, the IsInInterior() function can "lie" to you. Not in the strictest sense; it always lets you know if an area is technically an interior or not. The problem is that the designers at Bethesda occasionally use Exterior worldspaces that look, function, and for all practical purposes are, an interior. So, another method is required if you want to know if your ObjectReference is in a "functional" interior or not.

First, create a new FormList, which we are calling WorldspacesInteriors. Add the following Worldspace objects to the FormList:


  • AlftandWorld
  • Blackreach
  • BlindCliffCaveWorld
  • BloatedMansGrottoWorld
  • BluePalaceWingWorld
  • BrinewaterGrottoWorld
  • DarkwaterWorld
  • DeepwoodRedoubtWorld
  • EastEmpireWarehouse
  • EldergleamSancturaryWorld
  • FallowstoneCaveWorldStart
  • FrostmereCryptWorld
  • KatariahWorld
  • LabyrinthianWorld
  • LabyrinthianWorld03
  • LabyrinthianWorld04
  • MossMotherCavernWorld
  • RedEagleRedoubtWorld
  • ShadowgreenCavernWorld
  • SouthfringeWorld

Those are all of the worldspaces that I've identified from Skyrim.esm that look and act like interiors, even though their cells are classified as exterior. (If I missed one, let me know and I'll add it to the list!)

If you are using Dawnguard.esm as well with your mod, add the following as well:

  • DLC1AncestorsGladeWorld
  • DLC1DarkfallPassageWorld
  • DLC1ForebearsHoldout

(These could also be added to your FormList at runtime masterlessly, but that's beyond the scope of this tutorial)

Next, implement the following function in a script of your choice that needs this function:

FormList property WorldspacesInterior auto


bool function IsInInteriorActual(ObjectReference akObjectReference)
    if akObjectReference.IsInInterior()
	    return true
	else
        if WorldspacesInterior.HasForm(akObjectReference.GetWorldSpace())
			return true
		else
			return false
		endif
	endif
endFunction

Calling this function instead should reveal whether or not your ObjectReference is in an interior, even an exterior behaving like an interior.