I'm trying to create a mod that adds various sets of armor to the game that will increase in power as the player equips more pieces, but I'm running into trouble with the scripts to make it work.
The way it's supposed to work is that the player gains an ability (right now, zzzTestEffect) as soon as he equips one piece of armor, he gets the ability, and for each additional piece he equips, it becomes stronger or gains additional effects. To that end, I've given each armor set a keyword that is shared by each piece (in this case, zzzTestItem). zzzTestEffect itself has several effects which only appear if the player is wearing a certain number of items with the zzzTestItem keyword. I've posted the script below.
Scriptname TestSetScript extends ObjectReferencekeyword Property zzzTestItem Autospell Property zzzTestEffect AutoEvent OnEquipped (Actor AkActor) if AkActor == Game.GetPlayer() if Actor.HasSpell(Spell akzzTestEffect) == False Game.GetPlayer().AddSpell(zzzTestEffect) endif endifEndEvent Event OnUnequipped (Actor AkActor) if AkActor == Game.GetPlayer() if Actor.WornHasKeyword(Keyword zzzTestItem) == False Game.GetPlayer().RemoveSpell(zzzTestEffect) endif endif EndEvent
The intention of the script is for the first armor piece of the set the player equips to give him zzzTestEffect. It's supposed to check whether the player already has it before granting the ability, though, so that the player doesn't gain multiple copies of the ability. When a piece of armor is unequipped, the script is supposed to check if it's the last piece of armor from the set that the player has equipped, and if so, remove the ability entirely. However, in its current form, the script doesn't seem to do anything at all. When I equip the armor in game, the character doesn't gain any of the effects the armor is supposed to grant.
To be clear, I'd like to set up the effects of the armor sets this way because I don't want the benefits attached to any individual pieces of armor. I don't want a setup like Azhidal's Boots of Waterwalking that provide a +10 Enchanting bonus with four relics equipped; I want something where the player gets the +10 Enchanting (or other effect) if he has any four pieces of the set equipped.