RemoveMe

From the Fallout3 GECK Wiki
Jump to navigation Jump to search
< [[::Category:Functions|Category:Functions]]

A function included in the GECK version 1.1.0.36.

Description

Removes an object of the object's type from the inventory of the container that it is in (if applicable). If TargetContainerID is specified, a copy of the object is moved to the target container.

Syntax

[help]
RemoveMe TargetContainerID:ref

Example

short dispose ; 1 = Dispose of this object

Begin GameMode
   if dispose == 0
      set dispose to 1
      removeMe
   endif
End

Notes

  • In Fallout3.esm the only usage of this function is inside OnAdd blocks. If used outside of this block, RemoveMe may crash the game. Use DropMe instead.
  • This function acts as a "return" when called -- the lines of script following it will NOT be executed.
  • If there are multiple objects of the same type in the container (it is in a stack), the object that actually gets removed may be first one in the stack instead of the one that actually called the function.
  • This function does not display the "xxx has been removed." message.
  • If the removeMe TargetContainerID version of this function is used, the object placed in the target container will be a copy of the original object. The script variables of the copy will not be the same as the original.
  • This function preserves health, and charges associated with the object.

Bugs

  • If RemoveMe is called by an item in a non-persistent container, RemoveMe crashes the game. Use DropMe instead. If the calling item is inside a persistent container, the item will be removed, except if this container is the player. It does not cause crashes when used in the OnAdd block.
  • The removed object's GameMode block will continue to run for an undetermined amount of time after the RemoveMe function has been run.
  • The removed object will continue to think it is in its original container for an undetermined amount of time after the RemoveMe function has been run. I.e. If the object runs GetContainer, it will continue to receive a reference to the last container it was in.
  • If this function is called from within a GameMode, OnEquip, or OnUnequip block, the game will go into an infinite loop and freeze. This can be corrected by guarding the RemoveMe call with a variable that ensures the call will only be made once.
short dispose; 1 = Dispose of this object

BEGIN gameMode
   if dispose == 1
      set dispose to 0
      removeMe
   endif
END


The following note may not apply to the GECK.
Further information might be found in a section of the discussion page. Please remove this message when no longer necessary.
  • When this function is called inside the barter-menu (e.g. within an OnAdd Block) then the game will crash when the item with the script is stackable, you sell more than one of them and then switch from "sell" to "buy". To prevent this, either wait until the barter-screen closes (Menumode=1009) before removing the item or don't use such a script on stackable non-unique items.

See Also