Creationkit FO4 ReferenceCollection 5K object test
-
Total views819
About this image
Generate 5121 wooden boxes around the player and add them to a quest RefCollectionAlias with an OnLoad and OnUnload event driven script to (a) check distances agains uGridsToLoad and (b) see how long it takes to fire for all 5121 objects.
;*********************************************************
;Test Reference Collection Size
ObjectReference Property pPlayerREF Auto Const Mandatory
Container Property pWorkshop_WoodCrate Auto Const Mandatory
Keyword Property pSKK_testKeyword Auto Const Mandatory
ReferenceAlias Property Alias_TestRefCollection Auto
Function TestRefColSize()
Int iIndex = 0
Float fX
Float fY
Float fZ
ObjectReference ThisRef
While iIndex < 5121
ThisRef = pPlayerRef.PlaceAtme(pWorkshop_WoodCrate, 1, false, true, false) ;disabled until ready
Alias_TestRefCollection.AddRef(ThisRef)
ThisRef.SetLinkedRef(pPlayerRef, pSKK_testKeyword)
fX = Utility.RandomInt(-2048, 2048) as Float ;Cell 4096x4096
fY = Utility.RandomInt(-2048, 2048) as Float ;Cell 4096x4096
fZ = Utility.RandomInt(128, 2048) as Float
ThisRef.MoveTo(pPlayerRef, fX, fY, fZ )
ThisRef.Enable()
Debug.Trace ("SKK_TestrefColSize.AddRef " + iIndex + " " + ThisRef)
iIndex +=1
EndWhile
Debug.Trace ("SKK_TestrefColSize.GetCount " + Alias_TestRefCollection.GetCount() )
Debug.Trace ("SKK_TestrefColSize.CountRefsLinkedToMe " + pPlayerREF.CountRefsLinkedToMe(pSKK_testKeyword) )
iIndex = 0
While iIndex < 5121
ThisRef = Alias_TestRefCollection.GetAt(iIndex)
Debug.Trace ("SKK_TestrefColSize.GetAt " + iIndex + " " + ThisRef)
If ThisRef
ThisRef.SetLinkedRef(None, pSKK_testKeyword)
ThisRef.Disable()
ThisRef.Delete()
EndIf
iIndex +=1
EndWhile
Alias_TestRefCollection.RemoveAll()
Debug.Trace ("SKK_TestrefColSize.GetCount " + Alias_TestRefCollection.GetCount() )
Debug.Trace ("SKK_TestrefColSize.CountRefsLinkedToMe " + pPlayerREF.CountRefsLinkedToMe(pSKK_testKeyword) )
EndFunction
;*********************************************************