Jump to content

Problem with a Script that passively increases the Armor Skill


Xarrian

Recommended Posts

In the last update of my current project, I wanted to implement a feature (via a script attached to the player) that increases the light/heavy armor skill if the player character is currently wearing a cuirass associated with light or heavy armor.

 

Now I wanted to do it like this:

 

 

 

Scriptname AA000XarrianArmorSkilllIncreaseScript extends ObjectReference

 

ObjectReference Property Player Auto ; Player reference, but unused - forgot to remove it

 

Keyword Property ArmorHeavy Auto ; This one does not use the ArmorHeavy Keyword, but a custom one I attached to all Heavy Cuirasses

Keyword Property ArmorLight Auto ; Uses the ArmorLight Keyword

Keyword Property ArmorCuirass Auto ; Uses the ArmorCuirass Keyword

 

Event OnInit()

 

RegisterForUpdate(5)

 

EndEvent

 

Event OnUpdate()

 

If Game.GetPlayer().WornHasKeyword(ArmorHeavy) == True

 

Game.AdvanceSkill("HeavyArmor" , 5)

 

EndIf

 

If Game.GetPlayer().WornHasKeyword(ArmorCuirass) == True && Game.GetPlayer().WornHasKeyword(ArmorHeavy) == False

 

Game.AdvanceSkill("LightArmor" , 5)

 

EndIf

 

EndEvent

 

 

What the script should do: Fire up on Initiation and make it execute every five seconds after that. Whenever it fires, it should check if the player wears either a heavy or a light cuirass - If yes, it should yield a very small amount of skill points every time it fires. That's about it.

 

Now, some people have reported the following oddities, while I was not able to reproduce them with my savegame, in which everything seems to work fine:

 

- The Skill Increase is much faster than 5 points, in a mere 5 minutes, the skill is leveled up from 10 to 24 (much too fast)

- The Skill Increase takes place even when the player does not wear any armor at all

 

 

Has anyone any ideas? Would much appreciate it! :)

Edited by Xarrian
Link to comment
Share on other sites

Scriptname AA000XarrianArmorSkilllIncreaseScript extends Actor


Keyword Property ArmorHeavy Auto ; This one does not use the ArmorHeavy Keyword, but a custom one I attached to all Heavy Cuirasses
Keyword Property ArmorLight Auto ; Uses the ArmorLight Keyword
Keyword Property ArmorCuirass Auto ; Uses the ArmorCuirass Keyword

Event OnInit()
RegisterForUpdate(300)
EndEvent

Event OnUpdate()
If (Game.GetPlayer().WornHasKeyword(ArmorCuirass) == True)
		Armor CuirassType = Game.GetPlayer().GetWornForm(0x00000004) as Armor
		if (CuirassType.HasKeyword(ArmorHeavy) == True)
			Game.AdvanceSkill("HeavyArmor" , 5)
			
		elseif (CuirassType.HasKeyword(ArmorLight) == True)
			Game.AdvanceSkill("LightArmor" , 5)
			
		endif
endif
EndEvent

 

The script first checks if the player wears a cuirass, this is similar to your script. Then it checks if that cuirass is a heavy or light armor, using the function GetWornForm. It requires SKSE. I changed the update interval to 300, this is the time in seconds, not minutes.

 

Edit: Seems I misread your post somehow, so the 5 seconds are intended?

Edited by Ghaunadaur
Link to comment
Share on other sites

  • Recently Browsing   0 members

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