IsEquippedArmorType - Keyword

From the CreationKit Wiki
Jump to navigation Jump to search


Returns the keyword associated with an armor the actor has equipped. This function is meant for Skyrim Special Edition, as there is no native way to check for equipped armor types. Skyrim Original Edition has access to those through SKSE.

Syntax[edit | edit source]

Keyword[] property ArmorTypes auto
; Fill this array with the following keywords
; ArmorHelmet
; ArmorCuirass
; ArmorGauntlets
; ArmorBoots
; ArmorJewelry
; ArmorClothing

Keyword Function IsEquippedArmorType(Actor akActor, Form akItemToCheck, Keyword[] kArmorTypes)

Armor EquippedArmor = akItemToCheck as Armor 
Bool GetEquipped = akActor.IsEquipped(EquippedArmor)
Keyword ArmorType
Int i
Int index = kArmorTypes.Length

if GetEquipped == true
	While i < index
		if EquippedArmor.HasKeyword(kArmorTypes[i])
			ArmorType = kArmorTypes[i]
			return ArmorType
		else
			i += 1
		endif
	Endwhile
else
	return none
endif

return none
EndFunction

Parameters[edit | edit source]

  • akActor: the actor this armor is equipped to.
  • akItemToCheck: the form to check for matching keywords.
  • ArmorTypes: An array of keywords found on these armor types.

Return Values[edit | edit source]

  • Returns the keyword attached to the form. Returns none, if the equipped item is false, or the armor didn't have a matching keyword.

Examples[edit | edit source]

Keyword[] property ArmorTypes auto
Keyword property ArmorHelemt auto
Actor property PlayerRef auto
Armor property ArmorDaedricHelmet

Event OnInit()
    if IsEquippedArmorType(PlayerRef, ArmorDaedricHelmet, ArmorTypes) == ArmorHelmet
        debug.trace("The keyword for this object is: ArmorHelmet")
    else
        debug.trace("This armor is not a helmet or correct form")
    endif
EndEvent

Notes[edit | edit source]

  • A property list of all armor forms will be supplied to the talk page soon to make usage of this function a little easier.
  • Can be adapted to take FormLists.
  • Internally calls IsEquipped - Actor of which this function is based on. It's the only way for SSE outside of condition functions to check if an actor is wearing something.

See Also[edit | edit source]

  • IsEquipped - Actor