home *** CD-ROM | disk | FTP | other *** search
- # Droids Cog Script
- #
- # b0_SafetyDoor.cog
- #
- # Two Switch door script for Biped obstacle course
- # Incs a number when the switches are thrown. If they're both thrown, the door opens.
- # 10/23/97 [DGS] Created
- # 12/16/97 [dgs] Modified for new security door /w external cam
- # 04/24/98 DGS Added new cammy verbs and cleaned up the cammy stuff a little
- # mask = 0x405
- # ========================================================================================
-
- symbols
- message startup
- message activate
- message arrived
- message timer
- message blocked
-
- thing door0 linkid=1
- thing door1 linkid=1
- thing door2 linkid=1
- thing camera1
- surface richfix
- surface richfix1
- surface richfix2
- surface richfix3
- surface richfix4
-
- surface button2 linkid=2
- surface button3 linkid=3
-
- sound act_snd=SWT00LtSwch1.WAV local
- sound bolt_snd=DORt7BoltSlide.WAV local
- ##sound bolt_snd=FLY00Crate1.WAV local
- sound door_snd=DORt7SecDoor.WAV local
- float speed=2.0
-
- sector doorSector local
- int on_button=0 local
- end
-
- # ========================================================================================
-
- code
-
- startup:
- clearadjoinflags(richfix,2);
- clearadjoinflags(richfix1,2);
- clearadjoinflags(richfix2,2);
- clearadjoinflags(richfix3,2);
- clearadjoinflags(richfix4,2);
- return;
-
- # ........................................................................................
-
- activate:
- if (GetSenderId() == 1) // The Door
- {
- if (on_button < 2)
- {
- dwPlayCammySpeech(17112, "t7ca013.wav", 10, 0); // Thus us the securiey door
- }
- }
-
- if (GetSenderId() == 2) // Button2 Upper
- {
- if (GetWallCel(button2) != 1)
- {
- SetWallCel(button2, 1);
- garbage = PlaySoundPos(act_snd, SurfaceCenter(button2), 0.6, -1, -1, 0);
- messageid = 17103;
- call switchcam;
- MoveToFrame(door2, 1, speed/2);
- sounder = playsoundthing(bolt_snd,door2,1.0,-1,-1,11);
- on_button = on_button + 1;
- }
- }
-
- if (GetSenderId() == 3) // Button3 Lower
- {
- if (GetWallCel(button3) != 1)
- {
- SetWallCel(button3, 1);
- garbage = PlaySoundPos(act_snd, SurfaceCenter(button3), 0.6, -1, -1, 0);
- messageid = 17102;
- call switchcam;
- MoveToFrame(door1, 1, speed/2);
- sounder = playsoundthing(bolt_snd,door1,1.0,-1,-1,11);
-
- on_button = on_button + 1;
- }
- }
-
- return;
-
- # ........................................................................................
-
- arrived:
- if (sounder >0) stopsound(sounder,0.5);
- if (on_button == 2) // Open Door
- {
- on_button = 3;
- //call switchcam;
- MoveToFrame(door0, 1, speed);
- sounder = playsoundthing(door_snd,door0,1.0,-1,-1,11);
-
- //SetInv(player, 1, 1); //Set mission objective to true
- }
- else if (on_button != 3)
- { // reset camera
- if (messageid == 17102)
- {
- print("t7ca004");
- dwPlayCammySpeech(17102, "t7ca004.wav", 10, 1);
- }
- else if (messageid == 17103)
- {
- print("t7ca003");
- dwPlayCammySpeech(17103, "t7ca005.wav", 10, 1);
- }
- sleep(1);
- print("UnFreeze!");
- dwunfreezeplayer();
- SetCurrentCamera(7);
- }
- else if (on_button == 3)
- {
- setadjoinflags(richfix,2);
- setadjoinflags(richfix1,2);
- setadjoinflags(richfix2,2);
- setadjoinflags(richfix3,2);
- setadjoinflags(richfix4,2);
- sleep(1);
- print("t7ca006");
- dwPlayCammySpeech(17104, "t7ca006.wav", 10, 1);
- print("UnFreeze!");
- dwunfreezeplayer();
- SetCurrentCamera(7);
- }
- return;
-
- switchcam:
- print("Freeze!");
- dwfreezeplayer();
- sleep(1);
- SetCameraFocus(0, camera1);
- SetCurrentCamera(0);
- sleep(1);
- return;
-
-
- end
-
-