View Full Version : Reset opened doors?

05-11-2009, 03:36 PM
I am making my new taris middle city area.

I am able to get working doors in game, however, I click on one, it opens i enter and it takes me to another module.

However, when i warp back to my area to continue testing, the doors are still in the open position.

Is it possible to make the doors reset to closed once you leave the module?


05-11-2009, 04:01 PM
Well, I'm not sure about that but it might work with a script. I was thinking about a script with a time delay to close the door possibly attached to the OnOpen script field for the door (or if it already has one you might be able to add it on). I'm not exactly sure what the script function would be either, possibly ActionCloseDoor. (I'm more of a big picture guy :) )

Hope this helps

05-11-2009, 05:35 PM
You could add this few lines into your module's OnEnter script:
object oDoor = GetObjectByTag("your_door_tag");
AssignCommand(oDoor, ActionCloseDoor(oDoor));
It will close door with tag "your_door_tag" after you enter module.

05-12-2009, 08:11 AM
Yes zbyl2's script works, and if you want to open a door use this:
object oDoor = GetObjectByTag("your_door_tag");
AssignCommand(oDoor, ActionCloseDoor(oDoor));

or if you want to close all doors try this:
( ( GetDistanceBetween( OBJECT_SELF, oDoor ) < 10.00 ) && ( GetIsOpen( oDoor ) ) ) {
AssignCommand( oDoor, ActionCloseDoor( oDoor ) );
this will close the dorr swithin 10 metres.Just edit the 10.00 number to any other number

EDIT: urgh...I'm not really sure about the second script so if you want to make sure you won't have any bugs use zbyl2's script:)

05-12-2009, 08:32 AM
I made a module where all doors closed a short time after opened.
I took the stunt12_close.ncs script from the STUNT_12 Module, and put the script into all my doors' OnOpen srcipt.

05-12-2009, 08:34 AM
So for give me, I am new at modding, where would the doors on open script go? In what file?

05-12-2009, 11:31 AM
To have all the doors close when you enter the module (so if you leave the module and come back the same applies) you need to place this script in the modules ARE file in the struct "OnEnter".

void main() {
object oDoor = GetFirstObjectInArea(GetArea(), OBJECT_TYPE_DOOR);
while(oDoor != OBJECT_INVALID) {
AssignCommand(oDoor, ActionCloseDoor(oDoor));

oDoor = GetNextObjectInArea(GetArea(), OBJECT_TYPE_DOOR);

Hope that helps ;) If you need any help just ask. Or if that doesn't compile... I can't see any syntax errors from here :p

05-13-2009, 03:03 PM
Open a door file (name of your door) + .utd ending, and select the sripts tab. There you'll find a OnOpen script line, which is normally empty. Then compile your script (/or extract the stunt12_close.ncs from Kotor Tool/Kotor/Rims/Modules/STUNT_12.s_rim/Scripts, compiled) save the script you choosed at the same direction as your door is saved, and then test it.