[HELP] Problems with my Fists of Steel script?

Post » Sat Sep 07, 2013 3:42 pm

I've been trying to overhaul Fists of Steel by adding a script to the player which checks if the player has the perk, what weight class gauntlets they are wearing, and then calculates what the gauntlets armor rating is (so I can turn that into damage). The only problem right now is that no matter what the player's Heavy Armor (or Light Armor) is, the calculated armor rating stays the same.

For example, Daedric Gauntlets are at 20 armor when you have 15 Heavy Armor, no perks. They go up to 26 armor if you have 100 Heavy armor, no perks. My script only ever returns 20, never anything else. I'm a newbie, and this is my first script, any help would be appreciated!

Scriptname PACFistsOfSteel extends ActorPerk Property FistsOfSteel AutoPerk Property WellFitted AutoPerk Property MatchingSetHeavy AutoPerk Property Juggernaut80 AutoPerk Property Juggernaut60 AutoPerk Property Juggernaut40 AutoPerk Property Juggernaut20 AutoPerk Property Juggernaut00 AutoPerk Property CustomFit AutoPerk Property MatchingSetLight AutoPerk Property AgileDefender80 AutoPerk Property AgileDefender60 AutoPerk Property AgileDefender40 AutoPerk Property AgileDefender20 AutoPerk Property AgileDefender00 AutoInt BonusClassFloat ArmorSkillHeavyFloat PercentArmorSkillHeavyFloat ActualArmorSkillHeavyFloat GauntletsArmorHeavyFloat UnisonHeavyFloat MatchingHeavyFloat HeavySetFloat HeavySetBonusFloat ArmorPerkHeavyFloat BonusHeavyFloat NegativeHeavyFloat ArmorSkillLightFloat PercentArmorSkillLightFloat ActualArmorSkillLightFloat GauntletsArmorLightFloat UnisonLightFloat MatchingLightFloat LightSetFloat LightSetBonusFloat ArmorPerkLightFloat BonusLightFloat NegativeLightEvent OnObjectEquipped(Form akBaseObject, ObjectReference akReference)	If (akBaseObject as Armor).GetSlotMask()==8		Armor Gauntlets = Game.GetPlayer().GetWornForm(0x00000008) as Armor		If Game.GetPlayer().HasPerk(FistsOfSteel)			Int WeightClass = Gauntlets.GetWeightClass()			If (WeightClass == 0)				ArmorSkillHeavy = (Game.GetPlayer().GetActorValue("HeavyArmor")) as Float				PercentArmorSkillHeavy = (ArmorSkillHeavy * 0.0044444)				ActualArmorSkillHeavy = (PercentArmorSkillHeavy + 1)				GauntletsArmorHeavy = (Gauntlets.GetArmorRating()) as Float				BonusClass = 0				If Game.Getplayer().HasPerk(WellFitted)					UnisonHeavy = 0.25					Else					UnisonHeavy = 0.0				EndIf				If Game.Getplayer().HasPerk(MatchingSetHeavy)					MatchingHeavy = 0.25					Else					MatchingHeavy = 0.0				EndIf				HeavySet = (UnisonHeavy+MatchingHeavy)				HeavySetBonus = (1+HeavySet)				If Game.Getplayer().HasPerk(Juggernaut80)					ArmorPerkHeavy = 2					ElseIf (Game.Getplayer().HasPerk(Juggernaut60))					ArmorPerkHeavy = 1.8					ElseIf (Game.Getplayer().HasPerk(Juggernaut40))					ArmorPerkHeavy = 1.6					ElseIf (Game.Getplayer().HasPerk(Juggernaut20))					ArmorPerkHeavy = 1.4					ElseIf (Game.Getplayer().HasPerk(Juggernaut00))					ArmorPerkHeavy = 1.2					Else					ArmorPerkHeavy = 1				EndIf					BonusHeavy = (GauntletsArmorHeavy*ActualArmorSkillHeavy*HeavySetBonus*ArmorPerkHeavy) as Float					NegativeHeavy = (0-BonusHeavy)				Self.ModAV("UnarmedDamage", BonusHeavy)			ElseIf (WeightClass == 1)				ArmorSkillLight = (Game.GetPlayer().GetActorValue("LightArmor")) as Float				PercentArmorSkillLight = (ArmorSkillLight * 0.0044444)				ActualArmorSkillLight = (PercentArmorSkillLight + 1)				GauntletsArmorLight = (Gauntlets.GetArmorRating()) as Float				BonusClass = 1				If Game.Getplayer().HasPerk(CustomFit)					UnisonLight = 0.25					Else					UnisonLight = 0				EndIf				If Game.Getplayer().HasPerk(MatchingSetLight)					MatchingLight = 0.25					Else					MatchingLight = 0				EndIf				LightSet = (UnisonLight+MatchingLight)				LightSetBonus = (1+LightSet)				If Game.Getplayer().HasPerk(AgileDefender80)					ArmorPerkLight = 2					ElseIf (Game.Getplayer().HasPerk(AgileDefender60))					ArmorPerkLight = 1.8					ElseIf (Game.Getplayer().HasPerk(AgileDefender40))					ArmorPerkLight = 1.6					ElseIf (Game.Getplayer().HasPerk(AgileDefender20))					ArmorPerkLight = 1.4					ElseIf (Game.Getplayer().HasPerk(AgileDefender00))					ArmorPerkLight = 1.2					Else					ArmorPerkLight = 1				EndIf					BonusLight = (GauntletsArmorLight*ActualArmorSkillLight*LightSetBonus*ArmorPerkLight) as Float					NegativeLight = (0-BonusLight)				Self.ModAV("UnarmedDamage", BonusLight)			EndIf		EndIf	EndIfEndEventEvent OnObjectUnequipped(Form akBaseObject, ObjectReference akReference)	If (akBaseObject as Armor).GetSlotMask()==8		If (BonusClass == 0)			Self.ModAV("UnarmedDamage", NegativeHeavy)		ElseIf (BonusClass == 1)			Self.ModAV("UnarmedDamage", NegativeLight)		EndIf	EndIfEndEvent
User avatar
Marine x
 
