Jump to content

NPC Travel, How to?


Braclo

Recommended Posts

Greetins to all,

 

Problem im having is that I want a NPC to travel to a location in a exterior cell, wander around there then return to the cell it started in. All that while the PC stays in the interior cell where the NPC started off.

 

Everything works fine IF i follow the npc, but if I stay in his house and wait, he never returns. Went out looking for him and found him starting to run back to the start after wandering on that location.

 

Is there a way I can fix this? How would I do it?

Link to comment
Share on other sites

Depends on what commands you have already put in place.

 

I would give him 2 wander package's one for his editor location with any in all time, date month ect boxes and 0 as duration, then give him a second wander package placed above this one with Must reach location and Must complete ticked, then when the package ends make sure he has no more packages to follow and he will return to his editor location.

NPC's are quite thick so dont be surprised if you have to wait a little for him to walk back through the door.

Link to comment
Share on other sites

Is there a way I can fix this? How would I do it?

First off, a little primer on how NPC processing works. Basically, there are two different regions of processing game elements, there are things in the active area, and there are things in the inactive area. The active area is generally everything in the same space within 12000 units of the player. The inactive area is everything which is not in the same interior cell or worldspace that the player is currently in, or which is within that same space, but is at a distance further than about 12000 units.

 

These two areas process things at different speeds. The active area processes scripts every frame, and AI roughly every 3-4 seconds (depending on processor load). The inactive area usually only processes scripts when those scripts are called directly, and only processes packages when the inactive area is transitioning to become an active area by means of the player moving between the two, or if the player is idle for an extended period of time. There are some exceptions here and there, but they are mostly unreliable and are anything but quick.

 

To simplify things, if the player doesn't see it happening, and no script forces a result, it doesn't happen. It also means that as soon as an NPC leaves the active area they are in momentary stasis until their packaging is processed again as part of the inactive area.

 

To complicate things further, there are two flags related to the base actor which determines their priority for the purposes of background processing (in the inactive area). These flags are "quest" and "no low level processing". If an NPC has the "no low level processing" box checked, the only time that the NPCs packages will be processed will be when time is passing (sleeping/waiting), when the NPC is in the active area, or when the player has just entered the active area. If an NPC has the "no low level processing" box unchecked it forces the NPC into a higher priority, in that the NPC will still move around, however slowly, when in the inactive area. The NPC will however still stop momentarily when passing between areas, and will still often take several game hours to load up the next package unless that package is called directly from scripting. The "quest" flag works in both cases to slightly increase the priority of the NPC's processing so that an NPC, but only slightly.

 

Meaning that regardless of package and NPC settings, an NPC will always pause after leaving the active area, and will always pause when entering the active area. Furthermore, NPCs will only transition from an inactive area to an active area when the player is idle for long enough to allow all active processing to be sufficiently finished. This is why you almost never bump into NPCs entering an interior when you are inside, but will always hear NPCs passing by and through the door the moment you leave. Or in your case, if you're just standing idle in the location where an NPC is supposed to be, he won't arrive; but if you wait at that location until a time that he should have arrived, or are somewhere else, and travel to that location by the time the NPC should arrive, he will be there.

 

Now, all these flags also means that that particular NPC requires more power to process all those things behind the scenes... which leads to a continuous question... "How important is it for the NPC to be moving from one place to the next, and for the player to see the NPC move from one place to the next?". In most cases, it really isn't important. In most cases the player won't be standing around at the location letting time pass, but will either go to that location and wait, or just be entering that location when the NPC is already there.

Link to comment
Share on other sites

Thank you both of you! I understand it better now how it works and why it does what it does. A related question then would be, what do I do? How do I give the "idea" that tha npc went to that location? I gues best would be to disable him when he leave the door and enable a certain time, but how would I do that?
Link to comment
Share on other sites

Again this depends what you want. Do you want a quest to update? If not as soon as the NPC leaves the building ( cell ), a little script with a short timer could be attached to a quest that opens a message box telling the player that an event has happend elsewhere, there is no need to disable him ( at least none that I see )...without knowing all the details it's hard to advise.
Link to comment
Share on other sites

Well ok, we have Sis, Bro and Player for example. Player is suppose to talk to Sis, which in turn tell bro to run to a location (lets say 10 exterior cells away, the starting point is a interior cell).So bro runs there then bro needs to return and tell Sis that all is cool.

 

 

Btw im having trouble with the StartConversation script aswell, but ill post that later on if I havent figured it out by then.

Link to comment
Share on other sites

Hmm...Sounds like you need to wait for his return. To speed things up, you could try using a script to add the return package once he has reached his destination ( this will override the package he is currently using ).

As for the startconversation script, even if you got him to talk to Sis, you wont hear anything unless you can add voice files, I use the sayto command so at least I get subtitles.

Link to comment
Share on other sites

Did the package thing. Just take a long while, but it will work for now. The Startconversation thing. I know about the voice files, no problems with that. What I am having problems with is that Sis dont talk to Bro, she keep going back to sit on the chair. She is busy with a package to sit on the chair, but it aint "must complete" or anything, and Bro is in the same cell.
Link to comment
Share on other sites

Ok, lets say the conversation is called aaaHeDead, I would place a short variable in the script like DoOnce, when bro reaches his destination set DoOnce to 1

then when he returns

 

if DoOnce == 1 && < BroID >.getinsamecell < SisID > == 1

< SisID >.startconversation < BroID > aaaHeDead

set DoOnce to 2

endif

 

Maybe that would work?

 

If you have already tried this then add a find ( target Bro ) package to Sis to override the sit package.

 

if DoOnce == 1 && < BroID >.getinsamecell < SisID > == 1

< SisID >.addscriptpackage aaaFindBro

< SisID >.startconversation < BroID > aaaHeDead

set DoOnce to 2

endif

Edited by slygothmog
Link to comment
Share on other sites

hmmm yea think that Find package is what I am missing. To bad there aint a startconversation package :D. Will try that when I get back to my pc again and let ya know if it worked. Thanks!
Link to comment
Share on other sites

  • Recently Browsing   0 members

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