Talk:RemoveMe

From the Oblivion ConstructionSet Wiki
Revision as of 16:17, 10 July 2007 by imported>Scruggs (my experience)
Jump to navigation Jump to search

I've noticed some odd behavior with RemoveMe. If using a reference variable to specify the target container ID, the variable appears to be changed to a reference to the item that was moved, and no longer points to the target container. Can anyone confirm this, or is something really weird just happening to my scripting environment? -- Nezroy 23:47, 7 May 2006 (EDT)

Removeme isn't actually "Remove ME" but "Remove the top-most item from the stack where I'm in." So this might cause the problems.--JOG 04:18, 13 May 2006 (EDT)

Can anyone give some more specifics on when RemoveMe causes a CTD? I thought I had some problems with it when I first started modding, but now I can't even get a CTD when using RemoveMe and GetContainer is returning 0 (but still in a container) --Haama 14:18, 10 July 2007 (EDT)

I can't say exactly which situations will or will not cause CTD, but I can report instances where I've gotten consistent CTDs with removeMe:
  • Calling removeMe along with other functions within the same frame. For instance:
begin gameMode
  if ( someCondition )
    player.modAV health -1 ; these are just examples
    set gameHour to 10
    removeMe
    return
  endif
end
Resolving those types of CTDs meant making sure removeMe is the only function called within a frame and is always followed by a return:
begin gameMode
  if ( timeToRemoveTheItem )
    removeMe
    return
  endif
end
  • Calling removeMe immediately after the container/actor inventory has changed:
if ( timeToRemove )
  removeMe
  return
endif

thisContainer.addItem someItem ; or removeItem
set timeToRemove to 1
Fixed by adding a delay to the removeMe:
short timeToRemove
if ( timeToRemove < 0 )
  set timeToRemove to timeToRemove - 1
  if ( timeToRemove < -5 )
    removeMe
  endif
  return
endif

if ( someCondition )
  set timeToRemove to -1
endif
  • Calling removeMe when the item is in a creature's inventory, as opposed to an NPCs. Creatures always gave me more troubles. Adding a delay like above fixed it.
  • Calling removeMe as soon as the player enters the same cell as the container/actor which has the token (especially a problem with creatures). Fixed again by adding a delay.
:shrug: So, I always isolate the removeMe to a block of code all by itself at the top of the script, and always allow at least 5 frames to pass before calling it. Scruggs 17:17, 10 July 2007 (EDT)