IsFormValid

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search

A command for Oblivion Script Extender

Syntax:

(valid:bool) IsFormValid refVar:var

Returns 1 if the specified ref variable contains a valid object or reference.

Notes[edit | edit source]

  • When you activate a reference in the gameworld to pick it up the reference remains in the gameworld, but is disabled and marked for deletion from the savegame (unless it is a dynamic ref with mod index 0xFF, in which case it is deleted immediately).
When you save, quit, and reload, what happens depends on the persistence of the reference:
  • if non-persistent, the reference no longer exists (isFormValid returns false).
  • if persistent, the reference still exists (isFormValid returns true).
  • A similar result occurs if an ESM reference (or any form) is deleted from an ESP and you have that FormID stored. IsFormValid will return true because when the master is loaded, the original REFR record is deserialized into a form object. The override record in the ESP file only serves to set the deleted flag in that object. For references, IsRefDeleted does detect this scenario and will return true.