"Disabling" NPCs during certain hours

Post » Mon Apr 27, 2015 12:05 am

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 who have no place to live.

Any way I could do this simply? 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!

User avatar
Manuel rivera
 
Posts: 3395
Joined: Mon Sep 10, 2007 4:12 pm

Post » Sun Apr 26, 2015 10:44 pm

Via scripting, this is very similar to the lights tutorial on the CK Wiki.

http://www.creationkit.com/Light_Switch

You put it on say, a Quest (a quest script) and make an array of your actors. Then RegisterForSingleUpdateGameTimeAt the time when you should disable, GoToState Disabled, RegisterForSingleUpdateGameTimeAt the time to reenable and if you're in the state Disabled and you OnUpdateGameTime, go to state Enabled.

I can provide an example script if you need one.

User avatar
dean Cutler
 
Posts: 3411
Joined: Wed Jul 18, 2007 7:29 am

Post » Mon Apr 27, 2015 5:11 am

Wouldn't that cause them to vanish while you are watching if you are near them at the wrong time? That would be OK for ghosts but for other NPC a check to see if the player is in the same cell might be needed or a script to tell the npc to go though a load door then be immediately disabled or some other way to prevent them from vanishing while you watch might be needed.

User avatar
Dawn Farrell
 
Posts: 3522
Joined: Thu Aug 23, 2007 9:02 am

Post » Sun Apr 26, 2015 2:21 pm


Yeah. You could just do the If player HasLOS

Don't disable
RegisterForSingleUpdateGameTime(0.5)

If player !HasLOS

Disable

Else

RegisterForSingleUpdateGameTime(0.5)

Repeat
User avatar
Siobhan Thompson
 
Posts: 3443
Joined: Sun Nov 12, 2006 10:40 am

Post » Mon Apr 27, 2015 6:23 am

As long as you don't provide a room for them to 'live' in, there's always a chance you'd see them vanish in front of your eyes. If it's only about those travelers, you could tell them to leave the town, and when they're in fornt of the main gate could simply let them fade out to the disable state. Vice versa when they're supposed to return.

User avatar
Jodie Bardgett
 
Posts: 3491
Joined: Sat Jul 29, 2006 9:38 pm

Post » Sun Apr 26, 2015 9:27 pm

This is all perfect, thank you so much!

User avatar
Richard
 
Posts: 3371
Joined: Sat Oct 13, 2007 2:50 pm

Post » Mon Apr 27, 2015 4:36 am

Pulling this back from beyond the valley of 2014...

I finally got into this, and more or less did exactly the "light switch" tutorial, except that I made a FormID List of the NPCs I wanted to disable, fed that into the quest, and am looping over the list to disable/enable NPCs. But it doesn't do anything in-game, and I'm sure it's because I did something wrong at the basic level with the quest setup or something. No Papyrus errors, just doesn't appear to work. I'll be adding log debug script to see if things are firing.

Despite working with quests for the last mod I just released, I still don't get some of the fundamental aspects, and tutorials are really geared around making literal quests with a giver, stages, dialogue etc. and don't seem to get into the finer points of using them as mechanisms to simply control things. I know this understanding will come in time.

My question is, if I wanted this "always running" quest just to execute a script that switches things off/on, do I NEED to have an alias, and should that alias be the player? Or can a quest just "run in the background" without needing to have an alias filled? MCM menus and the quest I put together to control my zoom hotkey mod have a forced reference on the player, which sort of makes sense since both of those only effect the player and nothing else, but this effects placed NPCs.

The second question is whether or not you can call ENABLE/DISABLE on ACHR placed NPC records the same way you can on a direct NPC reference. These NPCs are actually leveled NPC lists placed in the world, so they vary.

I can go into more detail and post code, but some basics on how to set up the quest for an "always-on" script that modifies things in the world would be the best starting point. I tend to skip ahead sometimes.

User avatar
Daddy Cool!
 
Posts: 3381
Joined: Tue Aug 21, 2007 5:34 pm

Post » Sun Apr 26, 2015 6:57 pm

I would avoid to "disable()" a NPC, especially if are aliases. I got some issues in one of my mod. I used to make a "hold interior" cell instead. When I need NPC vanishing the I move it to the hold interior cell.

User avatar
Emma Parkinson
 
Posts: 3401
Joined: Wed Jul 26, 2006 5:53 pm


Return to V - Skyrim