Jump to content

Enabling/disabling NPC's on a daily schedule?


Guest Messenjah

Recommended Posts

Guest Messenjah

So, I'm going to try some smaller stuff before I hit the more difficult scripting elements. So, I'm setting up NPC's in my nightclub. Where I'm worried, is with setting up pathing, a schedule for different NPC's and AI packages.

 

What I would like to do with one particular character is a bit trickier. Basically, I need a character to spawn in front of a door at a specific time of day, walk over to a peice of furniter and interact with it, then 4 hours later, they need to leave by walking to the door and then vanishing.

 

Now, I should just be able to set up an NPC that is initially disabled, set up a path starting from the door and have an ending waypoint at the marker or maybe even set up the furniter as the last waypoint (not sure if you can do this), which should be reasonably easy to do, then create a set of waypoints that lead back to the door. The question is, how do I enable the NPC and then later disable the npc once the door is reached?

 

The only thing I can think of, is to create a script on the NPC that enables them at a particular time of day, I will then have an AI package that starts at the same part of the day and leads them to the furniture that they will interact with. Then at a specific time of day, that AI package will end and another will begin, leading them back to the door to exit.

 

Then, should I place a script at the door or final marker that, if it is reached and it is greater than a specific time, the NPC will become disable?

Link to comment
Share on other sites

As I understand it you have several options. I will attempt to explain each:

 

-Hand drop the NPC's into the world as persistent ref's. Each one is unique. Use a quest script to enable/disable each one as you see fit, based on If conditions. Pros:

 

-Centralized management of all npc's using a single script -Easy to set up and change since its only 1 script

 

Cons:

 

-Constant tracking of all NPC's, when they are not loaded or on screen; numerous lines of code and several conditions

 

 

Creating "spawn points" in your club:

 

-Basically, do not do this. Every NPC will remain there for three days, until refresh, unless you set the cell to refresh on load. If you do this, it will refresh if the player so much as steps out for "air" and then back in.

 

 

 

-Using scripts on NPC's. Go with this one. Using Begin Onload or Begin Gamemode conditions on NPC (object) scripts should work. You could do something like:

 

Scn myscript ; this is your script name (choose something Unique, for instance, I always use something like BCMyscript.

 

short chance ; a random variable, use whatever term works for you.

 

Begin Onload

 

set chance to getrandompercent

 

If chance >= 50

enable

else

disable

endif

end

 

This tells your NPC (or table, or chair, or container, or any other object) that it has a 50/50 chance of "being there" when the player shows up. Using a few such scripts, each with different chances, gives your club some randomness to its inhabitants on a nightly basis. Just be sure to create plenty of NPC's with varying appearances and maybe even faction memberships (dialogue variations.) Off duty NCR troops, Off work crimson caravan types, etc.

 

Hope this helps. Be aware that this will work every time the player enters the club after leaving, however, so it might cause some weirdness if players step in and out often. Another option is this:

 

 

Begin Onload

 

If gameday != 1 || gameday != 5 ; if its not the first or 5th day of the week, when the cell I am in loads enable me. Otherwise disable me.

enable

else

disable

endif

end

 

Or:

 

Begin Onload:

 

If gamehour > 20 || gamehour < 4 ; if its after 8pm and before 4am, enable me when the cell i am in is loaded. Otherwise, disable me.

enable

else

disable

endif

end

 

You could use this on (non-persistent) chairs, tables, drink bottle, drinks, people, etc. Makes for some strong variations in your interior cells. Be aware that the more scripts which run on load, the longer it will take to load your cell. Hope this helps!

Link to comment
Share on other sites

Guest MobMessenjah

Well, this may help but the thing is, unlike other cells in NV, my cell will be incredibly busy. I hate how the Casino's and clubs all look like they have about 2-3 people walking around in any given room. This place is a bit smaller and will be rather packed. Bouncers and guards will be a bit generic and the door greeter/receptionist will be constant. I have so many npc's that it would be impossible to try and make every single one unique. The dancers I would like to do this with however but I have about 16 different variants. But I agree, the club will need some randomness.

 

The biggest problem that will occur with certain NPC's is that it will look bad if, for instance, at a certain hour they simply just "vanish" and another one appears. They really need to be able to go somewhere and vanish in order for it to look half decent.

 

What I'm getting at is this:

 

Let's say, I'm in the club at 9PM. The dancer I am watching on top of a table is enabled between 4PM and 8PM. 8PM has passed and now it is time for a new dancer to be enabled and the dancer I am watching just vanishes... will this occur? Or will it spawn only if I walk out of the room and then back in? I know that there are some posters that have lights on them that turn on after 6 PM and turn back off at 6 AM and you can actually watch them turn on and off.

 

For faction related characters, this would be a great idea though but it would be better to set something like a trigger or marker that is next to a door that enables/disables them.

 

What if I set up a trigger for NPC's that when they walk to a marker next to a door, they will be disabled, will they still be located at trigger location when the game tries to re-enable them? Or can they re-enable at a certain spot?

Link to comment
Share on other sites

Guest MobMessenjah

Maybe a better way to ask this is....

 

 

If when they are re-enabled, will they re-enable in the last known location or will they re-enable in their original location (where they were placed with the GECK)?

Link to comment
Share on other sites

I know that when I execute npc.disable or npc.moveto, the npc immediately teleports. In the case of moveto, I can see the npc fade out if I am looking that way, and I can see it fade in if I am looking that way. In the case of disable, then enable, I am not sure if the game stores the last position, but you could probably try it easily. Either way, the effect will be distracting if the player is there.

 

It sounds like you are attempting something on a scale which even the development team did not attempt, with such a large number of NPCs. That may be a good idea, but it may be hard to get it all working. I highly recommend to start smaller. Put one or two NPCs in the room; experiment with packages; see what happens.

 

As a player, I would probably be intimidated by such a large number of NPCs. If I had a mission to interact with one of them, and there were many similar looking (but not same) ones, and the one I wanted was only there sometimes, I might get a little frustrated.

Link to comment
Share on other sites

Guest MobMessenjah

Yeah, most of these NPC's are simply extras. The characters that you interact with are unique and have unique outfits and a unique look. I've only dropped a few NPC's in so far.

 

Basic NPC types that are generic and random:

Bouncers (hired guards)

Dancers (pole dancer and table dancers)

Bandino thugs (They pretty much are armed guards much like the bouncers but they are the boss's soldiers)

Club Goers

 

The dancers obviously will be the most complicated out of these as they will need to be randomized and dance at different times. The bouncers and thugs can pretty much just lean against walls and look mean. The club goers, I plan to have random NPC's that walk around and some that will sit at chairs. I'm not really sure as to, if I want them to be just gamblers or set them up as clubbers with some new outfits I've made.

 

Perhaps, keeping the factions out if it would be a good idea. It's along the strip anyway so you probably mostly see people in fancy suites anyway.

 

The reason that I'm talking about fade-in, fade-out is because if I can set them up to walk next to the door and fade out, it will be fine

Link to comment
Share on other sites

  • Recently Browsing   0 members

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