Mator

gametomod export

Jan 3rd, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.95 KB | None | 0 0
  1. Event OnExport(string eventName, string strArg, float numArg, Form sender)
  2. startstackprofiling()
  3.     Cell celCurrent = (GetPlayer() as ObjectReference).GetParentCell()
  4.  
  5.     String strFileName = "GameToMod Export " + celCurrent.GetName()
  6.  
  7.     SetTextOptionValue(iExportOID, "Exporting...")
  8.  
  9. ;Trace("sFileName:" + sFileName)
  10.     CloseUserLog(strFileName)
  11.     OpenUserLog(strFileName)
  12.     TraceUser(strFileName, ";CELL;" + IntToHexString(celCurrent.GetFormID()) + ";" + celCurrent + ";" + celCurrent.GetName())
  13. ;   TraceUser(strFileName, ",ObjectID,FormID,Source Mod,Position.X,Position.Y,Position.Z,Rotation.X,Rotation.Y,Rotation.Z,XSCL - Scale,NAME - Base,FULL - Name,Enabled,Deleted,MotionType")
  14.  
  15.     CreateKeyframedOjectsList() ;populate the list of objects locked down with Jaxonz Positioner
  16.  
  17.     string sESPname
  18.     int iType = 1
  19.     int iModsBitField = giModsBitFields[iGVIndex].GetValueInt()
  20.     int iOptsBitField = giOptsBitField.GetValueInt()
  21.     iTypesBitField = giTypesBitField.GetValueInt()
  22.  
  23.     While iType < 135
  24.         If ShouldExport(iType)
  25.             int iRefs = celCurrent.GetNumRefs(iType) - 1
  26.             while iRefs > 0
  27.                 ObjectReference objRef = celCurrent.GetNthRef(iRefs, iType)
  28.                 int iModIndex = RightShift((objRef.GetBaseObject().GetFormID()),24)
  29.                 If iGVIndex != (iModIndex/20) as Int
  30.                     iGVIndex = (iModIndex/20) as Int
  31.                     iModsBitField = giModsBitFields[iGVIndex].GetValueInt()
  32.                 EndIf
  33. ;Trace("objRef:" + objRef + ", iModIndex:" + iModIndex + ", iGVIndex:" + iGVIndex + ", iTypesBitField:" + iTypesBitField + ", LogicalAnd(iTypesBitField, pow(2, iModIndex) as int):" + LogicalAnd(iTypesBitField, pow(2, iModIndex) as int))
  34.                 If LogicalAnd(iModsBitField, pow(2, iModIndex) as int)  ;if mod selected for export
  35.                     If ((objRef.GetFormID() <= 0) && LogicalAnd(iOptsBitField, 0x1)) || ((objRef.GetFormID() != 0) && LogicalAnd(iOptsBitField, 0x2))
  36.                         TraceUser(strFileName, ";" + IntToHexString(objRef.GetFormID()) + ";" + IntToHexString(objRef.GetBaseObject().GetFormID()) + ";" + GetModName(iModIndex) + ";" + RoundTo(objRef.X, 1) + ";" + RoundTo(objRef.Y, 1) + ";" + RoundTo(objRef.Z, 1) + ";" + FixAngle(objRef.GetAngleX(), 1) + ";" + FixAngle(objRef.GetAngleY(), 1) + ";" + FixAngle(objRef.GetAngleZ(), 1) + ";" + RoundTo(objRef.GetScale(),2) + ";" + objRef.GetBaseObject().GetName() + ";" + objRef.GetDisplayName() + ";" + objRef.IsEnabled() + ";" + objRef.IsDeleted() + ";" + IffString(flstKeyframed.HasForm(objRef),"4", "0"))
  37.                     Else
  38. trace("objRef.GetFormID():" + objRef.GetFormID() + ", iOptsBitField:" + iOptsBitField)
  39.                     EndIf
  40.                 EndIf
  41.                 iRefs -= 1
  42.  
  43.                 If iRefs % 10 == 0  ;show progress
  44.                     SetTextOptionValue(iExportOID, "Type " + iType + ", " + iRefs + " to go")
  45.                 EndIf
  46.             EndWhile
  47.         EndIf
  48.         iType += 1
  49.     EndWhile
  50.     MessageBox("Operation complete!\nCell data written to " + strFileName + ".0.log\nWhich can usually be found in the directory Documents\\my games\\skyrim\\Logs\\Script\\User")
  51.     SetTextOptionValue(iExportOID, "Create File")
  52. StopStackProfiling()
  53. EndEvent
Advertisement
Add Comment
Please, Sign In to add comment