Hoamaii Posted April 16, 2015 Share Posted April 16, 2015 Hi guys, What would be the surest way to delete a reference created with "PlaceAtMe" once the player has left the cell where this object was created? Use "OnCellDetach"? "OnUnload"? Both (to be safe)? According to the CKwiki, both have serious liability limitations... Link to comment Share on other sites More sharing options...
skinnytecboy Posted April 16, 2015 Share Posted April 16, 2015 You could create an initially disabled trigger outside of the cell that disables the reference I think. Not 100% as I have not tried it myself. In the cell where the reference is spawned you could create another trigger that enables the outside trigger Link to comment Share on other sites More sharing options...
Hoamaii Posted April 16, 2015 Author Share Posted April 16, 2015 Yeah, thanks, that'd work - though actually if it was limited to cell boundaries, "OnCellDetach" would work fine. The thing is - I should have mentioned it, sorry - that I'm trying to find a reliable way to do that not just in a few cells, but for all of Skryim world. Link to comment Share on other sites More sharing options...
sLoPpYdOtBiGhOlE Posted April 16, 2015 Share Posted April 16, 2015 TempReference.DeleteWhenAble()http://www.creationkit.com/DeleteWhenAble_-_ObjectReference Link to comment Share on other sites More sharing options...
Hoamaii Posted April 17, 2015 Author Share Posted April 17, 2015 Thanks man, my experience though is that "DeleteWhenAble" can cause a script to stall and following functions to be seriously delayed. "Delete()" works fine for the purpose I have. My main issue is to find a workaround the limitations of "OnUnload()" (like if you make a savegame before the 3D has had time to unload and that save is later loaded - then that 3D never unloads because it never was "loaded" by that save game) or "OnCellDeatch()" which can be triggered by crossing exterior cell boundaries even though the object is still in sight of the player -- maybe I should try something like "OnLostLOS"... Link to comment Share on other sites More sharing options...
sLoPpYdOtBiGhOlE Posted April 17, 2015 Share Posted April 17, 2015 (edited) Couple of ways to work around it maybe.Maybe instead of OnUnload() do OnCellLoad() and check the TempRef cell against the player cell eg: Event OnCellLoad() If TempRef If (!TempRef.Is3DLoaded()) && (TempRef.GetParentCell() != Game.GetPlayer().GetParentCell()) TempRef.Delete() TempRef = none EndIf EndIf EndEventIf you need to cache those TempRef for deletion due to there may be more then one delete needed: ObjectReference[] Property TempRef Auto ;Set your array property to the size you think suites. Function YourFunction() Int i = TempRef.Find(none) If i >= 0 TempRef[i] = Game.GetPlayer().PlaceAtMe(SomeForm) Else Debug.Notification("Hit TempRef Cache Limit") EndIf EndFunction Event OnCellLoad() Int i = 0 While i < TempRef.Length If TempRef[i] If (!TempRef[i].Is3DLoaded()) && (TempRef[i].GetParentCell() != Game.GetPlayer().GetParentCell()) TempRef[i].Delete() TempRef[i] = none EndIf EndIf i += 1 EndWhile EndEvent Edited April 17, 2015 by sLoPpYdOtBiGhOlE Link to comment Share on other sites More sharing options...
sLoPpYdOtBiGhOlE Posted April 17, 2015 Share Posted April 17, 2015 I was basing the above that your script is attached to the player side of things.I'd do it differently if your script is attached to the actual temp ref object that's being deleted. Link to comment Share on other sites More sharing options...
Recommended Posts