Altap214 Posted November 24, 2016 Share Posted November 24, 2016 I'm currently making a mod with an npc who randomly wanders all over skyrim and once a week stops in at one of the towns or cities in skyrim. He's got an ai package to radiantly choose a town to visit and sandbox in, which works fine. I'd like to him to have the ability to wander in and out of shops as well as sandboxing in the town, but mainly spend the evening in the local inn of which ever town he's currently in. I'm not sure how to set up an ai package to get him to go to the local inn from whichever town he's radiantly in, rather than radiantly picking an inn which might be halfway across skyrim, and would really appreciate any help or advice people might have. Link to comment Share on other sites More sharing options...
ulfrpsion Posted December 20, 2016 Share Posted December 20, 2016 I hope I'm not necroing this.... This is better suited to a full quest, rather than a simple AI package. Quests provide Aliases that can broadly apply and remove sets of AI packages, which is what you'll want to do. Start by making an alias, non-optional, for the specific actor. Have it as the highest in the alias list. Next, make empty aliases that have sets of packages, each for a specific town -- whiterun, winterhold, etc. The quest should....Start on game init.Run once. The quest would need an initialization/startup stage. In this stage, have a script snippet that does this:Fills the Actor Alias into one of the City-specific Aliases with packages.The Non-Optional Alias should have a script that does the following.On Init, perform Registration for a interval update. *Notice this is an Alias Script function. Attach a script to the non-optional alias as it will always be filled with this function inside it.On Update, select a new city. Empty the City Alias that the actor is in, and force the non-optional alias into a new city alias. This is how you will hot-swap the packages during run-time.Each city alias should have...A set of packages in sequence of what you want the NPC to do in the city.A default package for the actor to travel to a location in the city and sandbox. I tend to have a default travel to the Inn's interior cell, and sandbox in the entire cell (This should be last in the list).Factions for the local townspeople and such so that the actor will appropriate crimes correctly.On Fill of the Alias, call an evaluate packages function to force the NPC to re-evaluate their packages.You should have a clean up stage as well that...De-registers the Alias from the update.Flushes all city aliases.Performs quest shutdown.In the case of the Actor dying (i.e. OnDeath event), you will want to transition the stage to the cleanup stage to keep things safely cleaned up. You should also allow the non-optional NPC as "allow dead", etc., and check for death on init. Doing it like this will give you access to wayyyy more functionality. You can control their inventory so they dress differently in different towns, control their dialogue so they say hellos differently, manage their bartering to barter differently based on their town (this is handled by faction), etc. If you want to randomly set the town, have each city alias pushed into a list, and then use this function for a random int to randomly pick the city alias from the list and fill the npc into it. Enjoy! Link to comment Share on other sites More sharing options...
Altap214 Posted December 21, 2016 Author Share Posted December 21, 2016 Nope I'm still checking in the hope someone helps :) Thank you very much this is incredibly helpful. I'm probably publishing version 1 in the next few days, then having a bit of a break from the creation kit, but I'll be adding this in an update in the new year Link to comment Share on other sites More sharing options...
Recommended Posts