Jump to content

automatic sliding doors script


harleythemadgod

Recommended Posts

I need a pretty basic script but as yet I haven't been able to fully understand the timer function well enough to employ it. It's on a cheat-y version of an automatic sliding door, only without the sliding, because i'm n00b. It disables on activation and enables a previously disabled version of itself that is positioned as "open". I just need to it automatically "close" again after a while. Basically:

 

; -----------------------------------------------------------------

 

Begin Auto_Door_Scribt

 

If ( MenuMode == 1 )

Return

Endif

 

If ( OnActivate == 1 )

"Door_Closed"->Disable

"Door_Open"->Enable

Endif

 

If ( 10 seconds pass after activation) ; (this is the bit i dont know how to do lol)

"Door_Closed"->Enable

"Door_Open"->Disable

Endif

 

End Auto_Door_Scribt

 

; -----------------------------------------------------------------

 

Alternatively, if there was a way to activate it and have it move in realtime along a single axis, then return to it's original position 10 seconds later to await activation again, that would be better. The important part there is awaiting manual activation; otherwise I could just use a modified float script from vanilla with a move command instead of a rotate.

 

So it'd look something like this, i think:

 

; -----------------------------------------------------------------

 

Begin Auto_Door_Scribt

 

If ( MenuMode == 1 )

Return

Endif

 

If ( OnActivate == 1 )

"Door_Sliding"->Move, Y, 10

Endif

 

If ( 10 seconds pass after activation) ; (this is the bit i dont know how to do lol)

"Door_Sliding"->Move, Y, -10

Endif

 

End Auto_Door_Scribt

 

; -----------------------------------------------------------------

 

And if that's still not complicated enough, then

THIS

 

IS TO GO

 

EVEN FURTHER

 

BEYOND

 

...

 

 

A variation of it that isn't activated manually, but a legitimate automatic opener script that's triggered by distance. I've got a headache just thinking about it lol.

But yeah if one of you legends could at least put a proper timer function on that first one that would be awesome!

 

>picture unrelated

Link to comment
Share on other sites

Here's my attempt. I honestly don't really understand what I'm doing here, and it probably shows. I'll test it later. Feel free to make any corrections.

 

; -----------------------------------------------------------------

 

Begin Auto_Door_Scribt
Float Timer
Short myUNQvariable
If ( MenuMode == 1 )
Return
Endif
If ( GetDistance < 128 )
Set Timer to 0
Set myUNQvariable to 1
Endif
If (myUNQvariable == 1 )
"Door_Sliding"->Move, Y, 10
Endif
If ( timer == 10 )
"Door_Sliding"->Move, Y, -10
Set Timer to 0
Set myUNQvariable to 0
Endif
End Auto_Door_Scribt
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...