Jump to content

[LE] Random movement of NPCs; is it possible with scripting?


TaxiVader

Recommended Posts

Hi Folks.

 

I am making a mod at the moment that is sort of a large town. It contains lots of shops, pubs and other interesting places. Part of the population of the town is the idle elite, and I want them to behave that way.

 

I now understand the package system of setting NPC movements, but what I'd really like is for my idle rich people to wander around town popping into shops, pubs, whatever, throughout the day in the times when I don't have them specifically being elsewhere.

 

Giving the appearance of that sort of thing with packages is possible but extremely clunky, each NPC would have a package list as long as my arm, especially if they are to be doing different sequences on different days of the week.

 

Can anyone suggest a method for doing this, perhaps using some form of script(s)? Like, can I have a list of locations that the NPC will visit randomly during specified times of the day for either set or random periods of time per visit? If I was doing this in Microsoft Excel I'd use random numbers, vlookups and indexes, is such a thing possible here?

 

I have little experience with scripting to date but am not afraid to give anything a go.

 

Any ideas?

 

Thanks,

 

TV

Link to comment
Share on other sites

Hey yes this is possible. I did something similar to this with my latest mod Triple Triad Card Game in Skyrim. The NPC travels to a random inn, anywhere in Skyrim every 5 to 14 days. What I did was put the travel package on a reference alias in a quest. The reference alias point to the NPC, specific reference. Make another reference alias in the same quest. This one put as Find Matching Reference. Here you can put conditions for the reference to find. Maybe you can put a bunch of object reference markers in a formlist and use the IsInList condition. The alias fills with a random object reference based on the conditions when the quest starts. So, when you want your NPC to go somewhere, start the quest with the script. Then use the package end fragment or the package change fragment to stop the quest. I checked the Must Complete flag in the package so it will always stop the quest. Also in your package set the Travel Location to your reference alias. Hope that helps!

Link to comment
Share on other sites

A RefAlias script could be like this depends on what are you looking for. You can add properties like location or package when needed for comparing or use method from dybill with two refaliases.

Behesda tut for package creation: https://www.creationkit.com/index.php?title=Bethesda_Tutorial_Packages

 

tvNPCBehaviorAliasScript

  Reveal hidden contents

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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