Hi! I apologize for coming at this from such an amateur angle, but for a long time I've been wanting to make NPCs change their clothes every so often. Whenever an NPC has their outfit pointed to a leveled list with different clothing, executing a simple disable/enable in the console on that NPC will make them load a random piece of clothing from that leveled list.
I would like to somehow implement that functionality into the game, so that once every day or every couple of days, NPCs outfits will reset and load something different from the leveled list.
So, my questions are:
- Is there another method / function available to "refresh" the NPC in this way besides disable/enable?
- If there is such a method, what would be the cleanest way to implement the event? Registering for a single update once a day for every NPC seems like a terrible idea. It seems like this would ideally happen upon loading of the cell containing NPCs, with some sort of boolean to check whether or not NPCs have refreshed for the day.
- Instead of a full reset like this, does Papyrus or SKSE have a function available to change outfits or refresh clothing specifically?
I am barely learned with Papyrus and need tons of reference in front of me to do simple things currently, so off the top of my head the ridiculous horrible pseudo-code could be something like:
global bool ClothingRefreshToday;RegisterForSingleUpdateGameTime at 6am on ResetNPCClothing() function //resets the check for NPC clothing refresh every morning at 6am// function to reset the bool for if NPCs have refreshed today or notfunction ResetNPCClothing(){ set global ClothingRefreshToday = 0; RegisterForSingleUpdateGameTime at 6am again //I read doing something like this was a good way to avoid those log-spam, error prone timer based checks when a mod is removed}// the function that runs when a cell is loadedOn CellLoad(){ if(ClothingRefreshToday=0){ //if it's 1, meaning this already executed, we'll skip and not bother resetting any NPCs GetAllNPCsInTheCell(); IterateOverNPCsAndIssueResetCommand(); set global ClothingRefreshToday = 1; }}
Thoughts? Thank you!