Removing "Placeatme Objects"

From the Oblivion ConstructionSet Wiki
Revision as of 20:13, 23 August 2006 by imported>JOG (No tutorial, and I doubt everything works.)
Jump to navigation Jump to search

REMOVABLE PlaceAtMe OBJECTS by guidobot101


This is to over come the issues removing items placed in the game in 3D. The Disable method removes these objects while the player is not in the same Cell but they are saved (and reloaded) when the player moves back, even though you wouldn't know.

In this first example it is assumed that you placer object is just that, i.e. just there to be used as a marker for targetting or such.


Example #1

CODE


; creation
set placerRef to player.PlaceAtMe MyPlacer 1 50 0
; ...
; destruction
placerRef.Activate player
placerRef.RemoveMe


If you do Activate followed directly by RemoveMe it will work but any attached script will not be transferred. As stated on the CS Wiki you should ensure a frame click happens. In fact this is not appear to be actually necessary - you can achieve the same effect by having another script do the RemoveMe for you - it's just that the current script has to return.

In the following examples the same effect will work for scripted objects.

For example 2 the effect is split between the creator and target object.

CODE


scn MyPlacerScript

Begin GameMode

if GetContainer
  RemoveMe
endif

End


To use/destroy the object:


CODE


; creation
set placerRef to player.PlaceAtMe MyPlacer 1 50 0
; ...
; destruction
placerRef.Activate player


You can also get more imaginative but you may have some extra timing issues.

Example 3 requires a bit more work on the placer object:

CODE


short stage

Begin GameMode

if GetDisabled
  if stage == 0
    Activate player
    set stage to 1
  else
    RemoveMe
  endif
endif

End


Something like this may be useful for those that already have lots of PlaceAtMe objects. Since to use/destroy these objects:

CODE


; creation
set placerRef to player.PlaceAtMe 1 50 0
; ...
; destruction
placerRef.Disable


With all these examples you are well advised to experiment to se what works for you. It's possible that longer scripts may need some extra work, especially if you are using stackable items.