dylbill Posted October 5, 2020 Share Posted October 5, 2020 No problem. Actually I just did an experiment, and there is a way to fake multi dimensional arrays using papyrus by storing them on created object references. Here's the process I used: Create a new MiscItem, I just duplicated the LockPick and called it StorageMiscItem. Put a script on the StorageMiscItem that has an array property like so: Scriptname MiscStorageItemScript extends ObjectReference String[] Property StringArray Auto That's all the script needs. Then make a new empty cell, and drag one of the StorageMiscItem's into it. Edit the reference, uncheck the respawns box and change its ID name to StorageObjectRef, or any name you want so you can access it from another script. In another script, you can create new object references that have arrays stored because of the inherited script. Example of creating a 3X3 multi dimensional array: Scriptname QuestStorageScript extends Quest ObjectReference[] Property StorageObjects Auto ObjectReference Property StorageObjectRef Auto ;this is the object reference in the empty cell MiscObject Property StorageMiscItem Auto ;The misc item with the script attached Event OnInit() Utility.Wait(1) StorageObjects = New ObjectReference[128] Int I = -1 While I < 2 I += 1 StorageObjects[I] = StorageObjectRef.PlaceAtMe(StorageMiscItem, 1, 1, 0) ;create a new persistent storage item which contains a string array MiscStorageItemScript ScriptRef = StorageObjects[I] as MiscStorageItemScript ;access the storage item's script ScriptRef.StringArray = New String[3] ;initialize string array on storage item with 3 entries Int IA = -1 While IA < 2 IA += 1 ScriptRef.StringArray[IA] = ("Test " + I + " - " + IA) ;store string in storage item's string array EndWhile EndWhile Int IB = -1 String TestPrintout While IB < 2 IB += 1 MiscStorageItemScript ScriptRef = StorageObjects[IB] as MiscStorageItemScript ;access the storage item's script Int IC = -1 While IC < 2 IC += 1 TestPrintout += "\n" + ScriptRef.StringArray[IC] ;add new line plus storage string entry to printout string EndWhile EndWhile Utility.Wait(1) Debug.MessageBox(TestPrintout) EndEvent In short, you store an array on an a persistent object reference with its inherited script, and you store those object references in an array in another script. The advantage of doing this is that there's minimal setup, and can basically create arrays at runtime. To make a formlist of formlists, you need to create them first in the creation kit. You can also store multiple types of data on object references this way. Similar to how Bethesda added Structs in Fallout 4, just change the script attached to the StorageMiscItem to suit your needs. Example is let's say you wanted to store NPC families. You could change the script to this: Scriptname MiscStorageItemScript extends ObjectReference Actor Property Husband Auto Actor Property Wife Auto Actor[] Property Children AutoIn a quest script: Scriptname QuestStorageScript extends Quest ObjectReference[] Property StorageObjects Auto ObjectReference Property StorageObjectRef Auto MiscObject Property StorageMiscItem Auto Event OnInit() Utility.Wait(1) StorageObjects = New ObjectReference[128] EndEvent Event SomeEvent() Int EmptySlot = StorageObjects.Find(None) ;Finds empty array slot for new storage item If EmptySlot > -1 StorageObjects[EmptySlot] = StorageObjectRef.PlaceAtMe(StorageMiscItem, 1, 1, 0) ;create new storage item and store it in the array MiscStorageItemScript ScriptRef = StorageObjects[EmptySlot] as MiscStorageItemScript ScriptRef.Husband = SomeActor ScriptRef.Wife = SomeOtherActor ScriptRef.Children = New Actor[2] ;initialize array with 2 entries ScriptRef.Children[0] = SomeChildActor ScriptRef.Children[1] = AnotherChildActor EndEvent ;Then to Access Event SomeOtherEvent() MiscStorageItemScript ScriptRef = StorageObjects[0] as MiscStorageItemScript ;access first storage object in the array ScriptRef.Husband.SomeFunction() ScriptRef.Wife.SomeFunction() ScriptRef.Children[0].SomeFunction() ScriptRef.Children[1].SomeFunction() EndEvent The downside to doing this is that you're creating persistent object references, which if you create too many can cause save bloat problems. So just be cautious using this method and don't overdo it. Link to comment Share on other sites More sharing options...
maxarturo Posted October 5, 2020 Author Share Posted October 5, 2020 Thanks dylbill. But i'll come back to this later, right now i'm facing a major weird issue... Link to comment Share on other sites More sharing options...
Recommended Posts