In the process of improving efficiency of some code in my campaign scripts, I came across the need to store some objects locally. And for the first time ever, I think I have understood something about GetIsObjectValid compared to a test against OBJECT_INVALID. So this is just some feedback, in case it helps others, and if others (who know better) can clarify my observations.
It was when I was using SetLocalObject, I learned (the hard way and then checking with the Lexicon to confirm) that an object stored on a Main PC is not persistent on a reload. At least, after a reload or two, this object will cease to be valid … but not in a way where testing against OBJECT_INVALID returns FALSE!
i.e. I had the need to write a check that did this …
if(oTEST != OBJECT_INVALID && !GetIsObjectValid(oTEST))
In other words, I was testing if the object was both valid (!= OBJECT_INVALID) and yet not a valid object (!GetIsValidObject(oTEST)) at the same time.
Basically, it seems the game will think an object is not an OBJECT_INVALID if it was “lost” somewhere between reloads, but is no longer valid because it is not actually the object it may have been before.
Anyway, I just thought I would post this, as this is the first real difference I have come to understand between the two functions.