Jump to content

problem when adding things to mannequins with script


raboni

Recommended Posts

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 by raboni
Link to comment
Share on other sites

I made a mannequin and script duplicate just to mess with the coding and put debug notifications and here is it:

 

  Reveal hidden contents

Link to comment
Share on other sites

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
endevent

You 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

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

  • 7 months later...

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

  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

  • Recently Browsing   0 members

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