Jump to content

[LE] Equipping weapons on mannequins


Shade1982

Recommended Posts

Hey all,

 

As a follow-up to this:

 

 

Getting mannequins to equip weapons...

Unless you don't want to require users to use a mod like the Vanilla Mannequin Script Fix [VMSF] (which I can understand due to the added poses and stuff), you'll need to edit the MannequinActivatorScript yourself. I suggest using the USLEEP copy as there are corrections to be carried over.

 

Then all you have to do is look for

akBaseItem as Armor

and change to

((akBaseItem as Armor) || (akBaseItem as Weapon) || (akBaseItem as Ammo))

There may also be an akBaseObject variation of the same as the original script uses OnObjectUnequipped. When I updated the VMSF, I had some reason to swap OnObjectUnequipped out for OnItemRemoved and so there is only the akBaseItem variation on that version of the script.

 

 

to avoid hijacking someone else's thread.

 

Like the topic says, I've been trying to edit the MannequinActivatorScript so I can also equip weapons on the mannequins with as little change as possible.

 

So far, this is the change I've made according to the advice I got and using similar scripts as examples.

 

 

Scriptname MannequinActivatorPlusSCRIPT extends Actor
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
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 Inventory
PlayCurrentPose()
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 isEquipable(akBaseItem)
;Trace("DARYL - " + self + " Form " + akBaseItem + " is armor!")
if( !AddToArmorSlot(akBaseItem) )
Debug.Notification("Capacity reached or already have one of those.")
self.RemoveItem(akBaseItem, aiItemCount, true, akSourceContainer)
Else
self.EquipItem(akBaseItem)
EndIf
else
;Trace("DARYL - " + self + " Form " + akBaseItem + " is NOT armor!")
MannequinArmorWeaponsMESSAGE.Show()
self.RemoveItem(akBaseItem, aiItemCount, true, akSourceContainer)
endif
endEvent
Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)
;Trace("DARYL - " + self + akBaseObject + " was unequipped by the Mannequin")
if isEquipable(akBaseItem)
; if isEquipable(akBaseObject)
;Trace("DARYL - " + self + " Form " + akBaseObject + " is armor!")
RemoveFromArmorSlot(akBaseItem)
; RemoveFromArmorSlot(akBaseObject)
else
;Trace("DARYL - " + self + " Form " + akBaseObject + " is NOT armor!")
endif
endEvent
Bool FUNCTION isEquipable(Form akBaseItem) global ;to limit the types of things equippable
return ((akBaseItem as Armor) || (akBaseItem as Weapon) || (akBaseItem as Ammo))
ENDFUNCTION
Function PlayCurrentPose()
if CurrentPose == 1
PlayIdle(Pose01)
elseif CurrentPose == 2
PlayIdle(Pose02)
elseif CurrentPose == 3
PlayIdle(Pose03)
endif
endFunction
Function EquipCurrentArmor()
;Trace("DARYL - " + self + " Attempting to equip current armor")
if (ArmorSlot01 != EmptySlot)
;Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 01")
self.EquipItem(ArmorSlot01)
endif
if (ArmorSlot02 != EmptySlot)
;Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 02")
self.EquipItem(ArmorSlot02)
endif
if (ArmorSlot03 != EmptySlot)
;Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 03")
self.EquipItem(ArmorSlot03)
endif
if (ArmorSlot04 != EmptySlot)
;Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 04")
self.EquipItem(ArmorSlot04)
endif
if (ArmorSlot05 != EmptySlot)
;Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 05")
self.EquipItem(ArmorSlot05)
endif
if (ArmorSlot06 != EmptySlot)
;Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 06")
self.EquipItem(ArmorSlot06)
endif
if (ArmorSlot07 != EmptySlot)
;Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 07")
self.EquipItem(ArmorSlot07)
endif
if (ArmorSlot08 != EmptySlot)
;Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 08")
self.EquipItem(ArmorSlot08)
endif
if (ArmorSlot09 != EmptySlot)
;Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 09")
self.EquipItem(ArmorSlot09)
endif
if (ArmorSlot10 != EmptySlot)
;Trace("DARYL - " + self + " Equipping " + ArmorSlot01 + " from Slot 10")
self.EquipItem(ArmorSlot10)
endif
endFunction
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 = akBaseItem
FoundEmptySlot = TRUE
endif
if (ArmorSlot02 == EmptySlot) && (FoundEmptySlot == FALSE)
;Trace("DARYL - " + self + " Placing " + akBaseItem + " in armor slot 02")
ArmorSlot02 = akBaseItem
FoundEmptySlot = TRUE
endif
if (ArmorSlot03 == EmptySlot) && (FoundEmptySlot == FALSE)
;Trace("DARYL - " + self + " Placing " + akBaseItem + " in armor slot 03")
ArmorSlot03 = akBaseItem
FoundEmptySlot = TRUE
endif
if (ArmorSlot04 == EmptySlot) && (FoundEmptySlot == FALSE)
;Trace("DARYL - " + self + " Placing " + akBaseItem + " in armor slot 04")
ArmorSlot04 = akBaseItem
FoundEmptySlot = TRUE
endif
if (ArmorSlot05 == EmptySlot) && (FoundEmptySlot == FALSE)
;Trace("DARYL - " + self + " Placing " + akBaseItem + " in armor slot 05")
ArmorSlot05 = akBaseItem
FoundEmptySlot = TRUE
endif
if (ArmorSlot06 == EmptySlot) && (FoundEmptySlot == FALSE)
;Trace("DARYL - " + self + " Placing " + akBaseItem + " in armor slot 06")
ArmorSlot06 = akBaseItem
FoundEmptySlot = TRUE
endif
if (ArmorSlot07 == EmptySlot) && (FoundEmptySlot == FALSE)
;Trace("DARYL - " + self + " Placing " + akBaseItem + " in armor slot 07")
ArmorSlot07 = akBaseItem
FoundEmptySlot = TRUE
endif
if (ArmorSlot08 == EmptySlot) && (FoundEmptySlot == FALSE)
;Trace("DARYL - " + self + " Placing " + akBaseItem + " in armor slot 08")
ArmorSlot08 = akBaseItem
FoundEmptySlot = TRUE
endif
if (ArmorSlot09 == EmptySlot) && (FoundEmptySlot == FALSE)
;Trace("DARYL - " + self + " Placing " + akBaseItem + " in armor slot 09")
ArmorSlot09 = akBaseItem
FoundEmptySlot = TRUE
endif
if (ArmorSlot10 == EmptySlot) && (FoundEmptySlot == FALSE)
;Trace("DARYL - " + self + " Placing " + akBaseItem + " in armor slot 10")
ArmorSlot10 = akBaseItem
FoundEmptySlot = TRUE
endif
FoundEmptySlot = FALSE
endFunction
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 = EmptySlot
FoundMatchingSlot = TRUE
endif
if (ArmorSlot02 == akBaseItem) && (FoundMatchingSlot == FALSE)
;Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 02")
ArmorSlot02 = EmptySlot
FoundMatchingSlot = TRUE
endif
if (ArmorSlot03 == akBaseItem) && (FoundMatchingSlot == FALSE)
;Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 03")
ArmorSlot03 = EmptySlot
FoundMatchingSlot = TRUE
endif
if (ArmorSlot04 == akBaseItem) && (FoundMatchingSlot == FALSE)
;Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 04")
ArmorSlot04 = EmptySlot
FoundMatchingSlot = TRUE
endif
if (ArmorSlot05 == akBaseItem) && (FoundMatchingSlot == FALSE)
;Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 05")
ArmorSlot05 = EmptySlot
FoundMatchingSlot = TRUE
endif
if (ArmorSlot06 == akBaseItem) && (FoundMatchingSlot == FALSE)
;Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 06")
ArmorSlot06 = EmptySlot
FoundMatchingSlot = TRUE
endif
if (ArmorSlot07 == akBaseItem) && (FoundMatchingSlot == FALSE)
;Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 07")
ArmorSlot07 = EmptySlot
FoundMatchingSlot = TRUE
endif
if (ArmorSlot08 == akBaseItem) && (FoundMatchingSlot == FALSE)
;Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 08")
ArmorSlot08 = EmptySlot
FoundMatchingSlot = TRUE
endif
if (ArmorSlot09 == akBaseItem) && (FoundMatchingSlot == FALSE)
;Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 09")
ArmorSlot09 = EmptySlot
FoundMatchingSlot = TRUE
endif
if (ArmorSlot10 == akBaseItem) && (FoundMatchingSlot == FALSE)
;Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 10")
ArmorSlot10 = EmptySlot
FoundMatchingSlot = TRUE
endif
endFunction

 

 

 

