home *** CD-ROM | disk | FTP | other *** search
- # Jedi Knight Cog Script
- #
- # 00_Door.cog
- #
- # Generic Door Script
- #
- # [IS]
- #
- # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
- # ========================================================================================
-
- symbols
- message blocked
- message arrived
- message startup
- message timer
- message entered
- message activate
- message pulse
-
- surface switch linkid=3
-
- sector triggersector linkid=1 mask=0xffff
- sector closesector linkid=2
-
- thing door0 linkid=0 mask=0x405
-
- float moveSpeed=8.0
- float sleepTime=2.0
- float lightValue=0.5
-
- sector doorSector local
- int numDoors=0 local
- int doorStatus local
- int moveStatus local
- int i local
- end
-
- # ========================================================================================
-
- code
-
- startup:
- setwallcel(switch, 1);
- doorSector = GetThingSector(door0);
- return;
-
- # ........................................................................................
-
- entered:
- if ( (getsenderid()==1)&&(getcurframe(door0)==0) ) {
- print("open sesame!");
- call OpenDoors;
- }
- else if ( (getsenderid()==2)&&(getcurframe(door0)==1) ) {
- sleep(1);
- call closedoors;
- }
- return;
-
- # ........................................................................................
-
- blocked:
- call OpenDoors;
- return;
-
- # ........................................................................................
-
- OpenDoors:
- setwallcel(switch, 2);
- MoveToFrame(door0, 1, moveSpeed);
- return;
-
- # ........................................................................................
-
- CloseDoors:
- setwallcel(switch,1);
- MoveToFrame(door0, 0, moveSpeed);
- return;
- # ........................................................................................
- activate:
- if (getsenderid()==3) {
- print("activate");
- if (getcurframe(door0)!=1) {
- call opendoors;
- settimer(5);
- }
- }
- return;
-
- timer:
- call closedoors;
- return;
-
-
-
- end
-
-