Jump to content

"Disabling" NPCs during certain times of the day


fadingsignal

Recommended Posts

This seems like it should be simple, but I'm looking to disable certain NPCs during certain hours. I have a bunch of "traveler" NPCs I've added to towns, who I want to roam around the market during the day, but I want them to go away entirely at sunset and not come back until morning.

 

I know I could add a package for them to travel to an Inn, or to go into someone's home, but I want them GONE. They are really generic "ambient" NPCs.

 

Any way I could do this? Could I make a travel package that sends them into some sort of a holding cell during the night hours? I'm also concerned that having 20+ extra AI packages running around the clock in each town is going to punch me right in the CPU.

 

Thanks!

Link to comment
Share on other sites

just give them a basic DoNothing package that is at the bottom of the stack, and add a blank cell with just a floor and navmesh and 1 xmarker, and in the package end script fragment for w/e package you have running in the town just self.moveto(xmarker1), and likewise pick a random spot in town or right outside and in the package start self.moveto(town) etc etc, doesnt really add tons of packages etc and no persistent scripts so pretty 'safe' though unlore friendly if you see them pop into existence at the exact time the script fires

Link to comment
Share on other sites

just give them a basic DoNothing package that is at the bottom of the stack, and add a blank cell with just a floor and navmesh and 1 xmarker, and in the package end script fragment for w/e package you have running in the town just self.moveto(xmarker1), and likewise pick a random spot in town or right outside and in the package start self.moveto(town) etc etc, doesnt really add tons of packages etc and no persistent scripts so pretty 'safe' though unlore friendly if you see them pop into existence at the exact time the script fires

Half right, but not really the best practice since you'd be having to constantly move NPCs around with scripting every time. On a few NPCs this wouldn't be a problem, but on a few dozen it can lead to performance issues and instability.

 

The best way to accomplish this would be to have a second door placed behind the door to the inn, such that the player will never see it but where it is still in range for NPCs to access it. Tie this door to a new cell that has enough of an interior space (and door leading out) to hold all your NPCs (adding beds means NPCs won't be constantly milling about). Set the cell to the same faction as the NPCs and give it a required rank to prevent other NPCs entering. Give the NPCs a package to tell them to sleep in this interior until the morning. Do this for all the towns so that each has their own holding room.

 

This way, it will look like NPCs are entering/leaving the inn without having to keep the inn filled with people. You can also add a few alternate doors to the cell within the city so that all the NPCs aren't going to the same exact place.

Link to comment
Share on other sites

That is honestly a more terrible idea IMO, because then you are adding doors etc and having to finalize the navmesh to link those doors or else npc's tend to not use them. And that would lead to compatibility issues galore with people who overhaul towns etc. Now this is a non point if you have added xmarkers and stuff already and are not just using vanilla waypoints and crap. If you are adding stuff already to the citys etc then adding the doors and such is easier as you are already courting compat problems

Link to comment
Share on other sites

A third option (and I am not saying it's the "best" option...), is to track the game hour and enable/disable a parent marker your NPC spawn markers or actor references are linked to, according to the hour of the day.

Link to comment
Share on other sites

As Vagrant noted, your method work great if confined to only a couple of NPCs. I am not comfortable with the method Vagrant suggested for the same reason you noted. However, if the mod author was building a custom settlement in a custom land named Ripskar, or...Falple, and had complete control over navmeshing and don't need to worry about conflicts with default game cells or worldspace, Vagrant's suggested method would be a relatively clean way to handle populating the settlement only at specific times, without necessitating any scripting at all. The method I suggested would require a continually updating script that I think would work better for projects that take place in 1) default game worldspace, and which 2) manages more than a handful of NPCs.

Link to comment
Share on other sites

That is honestly a more terrible idea IMO, because then you are adding doors etc and having to finalize the navmesh to link those doors or else npc's tend to not use them. And that would lead to compatibility issues galore with people who overhaul towns etc. Now this is a non point if you have added xmarkers and stuff already and are not just using vanilla waypoints and crap. If you are adding stuff already to the citys etc then adding the doors and such is easier as you are already courting compat problems

 

Nav mesh is not an issue since you would be placing the doors into your cell in places that NPCs can already reach. You are not adding new buildings to the city, you are not changing the arrangement of buildings, you are not changing the navmesh; you are just adding a door to a vanilla exterior. The only mod incompatibility you would ever run across is if someone completely redesigns the city in such a way that there is no longer a building where you have your door. And even then, it will only make that door visible or unreachable. It will show up as a minor conflict for that cell, if anything, but will not affect the workings of other mods.

 

In cases where you are needing to improve compatibility with overhaul mods, it would be very simple to just locate your door in the same place that they have their buildings. Otherwise, most overhaul mods that get into totally restructuring towns already add extra NPCs to make the town feel alive, or which has to change default package locations in a significant way.

 

Disabling linked references tied to a marker would still require editing those cells within a city and keeping that object loaded in order for scripts to run. This would be a third solution, but would also be the least reliable since it relies on patent-child connections.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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