NWN2 Toolset

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Auto Close Doors

 
Post new topic   Reply to topic    NWN2 Toolset Forum Index -> NWN2 Script Vault
View previous topic :: View next topic  
Author Message
Kazgoroth
Site Admin


Joined: 01 May 2006
Posts: 478

PostPosted: Mon Feb 12, 2007 9:20 pm    Post subject: Auto Close Doors Reply with quote


Only registered users can see links on this forum!
Register or Login on forum!

Back to top
View user's profile Send private message Send e-mail Visit poster's website
Hellcow



Joined: 17 Jan 2007
Posts: 100
Location: Denmark

PostPosted: Mon Mar 05, 2007 1:26 am    Post subject: Reply with quote

I took the liberty to add a small bit to the script above so it also includes the possibility of locking the doors.

Code:
/*
Filename:           door_auto_close
System:             miscellaneous
Author:             WizardStorm Think Group (Development@WizardStorm.com)
Date Created:       Oct 7th, 2006.
Summary:
Automatically shuts oDoor1 after an set amount of time.

If oDoor1 is connected to oDoor2 via a transition, it will close oDoor2 at the same time.
By default, doors close after 30 seconds, however you can override this by
setting a local float variable on the door called AUTO_SHUT_DELAY.

If AUTO_SHUT_DELAY equals -1.0, the door will never auto close.

-----------------
05.03.07 Hellcow
Lock door function added. Set a (int) variable on the door named LOCK_DOOR with the value of 1
and the door will lock when it closes.
-----------------
*/
void main()
{
   object    oDoor1          = OBJECT_SELF;
   object    oDoor2          = GetTransitionTarget(oDoor1);
   float   fShutDefault   = 30.0;
   float     fShutDelay       = GetLocalFloat(oDoor1, "AUTO_SHUT_DELAY");
   
   if(fShutDelay == -1.0)
      return;
   else if(fShutDelay == 0.0)
      fShutDelay = fShutDefault;
      
   AssignCommand(oDoor1, DelayCommand(fShutDelay, ActionCloseDoor(oDoor1)));
   AssignCommand(oDoor2, DelayCommand(fShutDelay, ActionCloseDoor(oDoor2)));

if (GetLocalInt(OBJECT_SELF, "LOCK_DOOR"))
    SetLocked(OBJECT_SELF, TRUE);    
}
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Kazgoroth
Site Admin


Joined: 01 May 2006
Posts: 478

PostPosted: Mon Mar 05, 2007 7:57 am    Post subject: Reply with quote

Genius Smile
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    NWN2 Toolset Forum Index -> NWN2 Script Vault All times are GMT
Page 1 of 1

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum





Powered by phpBB © 2001 phpBB Group

Chronicles phpBB2 theme by Jakob Persson (http://www.eddingschronicles.com). Stone textures by Patty Herford.

Abuse - Report Abuse
Powered by forumup.com free forum, create your free forum!
Created by Raulken of Hyarbor S.r.l.
TOS & Privacy.

Page generation time: 0.027