Jump to content

[LE] Mannequins that are already dressed on cell load


cumbrianlad

Recommended Posts

Hi.

 

I've battered my brain into squidgy mush with this one.

 

 

The thing is, I've tried all sorts and not been able to equip the mannequins with stuff in their inventory. Each mannequin I've tried this with has been duplicated and renamed to ketilMannequin01 etc.

 

Here's what doesn't work for me...

 

Editing the base and adding armour sets (custom or vanilla) to the default outfit. This shows up as worn in the render window but not in game. I've seen that posted as a solution elsewhere...it doesn't work.

Adding items of armour to their inventory, changing their race so that I can check the 'use inventory' box. These mannequins appear in game as their new race but unclothed.

I've tried running a quest and adding the armour to an alias inventory linked to the mannequin. This didn't work either although I may have made an error with how the quest was set up

 

When I add armour to the mannequins inventory, it shows up in game when the mannequin is talked to and I can take them and equip them so that it then shows up on the mannequins, so I've not made any basic errors with the mannequin set-up.

 

The obvious fix (for somebody who knows their scripting, which isn't me, alas) would be to make alterations to the DefaultActivateMannequin script, because disabling this script from the working mannequin results in a mannequin dressed in the default armour that I give it, except that it spookily turns its wooden head to look at you and of course I couldn't take its armour unless it was dead.

 

The quest attempt was done by following Hellcat5's guide to the letter. Unfortunately the tutorial doesn't show how he set up the quest that runs to dress them, except for the part about setting up the aliases. I may have made a mistake in setting up the quest. My location (both interior and exterior) is set up to the exterior map marker (Hellcat5 uses an XMarker for this). I have set an encounter zone for the location interior. I added a stacked branch node to the dungeons section for my quest. The 'shares event' checkbox is ticked. the only condition I added was:

 

S GetInCurrentLocation Location: KetilbjornsFrestLocation == 1.00 AND

 

The quest itself has priority 60, is a ChangeLocationEvent (I've tried it with no event type assigned too) and has only stage 0 set up with the 'start up' box checked. The 'StartOnGameEnabled' box is checked. I tried using quest type miscellaneous and 'Side Quests'. Neither work

 

Does anybody know what I've missed or got wrong with the quest? Is there a script that I can add to the Mannequins that allows items added to the inventory in the CK to be worn? Maybe some clever person has written a script to replace the vanilla item. Such a thing would bring vast joy to this beleaguered soul this festive season! (I'm easily pleased)

 

By the way, I haven't added any navmesh yet and I read that that messes with mannequins but from the script, it looks like the navmesh is only needed for them to head for their locations in the cell and wouldn't have any effect on how they equip/unequip armour. Maybe I'm wrong on that.

 

 

 

Link to comment
Share on other sites

Oh, you are trying to have items already in the mannequins inventory be used by the mannequin. That won't happen while keeping the mannequin as a mannequin. The problem is that under this scenario the game doesn't know the contents of their inventory until it has been accessed by the player.

 

If you start fresh with a container placed beneath the floor, you can apply a script to the container that will transfer the items to the mannequin when the cell is loaded or attached for the first time. The mannequin will then equip them as the items will trigger the OnItemAdded event on its script. However, with this method if the mannequin is in view of the door that the player enters, the player might be able to see the mannequin equip the items.

Link to comment
Share on other sites

IsharaMeradin,

 

You are whispering magic into my ears!

 

The mannequins are well into the dungeon, so there's no chance of your magic being witnessed!

 

My only problem is that I'm as much good with scripts as I am on doing a handstand supported by only my little finger...in other words, I suck!

 

First, I'd need the script, because I'm frankly clueless about that.

 

Second, and just to be clear, once I have your marvellous script, I take it that the script is applied to each individual chest. Then I would make a unique chest for each mannequin. Each mannequin also has a unique reference. Then, if I link the chest for 'KetilMannChest01' to 'KetilMann01', it gets its armour. Likewise with 'KetilMannChest02' and 'KetilMann02', etc.

 

Please, please, please tell me that you have just such a marvellous script at your disposal!

 

You have my apologies for my enthusiasm, but this is making me tear out what little hair I have left!

Link to comment
Share on other sites

No, I don't have such a script. But off the top of my head you can try this... Keep in mind that it has not been tested for compilation or function. Also there may be room for improvement.

 

 

ScriptName SomeScript Extends ObjectReference
 
Actor Property MyMannequin Auto
 
Auto State RunOnlyOnce
Event OnCellLoad()
  RemoveAllItems(MyMannequin)
  GoToState("TheRemainderOfTheGame")
EndEvent
EndState
 
State TheRemainderOfTheGame
;empty so that default OnCellLoad event runs
EndState

 

 

And if for some reason it doesn't work, try doing it without the states. And if that doesn't work, then it is the same issue where the engine doesn't recognize what is in the container. I think RemoveAllItems should work, but I do know that several other container related functions do not when the objects were added by the CK and the container has yet to be accessed by the player.

 

Test it with just one instead of applying it to all of them at once. Put the script on the container and assign the mannequin to the property. Then test on a new game or a save that hasn't seen the mod in question.

 

EDIT: GoToState needed quotes around the state name.

Edited by IsharaMeradin
Link to comment
Share on other sites

An alternative method that would bypass any of the container related issues with CK added items would be to use an array or formlist to hold the base forms of the objects you wish the mannequin to equip. This type of script could go on an xMarker dedicated to the mannequin or with careful scripting one xMarker for all of your mannequins. The latter would have to be done by someone who knows the mod in detail but the former...

 

This is the array method. All it requires is your mannequin and an object to attach the script to. It could be an xMarker or it could even be the pedestal that they are standing on. The armor array is to be filled with the armor you want the mannequin to wear. This is done in the properties window.

 

 

Scriptname SomeScript Extends ObjectReference
 
Armor[] Property ArmorList Auto
Actor Property MyMannequin Auto
 
Auto State RunOnlyOnce
Event OnCellLoad()
  Int Size = ArmorList.Length
  Int ix = 0
  While ix < Size
    MyMannequin.AddItem(ArmorList[ix],1)
    ix += 1
  EndWhile
  GoToState("RestOfTheGame")
EndEvent
EndState
 
State RestOfTheGame
;empty so that the default OnCellLoad event runs
EndState

 

 

 

Link to comment
Share on other sites

I tried the first version out both ways with no joy. Looks like there is a problem with chests and mannequins.

 

I tried the array method with partial success...still, that's a lot better than no success!

 

The mannequin wears the last of the four items in the array, but not the first three.

 

I took out the While/Endwhile loop and added each item from the array with individual lines, so that I could change the last item added. Sure enough, whichever item is added last by the script is the only one that the mannequin is wearing on entering the cell. I wondered if there needs to be a time delay between adding each item to allow the script on the mannequin to act. If it doesn't complete before getting the next instruction from my script, it simply starts over again, so the only one it executes properly is the last instruction.

 

So, something like...

 

While ix < size

KetilMannequin01.additem(ArmourList01[ix],1)

utility.wait(0.3)

ix += 1

EndWhile

 

Edit. No luck. The darned thing's still wearing nothing but its boots...what an exhibitionist!

Link to comment
Share on other sites

A few years ago I was playing around with the idea of a home that the player could teleport into when they dropped an item which represented a bag of holding to the ground. Objects that had been stored in the bag of holding would be found populated throughout the cell. Part of the process was mannequins which would equip various armor pieces and it worked. I just found that script in my stash of 'script concepts'. Perhaps something in there might be useful to you. Obviously it won't work out of the box, but perhaps the way it is coded might shed some light.

 

 

 

Scriptname abimMannequinGearControllerScript extends ObjectReference  

FormList Property abimShields Auto
FormList Property abimArmorBoots Auto
FormList Property abimArmorCuirass Auto
FormList Property abimArmorGauntlets Auto
FormList Property abimArmorHelmet Auto
FormList Property abimClothingBody Auto
FormList Property abimClothingCirclet Auto
FormList Property abimClothingFeet Auto
FormList Property abimClothingHands Auto
FormList Property abimClothingHead Auto
ObjectReference[] Property Mannequin Auto
ObjectReference Property Source Auto
ObjectReference Property Temp Auto
Int MannIndex

Function GetItems(FormList TheList)
	Int Num = Source.GetItemCount(TheList)
	If Num > 0
		Source.RemoveItem(TheList,Num,true,Temp)
	EndIf
EndFunction

Function ReturnItems(FormList TheList)
	(Mannequin[MannIndex] as Actor).UnequipAll()
	Int Num = Mannequin[MannIndex].GetItemCount(TheList)
	If Num > 0
		Mannequin[MannIndex].RemoveItem(TheList,Num,true,Temp)
	EndIf
EndFunction

bool Function PlaceItem(Int Index, Int Total, FormList TheList)
	While Index < Total
		Form Entry = TheList.GetAt(Index)
		If (Temp.GetItemCount(Entry) > 0)			
			Temp.RemoveItem(Entry,1,true,Mannequin[MannIndex])
			Index = Total
			return true
		Else
			Index += 1
		EndIf
	EndWhile
	return false
EndFunction

Event OnCellAttach()
	MannIndex = 0
	GetItems(abimShields)
	GetItems(abimArmorBoots)
	GetItems(abimArmorCuirass)
	GetItems(abimArmorGauntlets)
	GetItems(abimArmorHelmet)
	GetItems(abimClothingBody)
	GetItems(abimClothingCirclet)
	GetItems(abimClothingFeet)
	GetItems(abimClothingHands)
	GetItems(abimClothingHead)

	Int MannArray = Mannequin.Length
	Int ShieldTotal = abimShields.GetSize()
	Int ArmorBootsTotal = abimArmorBoots.GetSize()
	Int ClothingFeetTotal = abimClothingFeet.GetSize()
	Int ArmorCuirassTotal = abimArmorCuirass.GetSize()
	Int ClothingBodyTotal = abimClothingBody.GetSize()
	Int ArmorGauntletsTotal = abimArmorGauntlets.GetSize()
	Int ClothingHandsTotal = abimClothingHands.GetSize()
	Int ArmorHelmetTotal = abimArmorHelmet.GetSize()
	Int ClothingHeadTotal = abimClothingHead.GetSize()
	Int ClothingCircletTotal = abimClothingCirclet.GetSize()

	While (MannIndex < MannArray)
		ReturnItems(abimShields)
		ReturnItems(abimArmorBoots)
		ReturnItems(abimArmorCuirass)
		ReturnItems(abimArmorGauntlets)
		ReturnItems(abimArmorHelmet)
		ReturnItems(abimClothingBody)
		ReturnItems(abimClothingCirclet)
		ReturnItems(abimClothingFeet)
		ReturnItems(abimClothingHands)
		ReturnItems(abimClothingHead)


		;shields
		PlaceItem(0,ShieldTotal,abimShields)

		;feet
		If PlaceItem(0,ArmorBootsTotal ,abimArmorBoots)
		ElseIf PlaceItem(0,ClothingFeetTotal ,abimClothingFeet)
		EndIf

		;body
		If PlaceItem(0,ArmorCuirassTotal ,abimArmorCuirass)
		ElseIf PlaceItem(0,ClothingBodyTotal ,abimClothingBody)
		EndIf

		;hands
		If PlaceItem(0,ArmorGauntletsTotal ,abimArmorGauntlets)
		ElseIf PlaceItem(0,ClothingHandsTotal ,abimClothingHands)
		EndIf

		;head
		If PlaceItem(0,ArmorHelmetTotal ,abimArmorHelmet)
		ElseIf PlaceItem(0,ClothingHeadTotal ,abimClothingHead)
		ElseIf PlaceItem(0,ClothingCircletTotal ,abimClothingCirclet)
		EndIf
	
		MannIndex += 1
	EndWhile
EndEvent

 

 

Link to comment
Share on other sites

Thanks IsharaMeridin,

 

You've offered a load of help.

 

Not understanding scripts, I didn't realise how complicated something seemingly innocuous could get.

 

If I can't crack it, I've got a back-up idea for the tomb that works well enough (it's just not quite as neat as using pre-clothed manniquins).

 

Wow! Redragon2013, I've just seen your post. It looks way out of my league. I think this is going to take me ages to get right, if ever. I'll give it a try, though. Thanks.

 

I'll give it a rest for a bit though...my head hurts!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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