Jump to content

Unequpping NPC's Clothes to Sleep


ProjectEW

Recommended Posts

I'm making a mod right now, that has guards in power armor. I've got a schedule set up for them to sleep at a certain time, but it looks kinda silly when they sleep in their power armor. So, what I'm asking is how to make an NPC unequip their power armor once they start sleeping, and re-equip when they wake up. By the way, I have quite a few guards, so I would be happier if there was a way to do this without having to write a separate script for each of them.
Link to comment
Share on other sites

You could put a trigger around their beds and use an OnTriggerEnter block to remove their armor and an OnTriggerLeave block to re-equip it. Combine it with a few checks to ensure they are about to sleep and are the NPCs you want the trigger to act on, and it could work. You would have to know the exact armor object each was wearing, but if they all wear the same armor and have no other armor in their inventory, you could apply the same script to each trigger. If there armor varies, you could then use FOSE commands to determine what armor they were wearing and still apply the same script to each trigger.
Link to comment
Share on other sites

I see that triggers are scripts, but how would I set the radius of that trigger? And, their armor does vary some, and I am using a FOSE-enabled GECK, so how would I use those FOSE commands?

EDIT: Never mind the stupid comment about triggers being scripts, my bad. But I DO still need help on the FOSE commands. Is it GetArmor or something similar?

Link to comment
Share on other sites

When you click on any trigger, you will see 3 'gizmos', one for each dimension. You can drag their arrow heads to change the shape of the trigger to encompass the bed, The use FOSE's GetEquippedObject (or GetEqObj) using slot 2 for armor. That will return the ID of the armor, something like this:

 

Ref MyArmor
Ref MyNPC

Begin OnTriggerEnter
  Set MyNPC to GetActionRef
  Set MyArmor to MyNPC.GetEqObj 2
  MyNPC.UnequipItem MyArmor
End

 

This will unequip the trigger activators armor. You will need to add some checks to insure that only your guards will be affected (use a faction) and that they are about to sleep (GetCurrentAIPackage = 4)

Link to comment
Share on other sites

I suspect Kudos will make a return one of these days. Until then a thanks is just fine.

 

Just so you know, that script is just a snippet. There is more that you will need to do. When you re-equip the armor, you will most likely have to perform the little trick that is described on the bottom of the unequipitem wiki page.

Link to comment
Share on other sites

I suspect Kudos will make a return one of these days. Until then a thanks is just fine.

 

Just so you know, that script is just a snippet. There is more that you will need to do. When you re-equip the armor, you will most likely have to perform the little trick that is described on the bottom of the unequipitem wiki page.

Another option would be using result scripts on the NPCs' AI Packages to change clothes. Give them a travel package that takes them to the location of their bed. When they reach that location then set their sleep package to begin. Within the AI Package edit windows are places to add result scripts at Begin/End/Change. You can tell the NPC to unequip their PA and equip their nightshirts (or go commando) before settling in to sleep. Reverse the method in the morning at the beginning of the travel package that begins their daily routines. This method eliminates the addition of trigger boxes around beds and also allows the NPC to use whatever bed may be available since it is activity triggered and not specific to a certain trigger box.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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