Posts: 3327
Joined: Thu Mar 29, 2007 4:54 am

Post » Sat Sep 07, 2013 12:05 pm

You will probably live an easier life if you use SKSE for this script: http://www.creationkit.com/GetArmorRating_-_Armor.

User avatar
W E I R D
 
Posts: 3496
Joined: Tue Mar 20, 2007 10:08 am

Post » Sat Sep 07, 2013 9:33 pm

Well, haven't looked through all the math though... but a few things stick out besides that issue.

Don't attach the script directly to the player (extends Actor). This causes compatibility issues. Create a quest (start game enabled) and create a reference alias pointing to the player. Then change your script to extend referencealias.

This one is minor, but you don't really need all those float (except for negativeheavy/light) to exist outside event. Doing that will cause your script to permanently hold those values/more memory/blah blah blah. If you declare them inside the event at the beginning, they're only temporary and will be cleared when the event ends. You can also change your Int BonusClass to a bool since it only has two states (true/false or 1/0).

Try putting in Debug Message (trace, messagebox, whatever floats your boat) to see what each calculate value is at each step. Might help debug your script.

Also you want the creation kit forum :smile:.

He uses that function, but the function only grabs the base armor rating and it's not specific to any actor's HeavyArmor rating. I think he's trying to calculate how the HeavyArmor Actor Value affects it, but his math may have gone squirrelly somewhere.

User avatar
Beth Belcher
 
Posts: 3393
Joined: Tue Jun 13, 2006 1:39 pm

Post » Sat Sep 07, 2013 7:02 pm

God, I can't believe I was that blind. I have no ideas, then :P

User avatar
Antony Holdsworth
 
Posts: 3387
Joined: Tue May 29, 2007 4:50 am

Post » Sat Sep 07, 2013 9:01 pm

GetWeightClass() returns 0 for light armor, not heavy :P.

User avatar
Harry-James Payne
 
Posts: 3464
Joined: Wed May 09, 2007 6:58 am


Return to V - Skyrim