Jump to content

How to break the 128 Array limmit


NexusComa

Recommended Posts

Here is a clip from one of my scripts with a 869 object array.

(made into a script to show placement)

 

 

 

 

Scriptname ARRAYS_TEST Extends ObjectReference
Int oC = 0 ; object counter
ObjectReference[] Property o1 Auto Hidden ; object caches
ObjectReference[] Property o2 Auto Hidden ;
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 x0 = 0x000B28B4 ; light rubble ... a test object to be put down
; 896 object array
Event OnInit()
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])
GoToState("Mainloop")
EndEvent
State Mainloop
Event OnBeginState()
; code
EndEvent
Event OnActivate(ObjectReference akActionRef)
; code
EndEvent
EndState
; an example of Objects being put down then added to the cache
Function SetObj(Int sObj,Int xPos,Int yPos,Int zPos,Int zAng)
ObjectReference Obj=(Game.GetPlayer().PlaceAtMe(Game.GetForm(sObj), 1, false, false))
Obj.SetPosition(xPos as Float, yPos as Float, zPos as Float)
Obj.SetAngle(0 as Float, 0 as Float, zAng as Float)
Self.CellCache(Obj)
EndFunction
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)
oC = 0
EndFunction

 

 

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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