Scriptname _00E_Func_WaitForRef Hidden

bool Function WaitForReferenceToLoad(ObjectReference ref, int iFramesToWait = 180) Global

    Int maxIterationsToWait = iFramesToWait
    While ref.Is3DLoaded() == False && maxIterationsToWait > 0
        maxIterationsToWait -= 1
    EndWhile
	
	return maxIterationsToWait > 0 || ref.Is3DLoaded()

EndFunction