1. Script Name: Automatic Door Closing by
Martin Holubec aka Sharlenwar
2. What it does: There are two scripts, one intitiates a local variable
"beatcount" to count the heartbeats. The second script checks each
heartbeat to see if the variable is at 4, and if so, closes the door.
3. Notes: This is useful for those persistant world modules that players
open doors in and never close.
4. Place this part of the script in a doors OnOpen
NWScript: void main()
{
SetLocalInt(OBJECT_SELF,"beatcount",0);
}
Then place this script in a doors OnHeartbeat
NWScript: void main()
{
if ((GetLocalInt(OBJECT_SELF,"beatcount")) == 4)
{
if (GetIsOpen(OBJECT_SELF))
ActionCloseDoor(OBJECT_SELF);
SetLocalInt(OBJECT_SELF,"beatcount",0);
return;
}
else
SetLocalInt(OBJECT_SELF,"beatcount",(GetLocalInt(OBJECT_SELF,"beatcount")) + 1);
}
And viola, it should work. If you want the door to remain open longer,
then just change the == 4 to something like == 10 which then about 20
seconds will transpire before closing.
|