raboni Posted July 28, 2014 Share Posted July 28, 2014 (edited) I'm making a house mod with a sorting chest that moves everything in it to different places in the house. I run into 2 problems when I do it,1. When i use ItemReference the object doesn't move but when i use BaseItem the item is added, but then the item is still in the sorting chest.2. When it is added to the mannequins inventory i can't make the mannequin equip it (while using EquipItem(akBaseItem)).I've searched to see if anyone else have had this problem but I can't find any. Any suggestions how to solve this? Script on sorting chest:Scriptname RABSSorter extends ObjectReference ;Variables GlobalVariable Property MannequinLBuilt Auto GlobalVariable Property MannequinRBuilt Auto ;Containers ObjectReference Property MannequinL1 Auto ObjectReference Property MannequinL2 Auto ObjectReference Property MannequinL3 Auto ;On Mannequins ;Non Armor Keyword Property VendorItemClothing Auto Keyword Property VendorItemJewelry Auto ;Normal Armor Keyword Property ArmorMaterialIron Auto Keyword Property ArmorMaterialSteel Auto Keyword Property ArmorMaterialEbony Auto Keyword Property ArmorMaterialDaedric Auto Keyword Property ArmorMaterialDragonscale Auto Keyword Property ArmorMaterialDragonplate Auto ;Guild Armor Keyword Property ArmorMaterialThievesGuild Auto Keyword Property ArmorDarkBrotherhood Auto Armor Property ArmorCompanionsCuirass Auto ;In Misc Containers Keyword Property VendorItemFood Auto Keyword Property VendorItemIngredient Auto ;Magic Keyword Property VendorItemScroll Auto Keyword Property VendorItemSoulGem Auto Keyword Property WeapTypeStaff Auto Keyword Property VendorItemSpellTome Auto ;On Weaponracks ;Bows Keyword Property WeapTypeBow Auto event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) if MannequinLBuilt if akBaseItem.HasKeyword(ArmorMaterialIron) MannequinL1.AddItem(akItemReference, aiItemCount, true) debug.notification("Item Sorted") endif endif endevent Edited July 28, 2014 by raboni Link to comment Share on other sites More sharing options...
IsharaMeradin Posted July 28, 2014 Share Posted July 28, 2014 Post the script you are working with. I have some ideas but I need to see what you are actually doing. Link to comment Share on other sites More sharing options...
raboni Posted July 28, 2014 Author Share Posted July 28, 2014 I made a mannequin and script duplicate just to mess with the coding and put debug notifications and here is it: Reveal hidden contents Scriptname RABSMannequinActivator extends Actor import debugimport utility Bool Property bResetOnLoad Auto Keyword Property VendorItemArmor Auto idle Property Pose01 Autoidle Property Pose02 Autoidle Property Pose03 Auto Form 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 hidden Form Property EmptySlot auto hidden 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} 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)EndEVENT EVENT OnEnable();Trace("DARYL - " + self + " Running OnEnable() EVENT")EquipCurrentArmor()endEVENT EVENT 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) EndEVENT Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer);Trace("DARYL - " + self + " Adding " + akBaseItem + " to the Mannequin") if (akBaseItem.HasKeyword(VendorItemArmor));Trace("DARYL - " + self + " Form " + akBaseItem + " is armor!")debug.notification("added")AddToArmorSlot(akBaseItem)self.EquipItem(akBaseItem)EquipCurrentArmor()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)endif endEvent Event OnObjectUnequipped(Form akBaseObject, ObjectReference akReference);Trace("DARYL - " + self + akBaseObject + " was unequipped by the Mannequin") if (akBaseObject.HasKeyword(VendorItemArmor));Trace("DARYL - " + self + " Form " + akBaseObject + " is armor!")RemoveFromArmorSlot(akBaseObject)debug.notification("unequipped")else;Trace("DARYL - " + self + " Form " + akBaseObject + " is NOT armor!")endifendEvent Function PlayCurrentPose()if CurrentPose == 1PlayIdle(Pose01)elseif CurrentPose == 2PlayIdle(Pose02)elseif CurrentPose == 3PlayIdle(Pose03)endifendFunction Function EquipCurrentArmor();Trace("DARYL - " + self + " Attempting to equip current armor")if (ArmorSlot01 != EmptySlot);Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 01")self.EquipItem(ArmorSlot01)debug.notification("equipped")endifif (ArmorSlot02 != EmptySlot);Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 02")self.EquipItem(ArmorSlot02)debug.notification("equipped")endifif (ArmorSlot03 != EmptySlot);Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 03")self.EquipItem(ArmorSlot03)debug.notification("equipped")endifif (ArmorSlot04 != EmptySlot);Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 04")self.EquipItem(ArmorSlot04)debug.notification("equipped")endifif (ArmorSlot05 != EmptySlot);Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 05")self.EquipItem(ArmorSlot05)debug.notification("equipped")endifif (ArmorSlot06 != EmptySlot);Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 06")self.EquipItem(ArmorSlot06)debug.notification("equipped")endifif (ArmorSlot07 != EmptySlot);Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 07")self.EquipItem(ArmorSlot07)debug.notification("equipped")endifif (ArmorSlot08 != EmptySlot);Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 08")self.EquipItem(ArmorSlot08)debug.notification("equipped")endifif (ArmorSlot09 != EmptySlot);Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 09")self.EquipItem(ArmorSlot09)debug.notification("equipped")endifif (ArmorSlot10 != EmptySlot);Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 10")self.EquipItem(ArmorSlot10)debug.notification("equipped")endifendFunction Function AddToArmorSlot(Form akBaseItem);Trace("DARYL - " + self + " Running the AddToArmorSlot Function") bool FoundEmptySlot = FALSE if (ArmorSlot01 == EmptySlot) && (FoundEmptySlot == FALSE);Trace("DARYL - " + self + " Placing " + akBaseItem + " in armor slot 01")ArmorSlot01 = akBaseItemFoundEmptySlot = TRUEdebug.notification("found slot")endif if (ArmorSlot02 == EmptySlot) && (FoundEmptySlot == FALSE);Trace("DARYL - " + self + " Placing " + akBaseItem + " in armor slot 02")ArmorSlot02 = akBaseItemFoundEmptySlot = TRUEdebug.notification("found slot")endif if (ArmorSlot03 == EmptySlot) && (FoundEmptySlot == FALSE);Trace("DARYL - " + self + " Placing " + akBaseItem + " in armor slot 03")ArmorSlot03 = akBaseItemFoundEmptySlot = TRUEdebug.notification("found slot")endif if (ArmorSlot04 == EmptySlot) && (FoundEmptySlot == FALSE);Trace("DARYL - " + self + " Placing " + akBaseItem + " in armor slot 04")ArmorSlot04 = akBaseItemFoundEmptySlot = TRUEdebug.notification("found slot")endif if (ArmorSlot05 == EmptySlot) && (FoundEmptySlot == FALSE);Trace("DARYL - " + self + " Placing " + akBaseItem + " in armor slot 05")ArmorSlot05 = akBaseItemFoundEmptySlot = TRUEdebug.notification("found slot")endif if (ArmorSlot06 == EmptySlot) && (FoundEmptySlot == FALSE);Trace("DARYL - " + self + " Placing " + akBaseItem + " in armor slot 06")ArmorSlot06 = akBaseItemFoundEmptySlot = TRUEdebug.notification("found slot")endif if (ArmorSlot07 == EmptySlot) && (FoundEmptySlot == FALSE);Trace("DARYL - " + self + " Placing " + akBaseItem + " in armor slot 07")ArmorSlot07 = akBaseItemFoundEmptySlot = TRUEdebug.notification("found slot")endif if (ArmorSlot08 == EmptySlot) && (FoundEmptySlot == FALSE);Trace("DARYL - " + self + " Placing " + akBaseItem + " in armor slot 08")ArmorSlot08 = akBaseItemFoundEmptySlot = TRUEdebug.notification("found slot")endif if (ArmorSlot09 == EmptySlot) && (FoundEmptySlot == FALSE);Trace("DARYL - " + self + " Placing " + akBaseItem + " in armor slot 09")ArmorSlot09 = akBaseItemFoundEmptySlot = TRUEdebug.notification("found slot")endif if (ArmorSlot10 == EmptySlot) && (FoundEmptySlot == FALSE);Trace("DARYL - " + self + " Placing " + akBaseItem + " in armor slot 10")ArmorSlot10 = akBaseItemFoundEmptySlot = TRUEdebug.notification("found slot")endifFoundEmptySlot = FALSEendFunction Function RemoveFromArmorSlot(Form akBaseItem);Trace("DARYL - " + self + " Running the RemoveFromArmorSlot Function") bool FoundMatchingSlot = FALSE if (ArmorSlot01 == akBaseItem) && (FoundMatchingSlot == FALSE);Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 01")ArmorSlot01 = EmptySlotFoundMatchingSlot = TRUEdebug.notification("removed from slot")endif if (ArmorSlot02 == akBaseItem) && (FoundMatchingSlot == FALSE);Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 02")ArmorSlot02 = EmptySlotFoundMatchingSlot = TRUEdebug.notification("removed from slot")endif if (ArmorSlot03 == akBaseItem) && (FoundMatchingSlot == FALSE);Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 03")ArmorSlot03 = EmptySlotFoundMatchingSlot = TRUEdebug.notification("removed from slot")endif if (ArmorSlot04 == akBaseItem) && (FoundMatchingSlot == FALSE);Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 04")ArmorSlot04 = EmptySlotFoundMatchingSlot = TRUEdebug.notification("removed from slot")endif if (ArmorSlot05 == akBaseItem) && (FoundMatchingSlot == FALSE);Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 05")ArmorSlot05 = EmptySlotFoundMatchingSlot = TRUEdebug.notification("removed from slot")endif if (ArmorSlot06 == akBaseItem) && (FoundMatchingSlot == FALSE);Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 06")ArmorSlot06 = EmptySlotFoundMatchingSlot = TRUEdebug.notification("removed from slot")endif if (ArmorSlot07 == akBaseItem) && (FoundMatchingSlot == FALSE);Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 07")ArmorSlot07 = EmptySlotFoundMatchingSlot = TRUEdebug.notification("removed from slot")endif if (ArmorSlot08 == akBaseItem) && (FoundMatchingSlot == FALSE);Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 08")ArmorSlot08 = EmptySlotFoundMatchingSlot = TRUEdebug.notification("removed from slot")endif if (ArmorSlot09 == akBaseItem) && (FoundMatchingSlot == FALSE);Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 09")ArmorSlot09 = EmptySlotFoundMatchingSlot = TRUEdebug.notification("removed from slot")endif if (ArmorSlot10 == akBaseItem) && (FoundMatchingSlot == FALSE);Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 10")ArmorSlot10 = EmptySlotFoundMatchingSlot = TRUEdebug.notification("removed from slot")endif endFunction Link to comment Share on other sites More sharing options...
IsharaMeradin Posted July 28, 2014 Share Posted July 28, 2014 I am already familiar with the mannequin script. Been managing sLuckyD's Vanilla Script Fix mod since he moved on from Skryim. Here is the relevant code from what you added to the first post.event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) if MannequinLBuilt if akBaseItem.HasKeyword(ArmorMaterialIron) MannequinL1.AddItem(akItemReference, aiItemCount, true) debug.notification("Item Sorted") endif endif endeventYou say you want to MOVE the item from the container and have the mannequin equip it.To move an item from one container to another you do not use AddItem. Instead use RemoveItem. Items moved or added via script for some reason do not trigger automatic equip such as they do when manually transferred via the container/inventory menu. To equip them, you will have to force equip the item with EquipItem. Side note: Mannequins by default only allow 10 items you may wish to setup some method of limiting how many items you transfer. Link to comment Share on other sites More sharing options...
raboni Posted July 28, 2014 Author Share Posted July 28, 2014 It's still as when i tested it the first time, when i change it to RemoveItem(akItemReference, aiItemCount, MannequinL1) it doesn't move the item to the mannequin. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted July 28, 2014 Share Posted July 28, 2014 Do not use akItemReference from the OnItemAdded event. That is only for persistent references. Most often you will be dealing non-persistent references. Use akBaseitem from the OnItemAdded event instead. i.e.RemoveItem(akBaseItem,aiItemCount,true,MannequinL1) MannequinL1.EquipItem(akBaseItem) Link to comment Share on other sites More sharing options...
raboni Posted July 29, 2014 Author Share Posted July 29, 2014 Thank you for the help it works now! Link to comment Share on other sites More sharing options...
cavbirdie Posted March 4, 2015 Share Posted March 4, 2015 This post has been a lot of help in figuring out what to do with my mod but, what if you don't want to remove the items to the Mannequin. use the mannequin as a display. i figured out how to do it if you have an entire set of armor (put the in the mann and disable the mannequin then enable it when complete.) and that works for most of he ones i'm working with but i have at last one mannequin that will be wearing bits and pieces not an outfit. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted March 5, 2015 Share Posted March 5, 2015 On 3/4/2015 at 4:24 PM, cavbirdie said: This post has been a lot of help in figuring out what to do with my mod but, what if you don't want to remove the items to the Mannequin. use the mannequin as a display. i figured out how to do it if you have an entire set of armor (put the in the mann and disable the mannequin then enable it when complete.) and that works for most of he ones i'm working with but i have at last one mannequin that will be wearing bits and pieces not an outfit.Create a hidden container. Put copies of the armor pieces inside. Remove the items from the hidden container & equip them. Is one way to work around the issue. Link to comment Share on other sites More sharing options...
Recommended Posts