How to properly delete an object reference

Post » Mon Jan 21, 2013 4:42 pm

Hi, I'm setting up a form called "TestForm" with a script on it called "TestScript". The script only has a property on it called "index". The i'm placing 2 copies of the forms at a marker and filling "index" of each. Then I want to delete these placed forms or object references.

Here's the script:

Spoiler
ObjectReference Property Marker AutoForm Property TestForm AutoForm Property Test1 AutoForm Property Test2 AutoEvent OnPlayerLoadGame()    Test1 = Marker.PlaceAtMe(TestForm)    Test2 = Marker.PlaceAtMe(TestForm)    (Test1 as TestScript).Index = 1    (Test2 as TestScript).Index = 2    objectreference tempref1 = (Test1 as objectreference)    objectreference tempref2 = (Test2 as objectreference)    Test1 = None    Test2 = None    tempref1.Delete()    tempref2.Delete()    Debug.MessageBox((tempref1 as TestScript).Index + " + " + (tempref2 as TestScript).Index)EndEvent

The message box still displays "1 + 2" as if they weren't deleted. From reading the wiki it appears I've meet the conditions to delete them.

I need to make sure I am deleting these object references before I can begin to start what I'm doing. Can anyone please help me assure that I am deleting them properly?
User avatar
Ronald
 
Posts: 3319
Joined: Sun Aug 05, 2007 12:16 am

Return to V - Skyrim