Jump to content

Papyrus - Getting players worn armor for later use?


DarkWolfModding

Recommended Posts

I had a great mod idea but I need to be able to get the current players equipped armor (All pieces. Gloves, Boots, Torso, and Helmet) so the script could use it later. I've looked on the Creation Kit Website and I cant find it anywhere. =(

 

Anyone know how to do this?
Help Please.

 

I wanted to make a mod like wet and cold but where it equip's and unequip's the players helmet and other armor pieces when they are in combat and will unequip the armor and equip another clothing set when their not in combat.

 

And would it be best to use an Array for this type of mod or just properties and assign the armor to them.

 

Also any suggestions for what to name this mod would be great.
May do a spell menu first and later on if I can figure it out I'll do an MCM Menu.

 

 

Link to comment
Share on other sites

I can't script so I generally turn to Conditions

The condition you are looking for is WornApparelHasKeyword. Then set the keyword to ArmorHeavy or ArmorLight and set it to == 4 so that it only activates when player has all four pieces on.

the second part will need some scripting

Link to comment
Share on other sites

This may or may not work. If it does work: it would work for armor only; it would work for stock armors and those custom armors that are designed like stock with the same keywords.

 

This is just a function that scans the designated actor and gets the equipped armor pieces, you'll have to figure out how to pull the data out of the function.

 

Have not tested compilation or even if it works, theory only. Requires SKSE

Function GetEquippedArmor(Actor TheActor)
	Int NumItems = TheActor.GetNumItems()
	Int i = 0
	While (i < NumItems)
		Form Entry = TheActor.GetNthForm(i)
		If Entry as Armor
			Armor ArmorPiece = (Entry as Armor)
			If TheActor.IsEquipped(ArmorPiece)
				If ArmorPiece.IsHelemet()
					Debug.Trace(ArmorPiece.GetName()+" is a helmet")
				ElseIf ArmorPiece.IsGauntlets()
					Debug.Trace(ArmorPiece.GetName()+" is a pair of guantlets")
				ElseIf ArmorPiece.IsBoots()
					Debug.Trace(ArmorPiece.GetName()+" is a pair of boots")
				ElseIf ArmorPiece.IsCuirass()
					Debug.Trace(ArmorPiece.GetName()+" is a cuirass")
				EndIf
			EndIf
		EndIf
		i += 1
	EndWhile
EndFunction 

 

Of course, you should be aware that equipping custom enchanted gear via script causes the custom enchantment to not take effect. Perhaps a warning to the player that they may want to unequip and re-equip in those cases.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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