Jump to content

[LE] Prevent follower from equipping a helmet?


Recommended Posts

Last question for a while hopefully. I want to make it so that my modded follower is unable to equip a helmet in the beginning of gameplay, but able to switch it back to normal behavior after a quest is completed. any help would be greatly appreciated!

Edited by Smirkyguy
Link to comment
Share on other sites

Hey, you could make a new spell / ability with a script and put it on your follower. Then remove the spell ability from your follower at some point with MyFollower.RemoveSpell(PreventHelmetEquipAbility)

 

Put this script on the ability's magic effect:

 

Scriptname PreventEquipHelmetScript extends ActiveMagicEffect 

Keyword Property ArmorHelmet Auto
Actor Property akTargetRef Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
   akTargetRef = akTarget
EndEvent

Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference)
    If (akBaseObject as Armor) && akBaseObject.HasKeyword(ArmorHelmet) 
        akTargetRef.UnEquipItem(akBaseObject) 
    Endif 
EndEvent

Name the script something more unique to your mod.

Link to comment
Share on other sites

Hey, I just tested and it did work for me. Make sure the spell is an ability, and you put the script on the magic effect. Note that if your follower is already wearing a helmet when you add the spell to them, it won't unequip it. If you know the helmet your follower has in their inventory, you can add this to the script:

 

Scriptname PreventEquipHelmetScript extends ActiveMagicEffect 

Keyword Property ArmorHelmet Auto
Actor Property akTargetRef Auto
Armor Property MyFollowersHelmet Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
   akTargetRef = akTarget
   akTarget.UnEquipItem(MyFollowersHelmet)
EndEvent

Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference)
    If (akBaseObject as Armor) && akBaseObject.HasKeyword(ArmorHelmet) 
        akTargetRef.UnEquipItem(akBaseObject) 
    Endif 
EndEvent

Don't forget to fill properties in the CK after compiling the script.

Note that it will only prevent equiping helmets that have the ArmorHelmet keyword. For a more foolproof method, you would need to use SKSE. Either GetWornForm or GetSlotMask https://www.creationkit.com/index.php?title=GetSlotMask_-_Armor

Link to comment
Share on other sites

Don't forget to fill properties in the CK after compiling the script.

 

refresher on what that means? x3

EDIT: Nvm...

 

Although the mod already depends on SKSE due to some custom AI, so yeah i would like a script that just prevents all hats, helmets, etc. from being equipped.

Edited by Smirkyguy
Link to comment
Share on other sites

after filling properties, it still doesnt function at all, even on a fresh save. im uploading the mod, can you figure out what i did wrong?

actor id is "headlesskhajiitfollower"
everything else can be filtered with "koahni"

Link to comment
Share on other sites

So a few things, you need to change the spell's type from Spell to Ability. In the ESP you uploaded, the keyword property in the magic effect wasn't filled. Click on the script, then properties and choose auto fill all. Since you are using SKSE though, you can use this script instead which doesn't require the keyword property:

 

 

 

Scriptname KoahniDisableHelmetScript extends ActiveMagicEffect 

Actor Property akTargetRef Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
    akTargetRef = akTarget

    Armor Helmet = akTarget.GetWornForm(4096) as Armor 
    Armor HelmetNoCirclet = akTarget.GetWornForm(2) as Armor 
    Armor Circlet = akTarget.GetWornForm(4098) as Armor 

    If Helmet != none 
        akTarget.UnEquipItem(Helmet)
    Endif 
    
    If HelmetNoCirclet != none 
        akTarget.UnEquipItem(HelmetNoCirclet)
    Endif 
    If Circlet != none 
        akTarget.UnEquipItem(Circlet)
    Endif 
    
EndEvent

Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference)
    ;Debug.MessageBox("Slot mask = " + (akBaseObject as armor).GetSlotMask())
    If (akBaseObject as Armor)
        Int Slot = (akBaseObject as Armor).GetSlotMask()
        If Slot == 4096 || Slot == 4098 || Slot == 2
            akTargetRef.UnEquipItem(akBaseObject) 
        Endif
    Endif 
EndEvent 

I tested it and it does work. Also make sure you add the spell to your follower somehow. You can either add it directly via their actor spell list or with a script AddSpell.
Edited by dylbill
Link to comment
Share on other sites

  • Recently Browsing   0 members

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