It's the basic script, with my changes in red.

 

But it doesn't work. Instead, the mannequins now lose all their equipment.

 

Can anyone tell me what I'm missing?

Edited by Shade1982
Link to comment
Share on other sites

Didn't see this thread yesterday. Don't know why. Since you've tried on your own...

 

Try this out, be sure to test on a new game as some things might be baked into the save file.

USLEEP version with adjustments to allow weapons and ammo. Please note that I have not tested compilation or function.

 

 

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()
	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) || (akBaseItem as Weapon) || (akBaseItem as Ammo)) ;IsharaMeradin -- Adds ability to give weapons and ammo as well as armor and put them into a list to wear
		;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, akSourceContainer) 
			;IsharaMeradin -- changed destination to akSourceContainer from Game.GetPlayer() 
			; -- Reason, some mods add items to NPCs as tokens and these items might not be usable by the player and will bloat player inventory unnecesary if dumped onto player.
		Else
			self.EquipItem(akBaseItem)
		EndIf
	else
		;Trace("DARYL - " + self + " Form " + akBaseItem + " is NOT armor!")
		MannequinArmorWeaponsMESSAGE.Show()
		self.RemoveItem(akBaseItem, aiItemCount, true, akSourceContainer)
		;IsharaMeradin -- changed destination to akSourceContainer from Game.GetPlayer()
		; -- Reason, some mods add items to NPCs as tokens and these items might not be usable by the player and will bloat player inventory unnecesary if dumped onto player.
	endif
	
