MarkForDelete
A function included in the GECK for Fallout 3.
Contents
Description
MarkForDelete allows a script to set the delete flag on a disabled reference. The reference is placed in a queue for deletion a few frames later.
Whenever an object is disabled, it remains in memory. With items that can be dropped from inventory but work on their own, every drop and every pickup is a disable. Players could wrack up several hundred useless disabled objects in memory by the end of the game, each running a script (yes, disabled objects still run their scripts). This function will mark an object for future deletion. When the system does it's normal clean up, the object will be truly deleted, and it's script will no longer be active.
References created during gameplay, such as those dropped by an actor or something created with the PlaceAtMe function, are truly deleted. They no longer exist in any way.
References that are in the ESM or an ESP file can be marked for deletion, but are not truly deleted. However, the script on such objects is removed and no longer runs.
Syntax
[ObjectRefID].MarkForDelete
Example
PileOfBonesRef.Disable PileOfBonesRef.MarkForDelete
Notes
- MarkForDelete works without needing to disable the reference first BUT the deleted reference still be visible but frozen in place until the area is left. For this reason it's recommended you first run disable on references that have visuals.
- Should only be called on a reference that you want to get rid of (don't use this function if you plan on enabling it later)
- Useful to cleanup trigger volumes that are no longer needed.
- MarkForDelete may in some instances crash the game if used on a Inventory Reference. Use RemoveMeIRAlt instead to delete inventory references. Or use RemoveItem to delete a general amount of items from the inventory.
- MarkForDelete does not work with OnAdd code blocks (Will crash the game), instead use OnActivate, but be aware the activation/pickup prompt may be stuck on the screen for many seconds after doing this.
- Will work with items that have OnDrop code blocks.