Jump to content

[LE] Export list of all objects in cell for each cell in worldspace?


Recommended Posts

Ok, now that part works, but I am getting the following error when compiling:

D:\proginstall\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\DbMiscFunctions.psc(66,25): variable PO3_SKSEFunctions is undefined

 

That is from your functions mod, right?

Link to comment
Share on other sites

Ok, so now it compiles!

 

I enabled logging and the debug trace stuff in the ini file, but when I start the game and COC int some random cell the message box that says that the script is finished immediatley appears.

There is nothing in the log files, except the usual log stuff.

Am I still missing something?

 

I used the "Tamriel" worldspace as a property, by the way.

 

Actually there is this line in the log:

[05/30/2022 - 10:37:07PM] error: Unbound native function "All" called

 

Your script uses the "all" thing to list all the objects.

How can I tell the game that "this is ok, ignore this 'error' "?

Edited by YouDoNotKnowMyName
Link to comment
Share on other sites

Ok, that worked!

But it wasn't really useful because one important thing is missing:

What cell the object is in!

 

Is it possible to also print the cell that the object is in?

 

So the output would look like this:

####################
All objects in cell -64,-64

RefId ObjectType PosX PosY PosZ RotX RotY RotZ Scale


####################
All objects in cell -63,-64
RefId ObjectType PosX PosY PosZ RotX RotY RotZ Scale

Or

RefId CellX CellY ObjectType PosX PosY PosZ RotX RotY RotZ Scale

How can I get the cell that an object is in?

So the X and Y numbers of the cell?

Link to comment
Share on other sites

Ok, but the CK wiki says:

  • If the reference is in an unloaded exterior cell, this function will return None.

So, if I coc into Riverwood and the script starts running would it only return valid data for all the currently loaded cells?

(those around riverwood)

Link to comment
Share on other sites

Hmm, yes that's correct. Here's another method that's similar to the first one I posted. Use Papyrus Extender to get all cells in game, then print the cell data if it's in your world space:

WorldSpace Property MyWorldSpace Auto

Event OnInit()
    Form[] AllCells = PO3_SKSEfunctions.GetAllForms(60) ;get all cells in game
    int i = AllCells.Length
    While i > 0 
        i -= 1 
        Cell CurrentCell = AllCells[i] as Cell 
        If CurrentCell
            ObjectReference Obj = CurrentCell.GetNthRef(0) ;get first ObjectReference in cell
            If Obj 
                If Obj.GetWorldSpace() == MyWorldSpace 
                    TraceCellObjData(CurrentCell) 
                Endif 
            Endif
        EndIf 
    EndWhile
EndEvent

Function TraceCellObjData(Cell akCell)
    Debug.Trace("Cell ID: " + DbMiscFunctions.ConvertIntToHex(akCell.GetFormId()))
    Int i = akCell.GetNumRefs() 
    While i > 0 
        i -= 1 
        ObjectReference Obj = akCell.GetNthRef(i) 
        String S = (Obj.GetType() + " " + DbMiscFunctions.ConvertIntToHex(Obj.GetFormId()) + " " + Obj.GetDisplayName() + " " + Obj.GetPositionX() + " " + Obj.GetPositionY() + " " + Obj.GetPositionZ() + \
        " " + Obj.GetAngleX() + " " + Obj.GetAngleY() + " " + Obj.GetAngleZ() + " " + Obj.GetScale())
        
        Debug.Trace(S)
    EndWhile
EndFunction

Requires SSE as well.

Link to comment
Share on other sites

Wow, thanks!

 

My approach would have been to go in the game, enter TCL, fly up a lot.

Then activate the script.

The script would print out all the objects in the current cell then move the player one cell to the left (something like this modposX or modpoxY console command) then read in all the objects from that cell and so on for every cell in the worldspace.

 

But your approach is (of course) better!

 

(The script is running right now ...)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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