Smirkyguy Posted May 3, 2020 Share Posted May 3, 2020 (edited) 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 May 4, 2020 by Smirkyguy Link to comment Share on other sites More sharing options...
dylbill Posted May 3, 2020 Share Posted May 3, 2020 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 EndEventName the script something more unique to your mod. Link to comment Share on other sites More sharing options...
Smirkyguy Posted May 4, 2020 Author Share Posted May 4, 2020 Didnt work, and i have no clue why. does it need to be triggered? Link to comment Share on other sites More sharing options...
dylbill Posted May 4, 2020 Share Posted May 4, 2020 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 EndEventDon'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 More sharing options...
Smirkyguy Posted May 4, 2020 Author Share Posted May 4, 2020 (edited) Don't forget to fill properties in the CK after compiling the script. refresher on what that means? x3EDIT: 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 May 4, 2020 by Smirkyguy Link to comment Share on other sites More sharing options...
Smirkyguy Posted May 4, 2020 Author Share Posted May 4, 2020 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 More sharing options...
dylbill Posted May 4, 2020 Share Posted May 4, 2020 (edited) 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 May 4, 2020 by dylbill Link to comment Share on other sites More sharing options...
Smirkyguy Posted May 4, 2020 Author Share Posted May 4, 2020 despite numerous errors when saving the script, it worked. thanks! Link to comment Share on other sites More sharing options...
dylbill Posted May 4, 2020 Share Posted May 4, 2020 No problem. If you're having errors compiling the script, it probably means you're missing some skse source files. I get no errors when compiling. Glad it's working though! Link to comment Share on other sites More sharing options...
Recommended Posts