WhiteWolf424242 Posted August 15, 2021 Share Posted August 15, 2021 Hello, What would be the best way to determine the current location of an NPC? By location here I mean a large area, larger than a CK Location. As in "this NPC is definitely somewhere in Whiterun". Or "definitely somewhere in Solitude + docks". For example, I want to know if an NPC is in any segment of Whiterun.I could check for their Worldpsace to be the Whiterun worldspace, that covers most of the town. But how do I handle interior cells? Interior cells are their own Worldspace, and most of them (like Jorrvaskr, Ysolda's home) are their own location too. Unfortunately these Location's don't really have Whiterun-related Keywords on them either (which could have been something to check on). I'd like to avoid the bloat of having to list a lot of conditions, manually comparing the parent location of the NPC to every Location that's known inside the city.Is there a shortcut around this? Thanks Link to comment Share on other sites More sharing options...
dylbill Posted August 15, 2021 Share Posted August 15, 2021 You can use the IsInLocation function. If the npc is in the location, or any of its child locations it returns true Link to comment Share on other sites More sharing options...
WhiteWolf424242 Posted August 16, 2021 Author Share Posted August 16, 2021 Ah, so even if the NPC is in an interior somewhere that is its own Location, then just checking for IsInLocation for the hold or town-location will still be true?I've quite missed that, thanks :smile: Link to comment Share on other sites More sharing options...
dylbill Posted August 16, 2021 Share Posted August 16, 2021 Yes, that should work, as long as the interior location is a child of the hold location. Link to comment Share on other sites More sharing options...
Recommended Posts