endEvent

Event OnObjectUnequipped(Form akBaseObject, ObjectReference akReference)
	;Trace("DARYL - " + self + akBaseObject + " was unequipped by the Mannequin")
	
	if ((akBaseObject as Armor) || (akBaseObject as Weapon) || (akBaseObject as Ammo)) ;IsharaMeradin -- Adds ability to remove weapons and ammo as well as armor from list of items to wear
		;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()
	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
 

 

FYI - this version can be used without USLEEP and still work as intended.

Link to comment
Share on other sites

Well, your advice really helped. I had already tried a different version of that script (funnily enough, one of yours apparently), but that didn't work.

 

I found the following issues with my mod:

  1. I wasn't testing with a clean save, even though I really thought it was. Apparently, even being in the same world cell as where my indoor cells are linked is still not clean.
  2. The script stops working when you try to equip two of the same items. Like in my case, two of the same sword (which was intended as a dual wield configuration).
  3. My own script definitely doesn't work like that :P.

By the way, for anyone reading this. I am doing this in SSE, and it still works :smile:.

Edited by Shade1982
Link to comment
Share on other sites

I think I see why the script has issues with two items of the same base form. When an item is added that is an armor, ammo or weapon, the AddToArmorSlot function is ran. This function checks to see if the item is already in the list. If it is, it returns false and the item is returned. But because it is the same base and RemoveItem always grabs the first in the stack, the previously equipped item is taken instead of the newly added one.

 

Might be a way to work around it, but you'd have to make sure that the mannequin NPC has the dual wield animations and skeleton to go along with them (they should if you can get your followers to show dual wielded sheathed weapons)

 

Try replacing the AddToArmorSlot function block with the following:

 

 

Int DW = 0
bool Function AddToArmorSlot(Form akBaseItem)
	;First check to see if this is already in a slot
	if( IsDuplicated(akBaseItem) )
		If (akBaseItem as Weapon) && DW == 0
			DW = 1
		Else
			return False
		EndIf	
	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 

 

 

What should happen is that the first weapon added will fail the IsDuplicated check and be added to the array of equipped items. Then the second instance will pass the IsDuplicated check and trigger the next check. An integer increases which will prevent trying to equip a third instance on the mannequin. You'll still have the same issue that you have now but it should only happen when adding a third instance rather than the second. Other drawback, without using SKSE it'll accept two of any weapon even tho only one could be displayed.

Edited by IsharaMeradin
Link to comment
Share on other sites

Well, that does fix the script stopping when it runs into double items, but it doesn't appear to actually equip the second (or first, I can't really tell of course) weapon.

 

Unfortunately, I've run into another snafu. The dual sheath option requires SKSE, which isn't released for SSE yet. And I just found out SSE has it's own forum and I erroneously assumed both games would be in this forum...

 

So, I guess this is on hold until SKSE64 is released approx. mid-march.

Edited by Shade1982
Link to comment
Share on other sites

  • Recently Browsing   0 members

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