Jump to content

Differentiating Between Armor and Armor Addons in a Script


PushTheWinButton

Recommended Posts

For some reason, armor addons behave like armor when the game is started. GetType returns 24 (armor) and not 96 (armor addon), and GetLoadedType/GetLoadedTypeArray 24 from Lutana NVSE return all armor AND all armor addons.

 

Does anyone know how to differentiate between the two in a script? Armor addons have no weight, value, or DT - but the same goes for some armor items so that doesn't help (some return a value for DR, too) . They both have have equipment slots, and a good number of armor addons also have names, so neither of those are much good either. Similarly, they both have equip types and models, and yes - IsPlayable returns true for armor addons.

 

The best way I've found is to check that weight, value, and DT all equal 0. But I was just wondering: does anyone know of a better way (and am I missing something blatantly obvious)?

Edited by PushTheWinButton
Link to comment
Share on other sites

This has also puzzled me because if you look at the records in FNVEdit, you'll see armor addons and armors are eerily similar and they show some fields you can't see in the GECK. The things an armor can have which an armor addon cannot (script, object effect, ragdoll, biped and repair lists, inventory & animation sounds) are not necessary to define an armor record, so there's no 100% surefire way to differentiate the two in scripts right now that I know of either.

 

Maybe Luthien could be persuaded to make his commands differentiate between the two. It seems type 96 is currently not detectable at all.

Link to comment
Share on other sites

Ok, I've found the following set of conditions acts as a pretty decent filter:

if (IsQuestItem rForm == 0) && (GetWeight rForm == 0) && (GetValue rForm == 0)
	;item is probably an armor addon and not armor
endif

Don't really know how performance intensive that's going to be on a large number of forms, though. Might be better in a different order with ORs instead.

Edited by PushTheWinButton
Link to comment
Share on other sites

Break things into individual if statements to make it faster, the script engine evaluates each condition.

if IsQuestItem rForm
else
	if GetWeight rForm
	else
		if GetValue rForm
		else
			;item is probably an armor addon
		endif
	endif
endif

this type of if statement checking for 0 is also faster

 

You can test this using cipscis' method.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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