home *** CD-ROM | disk | FTP | other *** search
/ Classic Fond 52 / ClassicFond52.iso / GAMES / DROIDW.RAR / DWCD.GOB / mission_cog_b0_safetydoor.cog < prev    next >
Encoding:
Text File  |  1998-11-04  |  3.7 KB  |  155 lines

  1. # Droids Cog Script
  2. #
  3. # b0_SafetyDoor.cog
  4. #
  5. # Two Switch door script for Biped obstacle course
  6. # Incs a number when the switches are thrown. If they're both thrown, the door opens. 
  7. # 10/23/97 [DGS]    Created 
  8. # 12/16/97 [dgs]     Modified for new security door /w external cam        
  9. # 04/24/98 DGS      Added new  cammy verbs and cleaned up the cammy stuff a little
  10. #    mask = 0x405
  11. # ========================================================================================
  12.  
  13. symbols
  14.     message    startup        
  15.     message    activate    
  16.     message    arrived        
  17.     message    timer        
  18.     message    blocked        
  19.  
  20.     thing        door0        linkid=1 
  21.     thing        door1        linkid=1 
  22.     thing        door2        linkid=1 
  23.     thing        camera1    
  24.     surface        richfix        
  25.     surface        richfix1        
  26.     surface        richfix2    
  27.     surface        richfix3        
  28.     surface        richfix4        
  29.  
  30.     surface    button2    linkid=2
  31.     surface    button3    linkid=3
  32.     
  33.     sound    act_snd=SWT00LtSwch1.WAV        local
  34.     sound    bolt_snd=DORt7BoltSlide.WAV        local
  35.     ##sound    bolt_snd=FLY00Crate1.WAV        local
  36.     sound    door_snd=DORt7SecDoor.WAV        local
  37.     float        speed=2.0
  38.     
  39.     sector    doorSector    local
  40.     int        on_button=0    local
  41. end
  42.  
  43. # ========================================================================================
  44.  
  45. code
  46.  
  47. startup:
  48.     clearadjoinflags(richfix,2);
  49.     clearadjoinflags(richfix1,2);
  50.     clearadjoinflags(richfix2,2);
  51.     clearadjoinflags(richfix3,2);
  52.     clearadjoinflags(richfix4,2);
  53.     return;
  54.  
  55. # ........................................................................................
  56.  
  57. activate:
  58.     if (GetSenderId() == 1)     // The Door
  59.         {
  60.         if (on_button < 2)
  61.             {
  62.             dwPlayCammySpeech(17112, "t7ca013.wav", 10, 0); // Thus us the securiey door
  63.             }
  64.         }
  65.         
  66.     if (GetSenderId() == 2)     // Button2   Upper
  67.         {
  68.         if (GetWallCel(button2) != 1) 
  69.             {
  70.             SetWallCel(button2, 1);
  71.             garbage = PlaySoundPos(act_snd, SurfaceCenter(button2), 0.6, -1, -1, 0);
  72.             messageid = 17103;
  73.             call switchcam;
  74.             MoveToFrame(door2, 1, speed/2);
  75.             sounder = playsoundthing(bolt_snd,door2,1.0,-1,-1,11);
  76.             on_button = on_button + 1;
  77.             }
  78.         }
  79.         
  80.     if (GetSenderId() == 3)     // Button3    Lower
  81.         {
  82.         if (GetWallCel(button3) != 1) 
  83.             {
  84.             SetWallCel(button3, 1);
  85.             garbage = PlaySoundPos(act_snd, SurfaceCenter(button3), 0.6, -1, -1, 0);
  86.             messageid = 17102;
  87.             call switchcam;
  88.             MoveToFrame(door1, 1, speed/2);
  89.             sounder = playsoundthing(bolt_snd,door1,1.0,-1,-1,11);
  90.  
  91.             on_button = on_button + 1;
  92.             }
  93.         }
  94.         
  95.     return;
  96.  
  97. # ........................................................................................
  98.  
  99. arrived:
  100.     if (sounder >0) stopsound(sounder,0.5);
  101.     if (on_button  == 2)        // Open Door
  102.         {
  103.         on_button = 3;
  104.         //call switchcam;
  105.         MoveToFrame(door0, 1, speed);
  106.         sounder = playsoundthing(door_snd,door0,1.0,-1,-1,11);
  107.         
  108.         //SetInv(player, 1, 1);    //Set mission objective to true  
  109.         }
  110.     else if (on_button != 3)
  111.         {           // reset camera 
  112.         if (messageid == 17102)
  113.             {
  114.             print("t7ca004");
  115.             dwPlayCammySpeech(17102, "t7ca004.wav", 10, 1);
  116.             }
  117.         else if (messageid == 17103)
  118.             {
  119.             print("t7ca003");
  120.             dwPlayCammySpeech(17103, "t7ca005.wav", 10, 1);
  121.             }
  122.         sleep(1);
  123.         print("UnFreeze!");
  124.         dwunfreezeplayer();
  125.         SetCurrentCamera(7);
  126.         }
  127.     else if (on_button == 3)
  128.         {
  129.         setadjoinflags(richfix,2);
  130.         setadjoinflags(richfix1,2);
  131.         setadjoinflags(richfix2,2);
  132.         setadjoinflags(richfix3,2);
  133.         setadjoinflags(richfix4,2);
  134.         sleep(1);
  135.         print("t7ca006");
  136.         dwPlayCammySpeech(17104, "t7ca006.wav", 10, 1);
  137.         print("UnFreeze!");
  138.         dwunfreezeplayer();
  139.         SetCurrentCamera(7);
  140.         }
  141.     return;
  142.  
  143. switchcam:
  144.     print("Freeze!");
  145.     dwfreezeplayer();
  146.     sleep(1);
  147.     SetCameraFocus(0, camera1);
  148.     SetCurrentCamera(0);
  149.     sleep(1);
  150.     return;
  151.  
  152.  
  153. end
  154.  
  155.