dafydd99 Posted October 23, 2020 Share Posted October 23, 2020 Hi, I'm trying to track down why I'm getting these errors... [10/23/2020 - 02:41:27PM] error: Unable to call Is3DLoaded - no native object bound to the script object, or object is of incorrect typestack: [None].MannequinActivatorSCRIPT.Is3DLoaded() - "<native>" Line ? [None].MannequinActivatorSCRIPT.ResetPosition() - "MannequinActivatorSCRIPT.psc" Line 184 [None].MannequinActivatorSCRIPT.OnCellLoad() - "MannequinActivatorSCRIPT.psc" Line 108[10/23/2020 - 02:41:27PM] warning: Assigning None to a non-object variable named "::temp15"stack: [None].MannequinActivatorSCRIPT.ResetPosition() - "MannequinActivatorSCRIPT.psc" Line 184 [None].MannequinActivatorSCRIPT.OnCellLoad() - "MannequinActivatorSCRIPT.psc" Line 108 I get a total of around 20 sets of these every second on certain save files, and I'm concerned they're causing resources issues and potentially CTDs. How is it this has happened, and how are these events being called/created, if the objectreference in question is 'None'? These may or may not be coming from the mod I'm writing, but obviously there's no way to be sure. Is there a way to clean the save from scripting in the mod? Appreciate any help in this! Cheers - dafydd99 -- Mods - The Sidrat, The Dark and The Light Link to comment Share on other sites More sharing options...
ReDragon2013 Posted October 23, 2020 Share Posted October 23, 2020 (edited) You wrote: "I'm trying to track down why I'm getting these errors..."next loop is the culprit while !self.is3DLoaded() ; --> line 183, "MannequinActivatorSCRIPT.psc" Line 184 endWhileI assume you are running the mod "Unofficial Patch of Skyrim SE". Next script is the papyrus source of USLEEP mod "Skyrim Legendary", what should be nearly the same. MannequinActivatorSCRIPT Scriptname MannequinActivatorSCRIPT extends Actor ;This script has been extensively rewritten for the Unofficial Hearthfire Patch. ; ;No more armor duplication when adding things. ;No more armor that fails to display after being added and returning to the cell later. ;No more wandering about the cell. ;Player cannot accidentally place more on the mannequin than it has slots to hold things for, which would have caused the item to be unrecoverable. ;Cleared out all the junk comments that were making this a nightmare to read and debug. ;Automatically updates all mannequins as they are loaded. import debug import utility idle Property Pose01 Auto idle Property Pose02 Auto idle Property Pose03 Auto Form Property ArmorSlot01 auto hidden Form Property ArmorSlot02 auto hidden Form Property ArmorSlot03 auto hidden Form Property ArmorSlot04 auto hidden Form Property ArmorSlot05 auto hidden Form Property ArmorSlot06 auto hidden Form Property ArmorSlot07 auto hidden Form Property ArmorSlot08 auto hidden Form Property ArmorSlot09 auto hidden Form Property ArmorSlot10 auto hidden Form Property EmptySlot auto hidden Form[] ArmorSlot bool Converted Message Property MannequinActivateMESSAGE Auto {Message that appears upon activating the mannequin} Message Property MannequinArmorWeaponsMESSAGE Auto {Message that appears when you attempt to place a non-armor item} int Property CurrentPose = 1 Auto {The pose the Mannequin starts in, and is currently in. DEFAULT = 1} bool Property bResetOnLoad = FALSE Auto { this should be set to TRUE for mannequins that start disabled and are enabled while the cell is loaded DEFAULT = FALSE } Function ConvertArmorSlots() ArmorSlot = new Form[10] ArmorSlot[0] = ArmorSlot01 ArmorSlot01 = EmptySlot if( !IsDuplicated(ArmorSlot02) ) ArmorSlot[1] = ArmorSlot02 EndIf ArmorSlot02 = EmptySlot if( !IsDuplicated(ArmorSlot03) ) ArmorSlot[2] = ArmorSlot03 EndIf ArmorSlot03 = EmptySlot if( !IsDuplicated(ArmorSlot04) ) ArmorSlot[3] = ArmorSlot04 EndIf ArmorSlot04 = EmptySlot if( !IsDuplicated(ArmorSlot05) ) ArmorSlot[4] = ArmorSlot05 EndIf ArmorSlot05 = EmptySlot if( !IsDuplicated(ArmorSlot06) ) ArmorSlot[5] = ArmorSlot06 EndIf ArmorSlot06 = EmptySlot if( !IsDuplicated(ArmorSlot07) ) ArmorSlot[6] = ArmorSlot07 EndIf ArmorSlot07 = EmptySlot if( !IsDuplicated(ArmorSlot08) ) ArmorSlot[7] = ArmorSlot08 EndIf ArmorSlot08 = EmptySlot if( !IsDuplicated(ArmorSlot09) ) ArmorSlot[8] = ArmorSlot09 EndIf ArmorSlot09 = EmptySlot if( !IsDuplicated(ArmorSlot10) ) ArmorSlot[9] = ArmorSlot10 EndIf ArmorSlot10 = EmptySlot Converted = True EndFunction EVENT OnCellLoad() if( Converted == false ) ConvertArmorSlots() EndIf if IsEnabled() && !bResetOnLoad ResetPosition() ; ---> Line 107, "MannequinActivatorSCRIPT.psc" Line 108 endif EndEVENT EVENT OnLoad() if( Converted == false ) ConvertArmorSlots() EndIf if bResetOnLoad ; only do this once - for cases where mannequin is enabled in a loaded cell bResetOnLoad = false ResetPosition() endif endEVENT EVENT OnActivate(ObjectReference TriggerRef) if( Converted == false ) ConvertArmorSlots() EndIf PlayCurrentPose() self.OpenInventory(TRUE) ;Trace("DARYL - " + self + " Moving to my linked ref") MoveTo(GetLinkedRef()) ;Trace("DARYL - " + self + " Waiting a second to give me some time to animate to my pose") wait(0.1) ;Trace("DARYL - " + self + " Disabling my AI so i'll freeze in place") self.EnableAI(FALSE) EndEVENT Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) ;Trace("DARYL - " + self + " Adding " + akBaseItem + " to the Mannequin") if (akBaseItem as Armor) ;Trace("DARYL - " + self + " Form " + akBaseItem + " is armor!") if( !AddToArmorSlot(akBaseItem) ) ;Turn it back if the mannequin has one of these already, or if all the slots are full. self.RemoveItem(akBaseItem, aiItemCount, true, Game.GetPlayer()) Else self.EquipItem(akBaseItem) EndIf else ;Trace("DARYL - " + self + " Form " + akBaseItem + " is NOT armor!") MannequinArmorWeaponsMESSAGE.Show() self.RemoveItem(akBaseItem, aiItemCount, true, Game.GetPlayer()) endif endEvent Event OnObjectUnequipped(Form akBaseObject, ObjectReference akReference) ;Trace("DARYL - " + self + akBaseObject + " was unequipped by the Mannequin") if (akBaseObject as Armor) ;Trace("DARYL - " + self + " Form " + akBaseObject + " is armor!") RemoveFromArmorSlot(akBaseObject) else ;Trace("DARYL - " + self + " Form " + akBaseObject + " is NOT armor!") endif endEvent Function ResetPosition() ;Trace("DARYL - " + self + " Blocking actors activation") self.BlockActivation() ;Trace("DARYL - " + self + " Moving to my linked ref") self.EnableAI(TRUE) MoveTo(GetLinkedRef()) ;Trace("DARYL - " + self + " Calling EquipCurrentArmor() Function") ;Also needs to be enabled and fully loaded before armor equipping can happen while !self.is3DLoaded() ; --> line 183, "MannequinActivatorSCRIPT.psc" Line 184 endWhile EquipCurrentArmor() ;Trace("DARYL - " + self + " Disabling my AI so I'll freeze in place") self.EnableAI(FALSE) endFunction Function PlayCurrentPose() if CurrentPose == 1 PlayIdle(Pose01) elseif CurrentPose == 2 PlayIdle(Pose02) elseif CurrentPose == 3 PlayIdle(Pose03) endif endFunction Function EquipCurrentArmor() UnequipAll() int sn = 0 While( sn < 10 ) if( ArmorSlot[sn] != EmptySlot ) EquipItem(ArmorSlot[sn]) EndIf sn += 1 EndWhile endFunction bool Function IsDuplicated(Form ArmorItem) int sn = 0 while( sn < 10 ) if( ArmorSlot[sn] == ArmorItem ) return true EndIf sn += 1 EndWhile return False EndFunction bool Function AddToArmorSlot(Form akBaseItem) ;First check to see if this is already in a slot if( IsDuplicated(akBaseItem) ) return False EndIf ;Now find an emtpy slot to put it in, if there is one. int sn = 0 while( sn < 10 ) if( ArmorSlot[sn] == EmptySlot ) ArmorSlot[sn] = akBaseItem EquipItem(akBaseItem) return True EndIf sn += 1 EndWhile ;Nope. No room left. return False endFunction Function RemoveFromArmorSlot(Form akBaseItem) ;This loop will also clear duplicates that might have been generated. int sn = 0 while( sn < 10 ) if( ArmorSlot[sn] == akBaseItem ) ArmorSlot[sn] = EmptySlot EndIf sn += 1 EndWhile endFunction ; ############################################################ ;------------------------- Bool FUNCTION Is3DLoaded() ;------------------------- original idea by LukeH ; bugfix: override native function to wash out older savegame stacks // almost v2.1 by SLuckyD IF self.GetBaseObject() ; we have a valid mannequin RETURN parent.Is3DLoaded() ; // angepasst am 26.10.2020 // ; call the native function ENDIF ;--------- Debug.Trace(self+" Is3DLoaded() - older bad script instance was running.. bugfixed, state == '" +self.GetState()+ "'") Return TRUE ; give back a fake 3D ready value to abort savegame while loop ENDFUNCTION next code was added to wash out dirty script instances of "MannequinActivatorSCRIPT" ;------------------------- Bool FUNCTION Is3DLoaded() ;------------------------- original idea by LukeH ; bugfix: override native function to wash out older savegame stacks // almost v2.1 by SLuckyD IF self.GetBaseObject() ; we have a valid mannequin RETURN parent.Is3DLoaded() ; // angepasst am 26.10.2020 // ; call the native function ENDIF ;--------- Debug.Trace(self+" Is3DLoaded() - older bad script instance was running.. bugfixed, state == '" +self.GetState()+ "'") Return TRUE ; give back a fake 3D ready value to abort savegame while loop ENDFUNCTIONYou wrote: Is there a way to clean the save from scripting in the mod? You have to compile the whole source file MannequinActivatorSCRIPT.psc into a new executable file MannequinActivatorSCRIPT.pex Edited October 26, 2020 by ReDragon2013 Link to comment Share on other sites More sharing options...
dafydd99 Posted October 23, 2020 Author Share Posted October 23, 2020 Thank you, ReDragon2013 - that's very helpful indeed. As a mod developer, is this something I should be adding and overwriting to in my own mod (which feels wrong as it might break another mod in the load order if they modified it for another reason) or something I should just recommend the user do? Also - why is running at all? What removed the reference it should be attached to? It seems like the object no longer exists? Link to comment Share on other sites More sharing options...
ReDragon2013 Posted October 24, 2020 Share Posted October 24, 2020 (edited) you wrote: "is this something I should be adding and overwriting to in my own mod"NO! Do not do that. At first try it for your own saved game. If it works make a notice into your mod description, that these error can be happen by using "MOD xyz". And make a link to this forum post. you wrote: "why is running at all?"That's the question. Normally the event OnCellAttach() made trouble like this "[None].MannequinActivatorSCRIPT.Is3DLoaded() - "<native>" Line ?", so I cannot give a useful answer. for papyrus understanding: this while !self.is3DLoaded() endWhilehas the same logic as this while (self.is3DLoaded() == False) endWhile but keep in mind such a loop without any wait() inside may run very quickly again and again. This throttle down the runtime of papyrus engine. Edited October 24, 2020 by ReDragon2013 Link to comment Share on other sites More sharing options...
dafydd99 Posted October 24, 2020 Author Share Posted October 24, 2020 hm.... So on compiling a new version of MannequinActivatorSCRIPT I get the following messages... [10/24/2020 - 03:17:13AM] error: Failed to find variable Converted used in MannequinActivatorSCRIPT.OnCellLoad() [10/24/2020 - 03:17:13AM] warning: Function MannequinActivatorSCRIPT..OnCellLoad in stack frame 0 in stack 7992830 differs from the in-game resource files - using version from save [10/24/2020 - 03:17:13AM] warning: Function MannequinActivatorSCRIPT..ResetPosition in stack frame 1 in stack 7992830 differs from the in-game resource files - using version from save [10/24/2020 - 03:17:13AM] error: Failed to find variable Converted used in MannequinActivatorSCRIPT.OnCellLoad() [10/24/2020 - 03:17:13AM] warning: Function MannequinActivatorSCRIPT..OnCellLoad in stack frame 0 in stack 7992884 differs from the in-game resource files - using version from save [10/24/2020 - 03:17:13AM] warning: Function MannequinActivatorSCRIPT..ResetPosition in stack frame 1 in stack 7992884 differs from the in-game resource files - using version from save Followed later by... [10/24/2020 - 03:17:14AM] error: Unable to call Is3DLoaded - no native object bound to the script object, or object is of incorrect type stack: [None].MannequinActivatorSCRIPT.Is3DLoaded() - "<native>" Line ? [None].MannequinActivatorSCRIPT.ResetPosition() - "<savegame>" Line ? [None].MannequinActivatorSCRIPT.OnCellLoad() - "<savegame>" Line ? [10/24/2020 - 03:17:14AM] warning: Assigning None to a non-object variable named "::temp15" stack: [None].MannequinActivatorSCRIPT.ResetPosition() - "<savegame>" Line ? [None].MannequinActivatorSCRIPT.OnCellLoad() - "<savegame>" Line ? [10/24/2020 - 03:17:14AM] error: Unable to call Is3DLoaded - no native object bound to the script object, or object is of incorrect type stack: [None].MannequinActivatorSCRIPT.Is3DLoaded() - "<native>" Line ? [None].MannequinActivatorSCRIPT.ResetPosition() - "<savegame>" Line ? [None].MannequinActivatorSCRIPT.OnCellLoad() - "<savegame>" Line ? [10/24/2020 - 03:17:14AM] warning: Assigning None to a non-object variable named "::temp15" stack: [None].MannequinActivatorSCRIPT.ResetPosition() - "<savegame>" Line ? [None].MannequinActivatorSCRIPT.OnCellLoad() - "<savegame>" Line ? which would seem to imply it's not happy that the scripts baked into the savegame and the newly compiled one are the same. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted October 24, 2020 Share Posted October 24, 2020 What mods do you have that affect mannequins, add mannequins or remove mannequins? Cause it seems to me that some mannequins were removed while still active and loaded. Its the only explanation I can see that would keep the scripts in limbo. Link to comment Share on other sites More sharing options...
dafydd99 Posted October 24, 2020 Author Share Posted October 24, 2020 Hi IsharaMeradin - thanks for replying. I've got USSEP, Legacy of the Dragonborn, Wintersun, Inigo, Hearthfire adoptions and Alternate Start - plus the mod I'm creating 'The Sidrat'. As far as I'm aware none of these should affect the mannequins, though it's possible they might have included an old script? I know I have mannequins in my mod, 22 in total in the same cell. To my knowledge no mannequin has been removed however. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted October 24, 2020 Share Posted October 24, 2020 In working on your mod, did you ever have to make a "clean save"? (i.e. save the game, deactivate the mod, restart the game, save the game again, re-activate with updated changes) Have you tested to see if this behavior continues when starting a fresh new game? Link to comment Share on other sites More sharing options...
dafydd99 Posted October 25, 2020 Author Share Posted October 25, 2020 Hi IsharaMeradin - thanks again. Yes it's possible I have at some point - but I think many game hours before the problem showed itself. So presumably the game doesn't always strip all the scripts and assets from a save when the parent mod isn't activated. Possibly a script was being run when the save was made, keeping it 'alive'. and maybe therefore baking it in. I don't suppose anyone has documented the behaviour of 'saves' anywhere? It seems hard to predict! Presumably bethesda won't have been releasing alterations to their DLC to any great extent, so possibly the engine was never designed for community work. I'm trying to go through with a new save to see if I can get this behaviour to happen, but it hasn't yet. Link to comment Share on other sites More sharing options...
dafydd99 Posted October 26, 2020 Author Share Posted October 26, 2020 Looked again at the 'ReDragon2013' points above. So I did indeed have a broken version of the script from USSEP. I added the additional code as shown above - it did have a small bug in.... parent.Is3DLoaded --> parent.Is3DLoaded() after fixing that, it worked fine, and interestingly did replace the other script successfully, unlike the replacement script I had found which was presumably too different for it swap effectively. I got the below messages, and finally the script calmed down.... [10/26/2020 - 12:02:50PM] error: Unable to call GetBaseObject - no native object bound to the script object, or object is of incorrect type stack: [None].MannequinActivatorSCRIPT.GetBaseObject() - "<native>" Line ? [None].MannequinActivatorSCRIPT.Is3DLoaded() - "MannequinActivatorSCRIPT.psc" Line 263 [None].MannequinActivatorSCRIPT.ResetPosition() - "MannequinActivatorSCRIPT.psc" Line 184 [None].MannequinActivatorSCRIPT.OnCellLoad() - "MannequinActivatorSCRIPT.psc" Line 108 [10/26/2020 - 12:02:50PM] [MannequinActivatorSCRIPT <None>] Is3DLoaded() - older bad script instance was running.. bugfixed, state == '' So thanks again for all help. Cheers - dafydd99 Link to comment Share on other sites More sharing options...
Recommended Posts