For the past few weeks I have struggled to figure out why some of my users were having compatibility issues regarding Mannequins and others were not. For some, running Vanilla Mannequin Script Fix with my mod causes CTDs on entering a home, with Mannequins that are enabled/disabled depending on whether or not the user has "built" that section of the home.
I fixed it on my end by removing the enable parents the Mannequins Shared, and instead switch to enabling/disabling them via scripting. After doing that the CTDs totally stopped for me, other users had no such luck, and it wasn't just people who updated the mod, but fresh installs as well.
SO, I decided to nip it in the bud by not using vanilla mannequins at all, but instead duplicating their base scripting and setup, and slightly altering my already existing enable/disable script to also take care of the wandering Mannequins issue. The new script worked perfect for keeping them still, but when trying to duplicate the vanilla script I simply cannot get it to compile. Here is the vanilla script:
Spoiler
Scriptname BB_BYOH_CustomMannequinScript extends Actorimport debugimport utilityidle Property Pose01 Autoidle Property Pose02 Autoidle Property Pose03 AutoForm Property ArmorSlot01 auto hiddenForm Property ArmorSlot02 auto hiddenForm Property ArmorSlot03 auto hiddenForm Property ArmorSlot04 auto hiddenForm Property ArmorSlot05 auto hiddenForm Property ArmorSlot06 auto hiddenForm Property ArmorSlot07 auto hiddenForm Property ArmorSlot08 auto hiddenForm Property ArmorSlot09 auto hiddenForm Property ArmorSlot10 auto hiddenForm Property EmptySlot auto hiddenMessage 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}EVENT OnCellLoad();Trace("DARYL - " + self + " Waiting a bit because it's the only way to get code to run in OnCellLoad it seems")wait(0.25);Trace("DARYL - " + self + " Cell is loaded so running OnCellLoad()");Trace("DARYL - " + self + " Enabling my AI so I can play an idle"); self.EnableAI(TRUE); While(Is3DLoaded() == FALSE); ;Trace("DARYL - " + self + " Waiting for my 3d to load"); wait(0.25); EndWhile;Trace("DARYL - " + self + " Calling EquipCurrentArmor() Function")EquipCurrentArmor();Trace("DARYL - " + self + " Blocking actors activation")self.BlockActivation();Trace("DARYL - " + self + " Moving to my linked ref")self.EnableAI(TRUE)MoveTo(GetLinkedRef());Trace("DARYL - " + self + " Checking what pose I should be in and playing the idle"); PlayCurrentPose();Trace("DARYL - " + self + " Waiting for a bit to give myself time to animate to the pose"); wait(0.5);Trace("DARYL - " + self + " Disabling my AI so I'll freeze in place")self.EnableAI(FALSE)EndEVENTEVENT OnEnable();Trace("DARYL - " + self + " Running OnEnable() EVENT")EquipCurrentArmor()endEVENTEVENT OnActivate(ObjectReference TriggerRef);Trace("DARYL - " + self + " Showing the acivate menu");int buttonpressed = MannequinActivateMESSAGE.Show(); if buttonpressed == 0;Trace("DARYL - " + self + " Player chose to Place Armor"); Player selected to open the Mannequin's InventoryPlayCurrentPose()self.OpenInventory(TRUE);Trace("DARYL - " + self + " Enabling AI since we are adding an item to the mannequin"); self.EnableAI(TRUE); elseif buttonpressed == 1;Trace("DARYL - " + self + " Player chose to Pose the Mannequin"); Player selected to change the pose;Trace("DARYL - " + self + " Enabling AI since we are about to play an idle"); self.EnableAI(TRUE);Trace("DARYL - " + self + " Checking which pose i'm in and playing the next idle/pose"); if CurrentPose == 1; PlayIdle(Pose02); CurrentPose = 2; elseif CurrentPose == 2; PlayIdle(Pose03); CurrentPose = 3; elseif CurrentPose == 3; PlayIdle(Pose01); CurrentPose = 1; endif; elseif buttonpressed == 2;Trace("DARYL - " + self + " Player chose to do nothing");do nothing; endif;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)EndEVENTEvent 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!")[b][color=#ff0000]AddToArmorSlot(akBaseItem)[/color][/b]self.EquipItem(akBaseItem)else;Trace("DARYL - " + self + " Form " + akBaseItem + " is NOT armor!");MessageBox("You can only place armor on the Mannequin.")MannequinArmorWeaponsMESSAGE.Show();WaitMenuMode(0.1)self.RemoveItem(akBaseItem, aiItemCount, true, Game.GetPlayer());Game.GetPlayer().AddItem(akBaseItem, aiItemCount, TRUE)endifendEventEvent 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!")[color=#ff0000][b]RemoveFromArmorSlot(akBaseObject)[/b][/color]else;Trace("DARYL - " + self + " Form " + akBaseObject + " is NOT armor!")endifendEventFunction PlayCurrentPose()if CurrentPose == 1PlayIdle(Pose01)elseif CurrentPose == 2PlayIdle(Pose02)elseif CurrentPose == 3PlayIdle(Pose03)endifendFunctionFunction EquipCurrentArmor();Trace("DARYL - " + self + " Attempting to equip current armor")if (ArmorSlot01 != EmptySlot);Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 01")self.EquipItem(ArmorSlot01)endifif (ArmorSlot02 != EmptySlot);Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 02")self.EquipItem(ArmorSlot02)endifif (ArmorSlot03 != EmptySlot);Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 03")self.EquipItem(ArmorSlot03)endifif (ArmorSlot04 != EmptySlot);Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 04")self.EquipItem(ArmorSlot04)endifif (ArmorSlot05 != EmptySlot);Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 05")self.EquipItem(ArmorSlot05)endifif (ArmorSlot06 != EmptySlot);Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 06")self.EquipItem(ArmorSlot06)endifif (ArmorSlot07 != EmptySlot);Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 07")self.EquipItem(ArmorSlot07)endifif (ArmorSlot08 != EmptySlot);Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 08")self.EquipItem(ArmorSlot08)endifif (ArmorSlot09 != EmptySlot);Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 09")self.EquipItem(ArmorSlot09)endifif (ArmorSlot10 != EmptySlot);Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 10")self.EquipItem(ArmorSlot10)endifendFunction
When I compile it, I receive an error telling me that "RemoveFromArmorSlot(akBaseObject) and AddToArmorSlot(akBaseItem) are not functions or do not exist"
Since I couldn't get the script to compile I thought I'd just ; those lines and saw what happened. Well, now every time I exit the area and return on cell reset the Mannequins remove their clothing. I tried fiddling around to see what may be causing it, whether it was my scripting for enabling/disabling, whether the encounter zone was set to No Respawn. Everything checks out, and the only visible issue is the two functions that don't compile.
I tried reading the script but can't make heads nor tales what those functions are for, how I can replace them, get them to compile, or why they may cause the mannequins to go commando on me.
Long story short: Why will this vanilla script not compile?