Jump to content

Home

Reset opened doors?


Recommended Posts

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?

 

Thanks!

Link to comment
Share on other sites

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

Malxados

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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:)

Link to comment
Share on other sites

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) {
       if(GetIsOpen(oDoor))
           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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...