The way it works is thus:
1. Script detects what player has on, then gives perks depending on this. I.E. it'll add the Heavy Armor Cuirass perk if it detects that the player is wearing a heavy armor cuirass.
2. Perks determine what spell abilities to apply. The heavy armor Cuirass perk for example, adds all the spell abilities to the player that adjust speed, balanced for a cuirass in mind.
3. Spell abilities detect what the player skill level for Heavy Armor is, and in add a negative speedmult modifier to the player depending on this skill level. So for a cuirass, there might be 10 different spell abilities that are all activated at the same time, but each one has a different skill threshold and speed number. Only the ability that matches the player's current skill level will get activated. As a backup, the conditions of the spell effect double checks if the player is wearing a curiass for example, before applying the ability.
I have steps #2 and #3 working perfectly. The game correctly applies the speed drain for the right piece of armor being worn (boots, cuirass, etc) and the right skill level the player has.
Issue is, I'm trying to figure out the delivery. AKA, without the script, the player will get this speed drain reguardless of the armor type he/she is wearing - all curiasses will set off the cuirass speed drain, when I wish to only apply it to heavy armor cuirasses.
So I wrote up a script, here's what it looks like so far. The script is attached to the player, through the QuestAliases tab.
Scriptname CPO_PlayerSkills extends ReferenceAliasKeyword Property ArmorHeavy AutoKeyword Property ArmorCuirass AutoKeyword Property ArmorBoots AutoKeyword Property ArmorGauntlets AutoKeyword Property ArmorHelmet AutoPerk Property CPO_HA_SpeedSkillCuirass AutoPerk Property CPO_HA_SpeedSkillBoots AutoPerk Property CPO_HA_SpeedSkillGauntlets AutoPerk Property CPO_HA_SpeedSkillHelmit Auto;Check if an object is unequippedEvent OnObjectUnequipped(Form akBaseObject, ObjectReference akReference);Next, check if the equipped object is armor if akBaseObject As Armor ;If it is armor, check to see if this piece of armor has the keywords ArmorHeavy AND ArmorCuirass. ;If not, then the script continues to check if it's boots, gauntlets, etc. If ((akBaseObject As Armor).HasKeyword(ArmorHeavy) && (akBaseObject As Armor).HasKeyword(ArmorCuirass)) Game.GetPlayer().RemovePerk(CPO_HA_SpeedSkillCuirass) else ((akBaseObject As Armor).HasKeyword(ArmorHeavy) && (akBaseObject As Armor).HasKeyword(ArmorBoots)) Game.GetPlayer().RemovePerk(CPO_HA_SpeedSkillBoots) else ((akBaseObject As Armor).HasKeyword(ArmorHeavy) && (akBaseObject As Armor).HasKeyword(ArmorGauntlets)) Game.GetPlayer().RemovePerk(CPO_HA_SpeedSkillGauntlets) else ((akBaseObject As Armor).HasKeyword(ArmorHeavy) && (akBaseObject As Armor).HasKeyword(ArmorHelmet)) Game.GetPlayer().RemovePerk(CPO_HA_SpeedSkillHelmit) endif endifendEvent;Check if an object is equippedEvent OnObjectEquipped(Form akBaseObject, ObjectReference akReference);Next, check if the equipped object is armor if akBaseObject As Armor ;If it is armor, check to see if this piece of armor has the keywords ArmorHeavy AND ArmorCuirass. ;If not, then the script continues to check if it's boots, gauntlets, etc. The perk itself does ;the apropreate skill checks with its ability conditional statements. If ((akBaseObject As Armor).HasKeyword(ArmorHeavy) && (akBaseObject As Armor).HasKeyword(ArmorCuirass)) Game.GetPlayer().AddPerk(CPO_HA_SpeedSkillCuirass) else ((akBaseObject As Armor).HasKeyword(ArmorHeavy) && (akBaseObject As Armor).HasKeyword(ArmorBoots)) Game.GetPlayer().AddPerk(CPO_HA_SpeedSkillBoots) else ((akBaseObject As Armor).HasKeyword(ArmorHeavy) && (akBaseObject As Armor).HasKeyword(ArmorGauntlets)) Game.GetPlayer().AddPerk(CPO_HA_SpeedSkillGauntlets) else ((akBaseObject As Armor).HasKeyword(ArmorHeavy) && (akBaseObject As Armor).HasKeyword(ArmorHelmet)) Game.GetPlayer().AddPerk(CPO_HA_SpeedSkillHelmit) endif endifendEvent
Unfortunatly, it fails to compile. Here's the errors:
Starting 1 compile threads for 1 files...Compiling "CPO_PlayerSkills"...f:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\CPO_PlayerSkills.psc(23,7): required (...)+ loop did not match anything at input '('f:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\CPO_PlayerSkills.psc(25,2): mismatched input 'else' expecting ENDIFf:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\CPO_PlayerSkills.psc(25,7): required (...)+ loop did not match anything at input '('f:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\CPO_PlayerSkills.psc(27,2): mismatched input 'else' expecting ENDIFf:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\CPO_PlayerSkills.psc(29,2): mismatched input 'endif' expecting ENDEVENTf:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\CPO_PlayerSkills.psc(42,7): required (...)+ loop did not match anything at input '('f:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\CPO_PlayerSkills.psc(44,2): mismatched input 'else' expecting ENDIFf:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\CPO_PlayerSkills.psc(44,7): required (...)+ loop did not match anything at input '('f:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\CPO_PlayerSkills.psc(46,2): mismatched input 'else' expecting ENDIFf:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\CPO_PlayerSkills.psc(48,2): mismatched input 'endif' expecting ENDEVENTNo output generated for CPO_PlayerSkills, compilation failed.Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on CPO_PlayerSkillsAny help with this one?
Also another question - will the game "equip" the player upon the load of a save game (and thus correctly get the script working)? If not... how would I get the script to detect what armors the player is already wearing using OnInit() ?



