Lydia Gets A Life
OrBasic AI Packages
This tutorial will show you how to build a basic AI package for your NPC's/custom housecarls etc.
For this example I shall give Lydia a bit of an overhaul to A) get her out of your bedroom! & B) give her more of
a life while not currently set as a follower.
To start with open the CK and navigate the objects list to <Character> - <Packages>. In here, find
MarriageSpouseWhiterunSandoxPlayerHouse. (As you can see I've used the filter to winow the options down.)
Now hit F2 to allow you to edit the name, change the name to something that represents your new default package
(this is where your NPC will consider home at all times).
Now hit Enter twice to duplicate this package with it's new name. (Note I removed the word "Marriage" from the
name so had to remove the filter!)
Now, because I want Lydia to do more than just sit at home I duplicate-with-new-name again. In this case I'll be
sending her to work on the smithing benches at Warmaidens.
And again to let her spend her evenings at The Bannered Mare, which gives me a total of 3 packages.
Because Lydia already lives at Breezehome I don't need to change anything in the default "PlayerHouse" package,
but because it's unlikely you want all your new NPC's to live there as well I'll skip forwards in Lydia's day
to the Bannered Mare to show how to change the "Live in THIS cell" part!
Firstly, double-click the package to open it's editing window and go to the first tab, <Package>, select the
<Location> option and click the <In Cell 'WhiterunBreezehome'> button.
Now, in the In Cell drop-down box, scroll to the desired cell, in this case for me, The Bannered Mare.
Now, if this is not the main cell you wish your NPC to "live" in but only to visit select <Allow Sleeping> and
deselect the <True> option. This is only necessary if this is NOT the cell you wish them to live in but does have
Finally we need to add some conditions as for this cell Lydia will only be visiting at certain times of the day.
Firstly, go to the <Conditions> tab, right-click in the listing area and select <New>.
Change the <Condition Function> to GetCurrentTime>.
Then change the <Comparison> to greater-or-equal-to (>=). Tip: The open end of the arrow is always greater than
the point, the point is always less than the open end!
And change the <Value> to the time of day you want this package to begin/change it's "should I do this" check.
In this case I want Lydia to head to the pub at 1PM, so 13.00.
Note: The hours are standard, 0 = midnight, 23 = 11PM, but the minutes are decimal, 0.5 = half past midnight!
Also, packages cannot go over the midnight mark! If you want a package to last, say, between 6PM and 6AM you must
create 2 packages, one from 18.0 (6PM) to 23.9 (just before midnight) and another from 0.0 (midnight) to 6.0 (6AM).
Now right-click this condition and <Duplicate> it,
and double-click the new copy to edit it to tell it when to stop running this package. To start with reverse the
greater-or-equal-to to less-than-or-eaqual-to (<=),
and the time <Value> to the time this package should end. In this case I want Lydia to go home at 6PM (18.00).
Now your package will tell itself "I should only run if it's gone 1PM, but not past 6PM".
We now have two packages done, the default "this is where I live 24 hours a day" package, and also the "I should
"hang out" in this cell between these times" package. These are fine for indoor spaces but Warmaidens is a different
matter however, as it is not in a cell, but an open worldspace.
For this we need to open that worldspace and "tag" an object to "live near".
To start with, I want Lydia to "hang out" around Warmaidens so I'll head to the <Cell View> window and switch from
<Interiors> to <WhiterunWorld>.
And because I already know where Warmaidens is I'll now select <WhiterunPlainsDistrict03>.
To narrow things down I've written "craft" in the filter box as I know theres a crafting bench nearby,
then double-clicked the bench to focus on that in the render window. (Yes-to-all when the errors pop up!)
I can now open my Warmaidens AI package for editing and instead of using the <In Cell> option, I switch to <Near
Reference> and hit <Select Reference>.
That immediately turns my mouse cursor into a red target with which I double click the armour bench. The details of
the bench are automatically placed in the <Location> <Near Reference> drop-down boxes.
And to make sure Lydia uses all the nearby facilities I set the radius to 2000, which is nice and large! You don't
have to set a radius for <In Cell> because the whole cell is the reference!
Now I set the <Conditions> for the times Lydia should hang out at Warmaidens.
Hit OK all the way out and that's the packages done! Now all we need to do is apply them to our NPC.
Head to <Actors> - <Actor> and find the NPC you want to add these packages to, in this case Lydia is
Double-click the NPC to open it's editing window and go to the <AI Packages> tab.
Now, because Lydia already has a (crap) sandbox package (thats the one that makes her sit at the end of your bed
all the time!) I'll select it and hit Delete to remove it.
Now right-click in the list area and select <Add>.
And add each of your packages. To make sure that things run in the correct order use the arrow buttons (<< & >>) at
the top to move the packages up and down the list. Because I want the Warmaidens & Bannered Mare packages to override
the default "I live hear" playerhouse package I move them above it in the list, if they were below the playerhouse
package it would overwrite them and they would never run!
Now hit OK, save your mod and go check things out!
Your NPC, like Lydia, should now have a life!!
Important Note: You should be very carefull adding new AI packages to vanilla NPC's, you may break something!!
Example ModLydia Gets A Life - Download