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

  1. # Droids Cog Script
  2. #
  3. # 03_watermove.cog
  4. #
  5. # Desc:                                                                 
  6. #    Companion cog to Tanks.  When receiving message from tanks cog, it clears them water sectors.
  7. #
  8. #
  9. # 2/18/98  [JP]     Created
  10. #  
  11. # (C) 1998 LucasLearningLimited. All Rights Reserved
  12.  
  13.  
  14.  
  15. symbols                     
  16. message             startup
  17. message             pulse
  18. message             activate
  19. message             touched
  20. message             arrived
  21.  
  22. thing               water_sector0
  23. thing               water_sector1
  24. thing               water_sector2
  25. thing               platform_water_sector
  26.  
  27. sector              
  28. sector             
  29. sector              
  30. sector              
  31. sector              
  32. sector              
  33. sector              
  34. sector              
  35. sector              
  36. sector              
  37. sector               
  38. sector              
  39. sector              
  40.  
  41.  
  42. sound               water_gush
  43.                
  44. end
  45.  
  46. # =======================================
  47.  
  48.  
  49. ## Code Section
  50. code 
  51.  
  52. startup:
  53.      clearvector=vectorset(0.0, 0.0, 0.0);
  54.      //vec0=vectorset(0.0, 0.0, -8.0);
  55.     if (light0 != 0) setthinglight(light0, 0, 0.0);
  56.     if (light1 != 0) setthinglight(light1, 0, 0.0);
  57.     if (light2 != 0) setthinglight(light2, 0, 0.0);
  58.     if (light3 != 0) setthinglight(light3, 0, 0.0);
  59.     
  60.      waterisdrained=0;
  61.      print("c-r startup");
  62. //     AttachThingToThing(wrench_long, wrench);  //wrench attached to fake_gear for noninventory version
  63. //     AttachThingToThing(gear, wrench_short);
  64.      AttachThingToThing(wrench_long, gear);
  65.      AttachThingToThing(wrench_short, gear);
  66.      return;
  67.      
  68. # =========================================================
  69.  
  70. activate:
  71.      if (GetSenderId() == 7)      // pressing reset button underwater
  72.      print("c-r activate");
  73.      {
  74.           if (waterisdrained==0)    // water is not drained yet
  75.           {
  76.           print ("reset_switch_broke!");
  77.           PlaySoundLocal(reset_switch_broke, 1, 0, 0);
  78.           dwsetmissiontext(17430);   //Cambot dialog
  79.           }
  80.           
  81.           else if (waterisdrained==1)   // power comes on
  82.           {
  83.           print("power on");
  84.           PlaySoundLocal(power_on, 1, 0, 0);
  85.           SetWallCel(reset_switch, 1);  // reset button changes color
  86.           setthinglight(light0, brightness, 1.5);  //  turns these lights on
  87.         setthinglight(light1, brightness, 2.0);
  88.         setthinglight(light2, brightness, 1.0);
  89.         setthinglight(light3, brightness, 3.0);
  90.          }
  91.           
  92.           
  93.      }         
  94.      return;
  95.      
  96. # =============// attach the wrench from inventory to the middle gear
  97. //used: 
  98.           // Section is executed when the user uses an inventory object.  
  99. //          print("used:");
  100. //          printint (dwGetActivateBin());
  101. //          printint (getsenderid());
  102. //          if (rotate == 0)
  103. //               {
  104. //               if ( getinv(getlocalplayerthing(), dwGetActivatebin()) > 0)  // if the bin has more than 0 in it;
  105. //                    {
  106. //                    printint (getthingsector(getlocalplayerthing()));
  107. //                    printint (drain_room0);
  108. //                    // The gear assembly was activated
  109. //                    if (getthingsector(getlocalplayerthing()) == drain_room0)
  110. //                         {
  111. //                         //  Player is on the lower left side of the gear assembly
  112. //                         print ("activated gear");
  113. //                         call handle_attach;
  114. //                         }
  115. //                    }     
  116. //               }                             
  117. //     return;
  118.  
  119. //used:
  120. //{
  121.      //if (wrenchisattached==1) // wrench is attached
  122.      //wrench=creatething(wrenchtemplate, wrenchghost);
  123.      //PlaySoundLocal(wrench_gear_attach, 1, 0, 0); // sound of wrench attaching
  124.      //AttachThingToThing(wrench_short, gear);  // wrench attached to gear
  125. //}     
  126.      //return;
  127.  
  128. #==================// takes off the wrench from the inventory to the middle gear
  129. //taken:
  130. //     print ("taken");
  131. //     printint (getsenderid());
  132.      
  133.      // Taken gets called when the user attempts to take the wrench from the gear
  134. //     if (rotate == 0)
  135. //          {
  136. //          if (GetSenderId() == 2)  // if it's the motor gear- p_med_gear_vert that got activated
  137. //               {
  138.                // the gear assembly was activated
  139. //               if (getthingsector(getlocalplayerthing()) == drain_room0)
  140. //                    {
  141. //                    if (lower_left_spindle != 0)  // UH, THIS ISN'T IT...
  142. //                         {
  143.                          // increase the bin to add it back to the inv, destroy one in the environment, and set 
  144.                          // lower_left_spindle to 0
  145. //                         ChangeInv(getlocalplayerthing(), lower_left_spindle, 1);
  146. //                         destroything(lower_left_spindle_i);
  147. //                         lower_left_spindle = 0;
  148. //                        call update_bins;
  149. //                        }
  150. //                    call update_bins;
  151. //               }
  152. //          return;
  153.           
  154. #===========================
  155. //handle_attach:
  156.      // handle attach is used to put the wrench on the lower left side of the assembly.
  157. //     print("handle_attach");
  158. //     if (lower_left_spindle == 0)  // if the lower left spindle is empty
  159. //          {
  160.           // adds whatever you gots to the spindle
  161. //          if (dwGetActivateBin() = bin)  // if it's the "bin", for the wrench, it's bin 31
  162. //               {
  163.                // 3 things happen:  1st variable lower_left_spindle is set to the gear that's going to go on the spindle
  164.                // The bin number from the gear is used to represent what gear is on the spindle.    
  165.                // If lower_left_spindle is set to 0, then there should be no gear on the spindle.  If a non-zero #, 
  166.                // it represents the present gear's bin number.
  167. //               lower_left_spindle = dwGetActivateBin();
  168. //               print ("l_l_gear_on");
  169. //               ChangeInv(getlocalplayerthing(), lower_left_spindle, -1);    //FIX THIS PART  !!!!  
  170. //               call update_bins;
  171. //               }
  172. //          }
  173. //     return;
  174.  
  175. # =============// rotate the wrench attached to the gear and platform
  176. touched:       
  177.      if (playonce==0){
  178.           if (GetSenderId() == 1)      // pressing wrench_short
  179.           {
  180.           print("c-r tou~chey!");
  181.           setpulse(0.1);
  182.           playonce=1;
  183.           }
  184.          }
  185.      
  186.      return;
  187.      
  188.  
  189. pulse:
  190.  
  191.      player=getlocalplayerthing();
  192.      playerpos=getthingpos(player);
  193.      wrench_shortpos=getthingpos(wrench_short);
  194.  
  195.      printflex(vectorY(getthingpos(wrench_long)));
  196.      if((vectorY(getthingpos(wrench_long)))>-0.9591) call stoptheplatform;
  197.  
  198.      if(vectordist(playerpos,wrench_shortpos)<.13) {
  199.           PlaySoundLocal(wrench_gear_move, 1, 0, 0);  // wrench fake gear moving sound
  200.  
  201.           if (getcurframe(wrench_short)==0) currentframe=1;       //if wrench at frame 0 -> frame 1
  202.           if (getcurframe(wrench_short)==1) currentframe=2;       //                   1 -> frame 2  
  203.           //if (getcurframe(gear)==0) currentframe=1;         //if gear at frame   0 -> frame 1
  204.           //if (getcurframe(gear)==1) currentframe=2;         //                   1 -> frame 2
  205. //          MoveToframe(wrench_short, currentframe, .4);            // wrench_short moves to current frame
  206.           //MovetoFrame(wrench_long, currentframe, .314);      //wrench_long moves to current frame
  207.           RotatePivot(gear, 1, 9);              //gear rotates to current frame
  208.           //MoveToFrame(gear, currentframe, .4);            // gear rotates to current frame
  209.      }
  210.      else {
  211.           stopthing(wrench_short);
  212.           stopthing(gear);
  213.           stopthing(wrench_long);
  214.           //stopthing(platform);
  215.      }
  216.      return; 
  217.  
  218. # =============// wrench has been rotated until final frame
  219. stoptheplatform:
  220.                print("c-r stop!!!");
  221.                setpulse(0);
  222.                Sleep(.5);
  223.                MoveToFrame(platform, 1, .79);      // platform moves down
  224. //               MoveToFrame(wrench_short, 3, .5);        // wrench moves down
  225. //               MoveToFrame(wrench_long, 3, .5);   // wrench_fake moves down
  226. //               MoveToFrame(gear, 2, .5);          // gear moves down
  227.                destroything(wrench_short);
  228.                destroything(wrench_long);
  229.                destroything(gear);
  230.                newwf=creatething(wftemplate, wfghost);
  231.                movetoframe(newwf, 1, .8);
  232.                newgr=creatething(grtemplate, grghost);
  233.                movetoframe(newgr, 1, .8);
  234.                return;
  235.  
  236.  
  237.  
  238.  
  239. arrived:
  240.      if (getsenderid() == 3);   //message that platform has arrived 
  241.      {
  242.           if (getcurframe(platform)==1){     
  243.           
  244.                waterisdrained=1;   // control room is drained
  245.                print("c-r arrived");
  246.                clearsectorflags(control_room0, 2);  //control & drain rooms no longer submerged
  247.                clearsectorflags(control_room1, 2);
  248.                clearsectorflags(control_room2, 2);
  249.                clearsectorflags(control_room3, 2);
  250.                clearsectorflags(control_room4, 2);
  251.                clearsectorflags(control_room5, 2);
  252.                clearsectorflags(control_room6, 2);
  253.                clearsectorflags(control_room7, 2);
  254.                clearsectorflags(control_room8, 2);
  255.                clearsectorflags(control_room9, 2);
  256.                clearsectorflags(drain_room0, 2);
  257.                clearsectorflags(drain_room1, 2);  //control & drain rooms rgb values returned to normal
  258.                setsectortint(control_room0, clearvector);
  259.                setsectortint(control_room1, clearvector); 
  260.                setsectortint(control_room2, clearvector);
  261.                setsectortint(control_room3, clearvector);
  262.                setsectortint(control_room4, clearvector);
  263.                setsectortint(control_room5, clearvector); 
  264.                setsectortint(control_room6, clearvector);
  265.                setsectortint(control_room7, clearvector);
  266.                setsectortint(control_room8, clearvector);
  267.                setsectortint(control_room9, clearvector);
  268.                setsectortint(drain_room0, clearvector);
  269.                setsectortint(drain_room1, clearvector);                                        
  270.                MoveToFrame(debris0, 1, 5);
  271.                MoveToFrame(debris1, 1, 5);
  272.                MoveToFrame(debris2, 1, 5);
  273.                MoveToFrame(debris3, 1, 5);
  274.                MoveToFrame(debris4, 1, 5);
  275.                MoveToFrame(debris5, 1, 5);
  276.           }
  277.      }                
  278.           return;
  279. # ==============//turn sector thrust off     
  280.      
  281. //timer:
  282.  
  283.           
  284.           //MoveToFrame(gear, 1, .15);  // gear rotates to frame 1
  285.           //MoveToFrame(platform, 1, .1); // platform rotates to frame 1
  286.           //MovetoFrame(wrench_fake, 1, .32);
  287.           //Movetoframe(wrench, 1, .5);
  288.      
  289.      
  290.      
  291.     // return;         
  292.  
  293. end