Morrowind Mod:GetArmorType

The UESPWiki – Your source for The Elder Scrolls since 1995

÷ GetArmorType

		GetArmorType, ArmorLocation

       Where:   ArmorLocation = Short value indicating which armor piece to check.
					Helmet		 0
					Cuirass		 1
					Left Pauldron	 2
					Right Pauldron	 3
					Greaves		 4
					Boots		 5
					Left Gauntlet	 6
					Right Gauntlet	 7
					Shield		 8
					Left Bracer	 9
					Right Bracer	10

	Type:	Object, Tribunal

     Returns:	short (-1 to 2)
			Unarmored	-1
			Light Armor	 0
			Medium Armor	 1
			Heavy Armor	 2

     Example:	short armorType
		set armorType to ( player->GetArmorType 1 )
		if ( armorType > 0 )
		[...]

     Scripts: Not Used

Returns the armor weight class of the actor's armor at the given location. This function appears to be somewhat broken in vanilla Morrowind. If used in an if statement as-is, it will always return false if the player is wearing light armor and always return true otherwise regardless of the value being checked against. For example:

	; always prints "Test" if the player's not wearing light a cuirass even though 95 isn't a valid return value
	if ( player->GetArmorType 1 == 95 )
		messagebox "Test"
	endif

	; never prints "Test" if the player *is* wearing a light cuirass even though 0 is the return value for light armor
	if ( player->GetArmorType 1 == 0 )
		messagebox "Test"
	endif

To work correctly it must always be defined as a variable first. The following is a working example:

	short armorType
	set armorType to ( player->GetArmorType 1 )
	
	; now will only print "Test" when the player has no cuirass equipped
	if ( armorType == -1 )
		messagebox "Test"
	endif

This issue is not shared by GetWeaponType.

See Also: GetWeaponType