jamochawoke Posted September 18, 2011 Share Posted September 18, 2011 (edited) Ok I haven't edited too many AI packages in the past... just a few times for a few custom NPCs and mostly basic stuff like eat, sleep, patrol, follow player, et cetera. I want an NPC, when he goes into his room to sleep, to close the door (non-portal door, just swings open and closed) behind him. Right now he goes in to his room then leaves the door open. It remains open until the cell resets. I'd also like him to close the door again when he leaves the room (if I get him to close it when he enters working). Anyone have a clue on how to get this done? Edited September 18, 2011 by jamochawoke Link to comment Share on other sites More sharing options...
RolandRoberts Posted September 18, 2011 Share Posted September 18, 2011 Although there are many ways to accomplish this, one way is to place a script on the door that closes (and locks if desired the door at either a certain time, or when the NPC takes a certain action). As an example, here is one of my scripts to close a door at a certain time - it can easily be modified to close based on an action by your PC or NPC (using something like getdistance, getsitting, getsleeping functions, etc.): Scriptname RRDoorCloseGeneric ;************************************************************************************** ; ; SCRIPT DESCRIPTION BLOCK ; ; This script closes doors at midnight. It is attached to any generic door BUT ; make sure such door has a parent REF created by your mod! ; ;///////////////////////////////////////// End of Description Block ////////////////////////////////////////////// ;************************************************************************************** ; ; SCRIPT VARIABLE DECLARATION BLOCK ; ;************************************************************************************** ; NO LOCAL VARIABLES NEEDED ;///////////////////////////////////////// End of Declaration Block ////////////////////////////////////////////// ;************************************************************************************** ; ; GAME MODE CODE BLOCK ; executes once per frame instance, includes any Strain Block code) ; ;************************************************************************************** begin GameMode ;-------------------------------------------------------------------------------------------------------------------------------- ; MINIMIZING CPU STRAIN BLOCK ;-------------------------------------------------------------------------------------------------------------------------------- If GameHour > 0.25 return endif ;----------------------------------------- End of CPU Strain Block ----------------------------------------------- If GetOpenState == 1 SetOpenState 0 ; closes the door at midnight endif end ;Script by Rougetet Link to comment Share on other sites More sharing options...
jamochawoke Posted September 18, 2011 Author Share Posted September 18, 2011 Wow thanks! Have some kudos :) Link to comment Share on other sites More sharing options...
Recommended Posts