Jump to content

Scripting Help - Removing Spawned Objects


Recommended Posts

I'm currently working on my next mod and as part of it I am using explosions to spawn activators. However these activators need to be deleted via a script once they have served their purpose. I'm using the FindClosestReferenceOfTypeFromRef() Function to detect these spawned Activators.

 

I'm getting a little frustrated as I am very close to releasing the mod but I want it to be as bug free as possible before release, unfortunately I am deleting the spawned Activators using a simple Delete() function but this doesn't seem to work completely. Although the visual marker of the activator is removed, subsequent uses of the FindClosestReferenceOfTypeFromRef() still returns the supposedly deleted Activator. So basically I am just wondering what alternate removal methods are a little more stable than delete() but maintain the same basic premise.

 

Feel free to ask any questions

 

Thanks

Edited by Madrilous
Link to comment
Share on other sites

Did you make sure that the object you want to delete doesn't fall into one of the categories listed at the beginning of this wiki page?

 

http://www.creationkit.com/Delete_-_ObjectReference

 

I did check these out but looking at them again I may not be clearing the variable used to store the reference, which I guess would fall under 'It is no longer in a script property'. Thanks for prompting me to look into this again, Ill give this a try and report how successful it was.

Link to comment
Share on other sites

  • 4 weeks later...

I'm currently working on my next mod and as part of it I am using explosions to spawn activators. However these activators need to be deleted via a script once they have served their purpose. I'm using the FindClosestReferenceOfTypeFromRef() Function to detect these spawned Activators.

 

I'm getting a little frustrated as I am very close to releasing the mod but I want it to be as bug free as possible before release, unfortunately I am deleting the spawned Activators using a simple Delete() function but this doesn't seem to work completely. Although the visual marker of the activator is removed, subsequent uses of the FindClosestReferenceOfTypeFromRef() still returns the supposedly deleted Activator. So basically I am just wondering what alternate removal methods are a little more stable than delete() but maintain the same basic premise.

 

Feel free to ask any questions

 

Thanks

 

I suggest that you use something like this to delete activators. Attach it to the activator itself.

 

scriptname deleteMe extends ObjectReference

event OnInit()
      utility.wait(10.0) ; change the wait time if you want.
      self.delete()
endEvent

 

Ten seconds after spawning, they are marked for deletion.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...