RemoveMe

Revision as of 07:49, 14 January 2008 by imported>Skyranger-1

Syntax:

RemoveMe TargetContainerID (optional) 

Example:

RemoveMe 
RemoveMe player 

Removes the calling object from the inventory of the container that it is in (if applicable). If TargetContainerID is specified, the object is moved to the target container.


Notes:

  • This function acts as a "return" when called -- the lines of script following it will NOT be executed (since it has just destroyed itself in the process of removing itself from inventory).
  • This function does not display the "xxx has been removed." message.
  • When using RemoveMe right after the object has been added, you might get random crashes. To prevent this wait more than one frame before you remove the item. A counter to 10 that delays the RemoveMe command, increasing one step on every MenuMode or GameMode, should do the trick.
  • When RemoveMe can be 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.
  • This function preserves script variables, health, and charges associated with the item.
  • Calling this function within blocks like onEquip and onUnequip can cause those blocks to loop repeatedly and is not recommended.
  • If RemoveMe is called by a scripted object that is stacked with others of its kind, the object removed can be a different item of the same stack, probably the first or last member of the stack.

See Also