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

  1. # Droids Cog Script
  2. #
  3. # 03_CtrlRm.cog
  4. #
  5. # Desc:                                                                 
  6. #    This is the "Wheel & Axle" puzzle for the Moisture Farm level.  It's big, it's ugly.  really ugly...
  7. #
  8. #
  9. #          [MT]     Created
  10. # 1/16/98  [JP]     Modified for Moisture Farm Control Room. 
  11. #
  12. # (C) 1997 LucasLearningLimited. All Rights Reserved
  13.  
  14.  
  15.  
  16. symbols                     
  17. message             startup
  18. message             pulse
  19. message             activate 
  20. message             touched
  21. message             timer
  22. message             arrived
  23. message             used
  24. message             taken
  25. message             user0
  26. message             user7
  27.  
  28.                                     
  29. ##templates
  30. template            wftemplate
  31. template            grtemplate
  32. template            iwltemplate 
  33.  
  34. ##lever (wrench_long) when you first place it on
  35.  
  36. template            iwstemplate  
  37.  
  38. ##lever fake (wrench_short) when you first place it on
  39. surface             
  40. surface             reset_switch        linkid=7
  41. surface             test_surface
  42.  
  43. //cog                 ctrldrain
  44. //cog                 ctrlswitch
  45. cog                 movedown
  46. cog                 switch
  47.  
  48. vector             vec0        desc=thrust_direction
  49.            
  50. ## thing               wrench_long         linkid=2
  51. ## thing               wrench_short        linkid=1
  52. thing               gearZ
  53. thing               gear                linkid=4
  54. thing               gearW
  55. thing               platform            linkid=3
  56. thing               light1
  57. thing               light2
  58. thing               light3
  59.  
  60. ##ghosts
  61. thing               wfghost
  62. thing               grghost
  63. thing               iwlghost 
  64.  
  65. ##inventory wrench long when you first place it on
  66.  
  67. thing               iwsghost linkid=5 
  68.  
  69. #inventory wrench_short when you first place it on
  70.  
  71. thing               
  72.  
  73. #ghosts creation integers
  74. int                 wrench_long_spindle_i  linkid=5  local
  75. int                 wrench-short_spindle_i linkid=5  local
  76.  
  77. #sectors
  78. sector              control_room0
  79. sector              control_room1
  80. sector              control_room2
  81. sector              control_room3
  82. sector              drain_room0
  83. sector              drain_room0a
  84. sector              drain_room0b
  85. sector              drain_room0c
  86. sector              drain_room0d   
  87. sector              drain_room1  //octogonal one   
  88. sector              platform_sector
  89.  
  90.  
  91. float             brightness=1.00
  92. int                 speed=9    desc=thrust_speed
  93. int                 bin=31         
  94.  
  95. #bin number for the wrench piece.  
  96.  
  97. int                 wrench_long_spindle=0    local
  98. int                 wrench_short_spindle=0   local
  99. int                 part_id=0                local
  100. int                 xrotate                  local  
  101.  
  102. #TEMP  
  103.  
  104. sound               reset_switch_broke
  105. sound               wrench_gear_attach
  106. sound               wrench_gear_move
  107. sound               water_gush
  108. sound               power_on
  109.                
  110. end
  111.  
  112. # =======================================
  113.  
  114.  
  115. ## Code Section
  116. code 
  117.  
  118. startup:
  119.      //print("yosh1");
  120.      clearvector=vectorset('0.0, 0.0, 0.0');
  121.      //vec0=vectorset(0.0, 0.0, -8.0);
  122.     
  123.      setpulse(0.2);
  124.      
  125.      //if (light0 != 0) setthinglight(light0, 0, 0.0);
  126.     //if (light1 != 0) setthinglight(light1, 0, 0.0);
  127.     //if (light2 != 0) setthinglight(light2, 0, 0.0);
  128.     //if (light3 != 0) setthinglight(light3, 0, 0.0);
  129.     //xrotate=0;
  130.      ////global0=0;
  131.      //AttachThingToThing(wrench_long, gear);
  132.      //AttachThingToThing(wrench_short, gear);
  133.      return;
  134.      
  135. # =========================================================
  136. //user0:
  137.      //user gets called when player hits reset switch, see ctrlswitch co
  138.      //sendmesasge
  139. //activate:
  140.      //print("activate");
  141.      //if (GetSenderId() == 7)      // pressing reset button underwater
  142.      //{
  143.           //if (global0==0)    // water is not drained yet
  144.           //{
  145.          //print ("reset_switch_broke!");
  146.           //PlaySoundLocal(reset_switch_broke, 1, 0, 0);
  147.           //dwsetmissiontext(17430);   //Cambot dialog
  148.           //}
  149.           
  150.           ///else if (global0==1)   // power comes on
  151.           //{
  152.           //print("power on");
  153.           //PlaySoundLocal(power_on, 1, 0, 0);
  154.           //SetWallCel(reset_switch, 1);  // reset button changes color
  155.           //setthinglight(light0, brightness, 1.5);  //  turns these lights on
  156.         //setthinglight(light1, brightness, 2.0);
  157.         //setthinglight(light2, brightness, 1.0);
  158.         //setthinglight(light3, brightness, 3.0);
  159.   //        }
  160.           
  161.           
  162.     // }         
  163.      //return;
  164.      
  165. # =============// attach the wrench from inventory to the middle gear
  166. used: 
  167.           // Section is executed when the user uses an inventory object.  
  168.           print("used");
  169.           printint (dwGetActivateBin());
  170.           printint (getsenderid());
  171.           if (xrotate == 0)
  172.                {
  173.                     if ( getinv(getlocalplayerthing(), dwGetActivatebin()) > 0)  // if the bin has more than 0 in it;
  174.                     {
  175.                     printint (getthingsector(getlocalplayerthing()));
  176.                     printint (drain_room0);
  177.                     // The gear was activated
  178.                          if (getthingsector(getlocalplayerthing()) == drain_room0)
  179.                               {
  180.                               //  Player is in drain room
  181.                               print ("activated wrench");
  182.                          //newiwl=creatething(iwltemplate, iwlghost);
  183.                          //newiws=creatething(iwstemplate, iwsghost);
  184.                          //AttachThingToThing(new_iwl, gear); 
  185.                          //AttachThingToThing(new_iws, gear);
  186.                          call handle_attach;
  187.                          }
  188.                     }     
  189.                }                             
  190.      return;
  191.  
  192. //used:
  193. //{
  194. //     if (wrenchisattached==1) // wrench is attached
  195. //     wrench=creatething(wrenchtemplate, wrenchghost);
  196. //     PlaySoundLocal(wrench_gear_attach, 1, 0, 0); // sound of wrench attaching
  197. //     AttachThingToThing(wrench_short, gear);  // wrench attached to gear
  198. //     }     
  199. //     return;
  200.  
  201. #==================// takes off the wrench from the inventory to the middle gear
  202. taken:
  203.      print("taken");
  204.      printint(gear);
  205.      if (xrotate ==0)
  206.           {
  207.           if (GetSenderId()==4)
  208.                {
  209.                //gear activated
  210.                if (getthingsector(getlocalplayerthing()) ==drain_room0)
  211.                     {
  212.                     //player takes stuff off the gear
  213.                     if (wrench_long_spindle != 0);
  214.                          {
  215.                          //inc. bin to add back to inv, destroy one in envir. 
  216.                          ChangeInv(getlocalplayerthing(), wrench_long_spindle, 1);
  217.                          destroything(wrench_long_spindle_i);
  218.                          destroything(wrench_short_spindle_i);
  219.                          wrench_long_spindle =0;
  220.                          wrench_short_spindle =0;
  221.                          call update_bins;
  222.                          }
  223.                     }
  224.                }
  225.           }
  226.      return;
  227.      
  228. #===========================
  229. handle_attach:
  230.      // handle attach is used to put the wrench on the lower left side of the assembly.
  231.      print("handleattach");
  232.      if (wrench_long_spindle==0)  //if wrench spindle is empty
  233.           {
  234.           
  235.           if (dwGetActivateBin() = bin)  // if it's the "bin", for the wrench, it's bin 31
  236.                {
  237.                // The bin number from the gear is used to represent what gear is on the spindle.    
  238.                // If lower_left_spindle is set to 0, then there should be no gear on the spindle.  If a non-zero #, 
  239.                // it represents the present gear's bin number.
  240.                wrench_long_spindle = dwGetActivateBin();
  241.                print ("wrench_on!");
  242.                //creating the wrench to get attached...
  243.                wrench_long_spindle_i = creatething (iwltemplate, i