Jump to content

[LE] How to blow away the array limit in the creation kit.


Recommended Posts

This was used in a random generating dungeon mod I made years ago. This mod has an array setup that can handle 895 objects.
To set an OBJ to an array you simply call Self.CellCache(Obj) ... The array function will keep track and just add the new one to the stack.
In this case it is holding objects in the "mass array". But, this could be set up for any type.
Function CellCache() to set an object to the mass array.
Function ClearCache() remove/clean up mass array.

(Gave a function you didn't need and forget the set up ... facepalm. Let me try that again.)

Here is the whole thing ...

ObjectReference[] Property o1 Auto Hidden ;* object caches
ObjectReference[] Property o2 Auto Hidden ; 128 * 7 = 896 (895 max)
ObjectReference[] Property o3 Auto Hidden
ObjectReference[] Property o4 Auto Hidden
ObjectReference[] Property o5 Auto Hidden
ObjectReference[] Property o6 Auto Hidden
ObjectReference[] Property o7 Auto Hidden

Int oC = 0 ;objs ; cell/object (counter)
Int[] o1 ;*ref
Int[] o2 ;*ref
Int[] o3 ;*ref
Int[] o4 ;*ref
Int[] o5 ;*ref
Int[] o6 ;*ref
Int[] o7 ;*ref

o1 =(New ObjectReference[128])
o2 =(New ObjectReference[128])
o3 =(New ObjectReference[128])
o4 =(New ObjectReference[128])
o5 =(New ObjectReference[128])
o6 =(New ObjectReference[128])
o7 =(New ObjectReference[128])

;-----------------------
Function CellCache(ObjectReference Obj)
If(oC<(128))
o1[oC]=(Obj)
ElseIf(oC<(256))
o2[oC-(128)]=(Obj)
ElseIf(oC<(384))
o3[oC-(256)]=(Obj)
ElseIf(oC<(512))
o4[oC-(384)]=(Obj)
ElseIf(oC<(640))
o5[oC-(512)]=(Obj)
ElseIf(oC<(768))
o6[oC-(640)]=(Obj)
ElseIf(oC<(896))
o7[oC-(768)]=(Obj)
EndIf
oC+=(1)
EndFunction

;-----------------------
Function ClearCache()
Int r0=(0)
;---
r0=(o1.length)
While(r0)
r0-=(1)
If(o1[r0])
o1[r0].Delete()
o1[r0]=(None)
EndIf
EndWhile
r0=(o2.length)
While(r0)
r0-=(1)
If(o2[r0])
o2[r0].Delete()
o2[r0]=(None)
EndIf
EndWhile
r0=(o3.length)
While(r0)
r0-=(1)
If(o3[r0])
o3[r0].Delete()
o3[r0]=(None)
EndIf
EndWhile
r0=(o4.length)
While(r0)
r0-=(1)
If(o4[r0])
o4[r0].Delete()
o4[r0]=(None)
EndIf
EndWhile
r0=(o5.length)
While(r0)
r0-=(1)
If(o5[r0])
o5[r0].Delete()
o5[r0]=(None)
EndIf
EndWhile
r0=(o6.length)
While(r0)
r0-=(1)
If(o6[r0])
o6[r0].Delete()
o6[r0]=(None)
EndIf
EndWhile
r0=(o7.length)
While(r0)
r0-=(1)
If(o7[r0])
o7[r0].Delete()
o7[r0]=(None)
EndIf
EndWhile
Utility.Wait(1.0)
EndFunction



Sorry about the triple post ... drrr

Edited by NexusComa2
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...