About This Mod
Hey all, since my mod UnequipOnSit did quite well, I've created a modders resource for anyone who wants to have a Player enter a bathing area or sauna, unequip all their items, and then re-equip them once they leave.
It's pretty simple to setup, all you have to do is create a trigger, add a new script, attach two properties to it, and paste my code.
This code requires an SKSE function called EquipItemEx, before you start this, make sure your SKSE scripts are in the correct folder. Quick guide here https://forums.nexusmods.com/index.php?/topic/6076808-ck-not-compiling-with-skse-functions/
Step one. Create a Dummy NPC. I use Abelone for this, but it doesn't matter who (I recommend a female though, there is much more female specific armor and armor slots than there are for males.) Right click on Abelone, and duplicate. Open the duplicate, and change the ID to something relevant. (I use 0_StripDummy) Next, remove ALL of her packages, inventory, and scripts, change her voice to none, and remove her name. (You don't want an invisible NPC with a floating name)
Save the NPC, and hit NO for the first popup, and YES for the second.
Move that NPC to a test cell, (I use Qasmoke, you basically just don't want her in the worldspace.)
Step two. Create your trigger at whatever location you want the player to unequip all items, and name it. (I use something like StripItemsPlayerTrigger) Once the trigger is created, right click the Reference in the Cell View Window, (NOT the actual trigger) and click edit. Select the scripts tab, and hit add. Add a NEW script (You'll only need to do this once for that ESP) and make the name StripTriggerPlayer (or something relevant) making sure it extends ObjectReference.
Before editing the source, set the properties. (this helps avoid a LOAD of papyrus errors. If you don't set the properties first, then papyrus screams at you because none of the variables are defined.) You'll be creating 2 properties.
1. Click Add property, Choose Actor (not Actor Base) and name it Dummy. Select the Cell you put her in in the drop down, and then the reference of the actor. (Should be 0_StripDummy)
2. Add Property, choose Actor, and name it PlayerRef. Hit autofill.
3. Add Property, choose Int, name it InTrigger, and set the default value to 0
4. Add property, ObjectReference, select the cell you made the trigger in, select the trigger.
(THESE LAST TWO STEPS ARE NO LONGER NEEDED.
Step 3. Right click the Script you created, and hit edit source. You should see something like this.
Scriptname StripTriggerPlayer extends ObjectReference
Actor Property Dummy Auto
Actor Property PlayerRef Auto
Right below that, paste in the code from my PSC file (VERY CLEAR INSTRUCTIONS OF WHAT TO PASTE)
Now the player will unequip all items in the trigger, and replace all items upon leaving.