Jump to content

[LE] [Creation Kit] I want to make an Armor change ArmorAddon with a script


fenrato

Recommended Posts

Hi. Is it possible using a papyrus script to have an armor item change its ArmorAddon (the actual physical mesh reference) on certain conditions, like player.isWeaponDrawn or IsInCombat?

Ideally I want a pair of gauntlets to 'transform' either when in weapon-drawn state, or when the player enters combat. The actual gauntlets themselves wouldn't change armor value or become a different item- just the AA would change. I don't know anything about scripting and what I've read of it is overwhelming for me.

Thank you for your time and perhaps efforts.

Link to comment
Share on other sites

  • 9 months later...

Hey, so I tested and using SetModelPath for ArmorAddons while wearing the armor does not update the visual change, even with using QueueNiNodeUpdate() afterwords. So here is my advice.

 

Make your actual armor so it doesn't use any slot dependencies and doesn't use an armor addon. Basically it's an invisible armor that will be used for the Armor Rating stats and any enchantments. Then make separate armors that will be equipped based on certain conditions that do use the slot dependencies they are supposed to. Also, make a new Spell Ability that has different magic effects with different conditions for when you want the visuals to change.

 

As a test, I made a helmet, that when your weapon is drawn, it equips the Elven Helmet, and when weapon is sheathed, it equips the Leather Helmet.

 

Put this script on your invisible armor that doesn't use slot dependencies.

 

 

Scriptname TestArmorScript extends ObjectReference 
;Put this script on your armor

Spell Property TestArmorVisualChangeAbility Auto
Armor Property ArmorLeatherHelmet Auto ;purely for visuals
Armor Property ArmorElvenHelmet Auto ;purely for visuals

Event OnEquipped(Actor akActor)
    Debug.Notification("Equipped")
    If akActor.IsWeaponDrawn()
        akActor.EquipItem(ArmorElvenHelmet)
    Else 
        akActor.EquipItem(ArmorLeatherHelmet)
    Endif
    
    akActor.AddSpell(TestArmorVisualChangeAbility) 
   
EndEvent 

Event OnUnequipped(Actor akActor)
    Debug.Notification("UnEquipped")
    akActor.RemoveSpell(TestArmorVisualChangeAbility)
    akActor.RemoveItem(ArmorLeatherHelmet, 100)
    akActor.RemoveItem(ArmorElvenHelmet, 100)
EndEvent

 

Then put this script on the ability's magic effect:

 

 

Scriptname TestArmorVisualChangeScript extends ActiveMagicEffect 

; this magic effect has the condition IsWeaponOut > 0
Armor Property ArmorElvenHelmet Auto 
Armor Property ArmorLeatherHelmet Auto

Event OnEffectStart(Actor akTarget, Actor akCaster) ;Effect starts when weapon is drawn
    ;Debug.Notification("Weapon Drawn")
    akTarget.EquipItem(ArmorElvenHelmet)
EndEvent

Event OnEffectFinish(Actor akTarget, Actor akCaster) ;Effect ends when weapon is sheathed
    ;Debug.Notification("Weapon Sheathed")
    akTarget.EquipItem(ArmorLeatherHelmet)
EndEvent 

Name the scripts something more unique. You can add more magic effects to the ability with different conditions to equip different armor visuals. You might need to get rid of or tweak OnEffectFinish if using more than one magic effect / visual change. This method also has the benefit that it doesn't require skse.
Edited by dylbill
Link to comment
Share on other sites

  • 7 months later...
All SKSE functions like "SetModelPath()" or "SetNthTexturePath()" will change the nif or the texture in real time, but in game the mesh retains the nif / texture that is in memory.

Disable / Enable, Unequip / Equip, OnCellDetach / OnCellAttach, OnUnload / OnLoad

will work / update the nif or the texture.


If the function is running on an object or an actor, losing LOS in an exterior cell will also work.


Happy new year everybody !.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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