Author Topic: Doors opening and closing at intervals  (Read 350 times)

Legacy_dr. b

  • Newbie
  • *
  • Posts: 26
  • Karma: +0/-0
Doors opening and closing at intervals
« on: October 28, 2013, 08:37:35 pm »


               Hello again everyone.

I'm trying to script the following, but uncertain of where I would start:

-I have a large, maze-like area with many doors in it. Half of them are tagged "mazedoor1" and half of them are tagged "mazedoor2".

-All of the doors tagged mazedoor1 are set to open as their initial position; those tagged mazedoor2 are set to closed and locked.

Goal: I'd like to make it so that the two sets of doors alternate between open/unlocked and closed/locked by themselves, automatically, every three seconds.

I am not quite sure how to accomplish this. Would it be some sort of onhearbeat script? Would it involve a while loop? Would it involve a custom function? Would it be one big script governing all the doors, or would each door have a script attached to it? Not sure what to do. Maybe you guys have a few suggestions.

Once I've got the solution under my belt, I may want to make it so that there are additional sets of doors opening on a certain basis. We'll see.

Thanks!
               
               

               


                     Modifié par dr. b, 28 octobre 2013 - 11:43 .
                     
                  


            

Legacy_dr. b

  • Newbie
  • *
  • Posts: 26
  • Karma: +0/-0
Doors opening and closing at intervals
« Reply #1 on: October 29, 2013, 12:08:01 am »


               I think I've figured out how to do this. I've devised the following script to tell the door to open on heartbeat if closed and vice versa. The only problem is that it won't compile....

void main()
{
object oDoor = OBJECT_SELF;
if (GetIsOpen(oDoor,TRUE));
    {
    SetLocked(OBJECT_SELF,TRUE);
    ActionCloseDoor(OBJECT_SELF);
    }
else if (GetIsOpen(oDoor,FALSE));
    {
    SetLocked(OBJECT_SELF,FALSE);
    ActionOpenDoor(OBJECT_SELF);
    }
}
               
               

               


                     Modifié par dr. b, 29 octobre 2013 - 12:27 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Doors opening and closing at intervals
« Reply #2 on: October 29, 2013, 06:49:11 am »


               

 
void main()
{
object oDoor = OBJECT_SELF;
if (GetIsOpen(oDoor,TRUE));
    {
    SetLocked(OBJECT_SELF,TRUE);
    ActionCloseDoor(OBJECT_SELF);
    }
else if (GetIsOpen(oDoor,FALSE));
    {
    SetLocked(OBJECT_SELF,FALSE);
    ActionOpenDoor(OBJECT_SELF);
    }
}

 

void main()
{
 
object oDoor = OBJECT_SELF;
if (GetIsOpen(oDoor ))
    {
    SetLocked(OBJECT_SELF,TRUE);
    ActionCloseDoor(OBJECT_SELF);
    }
else  
    {
    SetLocked(OBJECT_SELF,FALSE);
    ActionOpenDoor(OBJECT_SELF);
    }
}
               
               

               
            

Legacy_dr. b

  • Newbie
  • *
  • Posts: 26
  • Karma: +0/-0
Doors opening and closing at intervals
« Reply #3 on: November 02, 2013, 05:47:16 pm »


               Oh, duh! Thanks! '<img'>