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

  1. # Droids COG Script
  2. #
  3. # 03_Counterweight.cog
  4. #
  5. # Desc:
  6. #    This behemoth is the counterweight puzzle. Do not taunt it.  
  7. #
  8. # 10/14/97 [DGS]    Created
  9. # 12/01/97 [DGS]    Updated to take droid's actual weight.
  10. #  2/11/98 [JP]     Modified for the Moisture Farm C/W
  11. # ========================================================================================
  12.  
  13. symbols
  14.  
  15. message   crossed
  16. message   activate
  17. message   arrived
  18. message   timer
  19. message   pulse
  20. message   startup
  21. message   entered
  22. message   user5   #message from rdroid that he's on the startsector
  23.  
  24. surface   add_sand       linkid=8
  25. surface   rem_sand       linkid=9
  26.  
  27. surface   led_ones       nolink
  28. surface   led_tens       nolink
  29. surface   led_hund       nolink
  30. surface   release_brake  linkid=10
  31.  
  32. cog         sander
  33. cog       Rdroid
  34.  
  35. thing     wdud2
  36. thing     elevator       linkid=1
  37. thing     wdud
  38. thing     Repairdroid    linkid=2
  39. thing     counterweight  linkid=3
  40. thing     brake          linkid=6
  41.  
  42. thing     line0start 
  43. thing     line0end                        
  44. thing     line1start 
  45. thing     line1end
  46. thing     line2start 
  47. thing     line2end
  48. thing     line3start 
  49. thing     line3end
  50.           
  51. sector    reset_puzzle    linkid=11
  52. flex      start_wait=0.25 local
  53. flex      sleeptime=2.0    local
  54. flex      c_weight=10.0    local
  55. flex      c_dest=10.0    local
  56. flex      sand_inc=5.0    local
  57. flex         gravity=12.0 local
  58. flex      speed=4.0    local
  59. int         c_crate=0    local
  60. int         step=10    local
  61. int         l_color=111    local    
  62. flex     L_size=0.01    local    
  63. flex      droidweight=10.0 local
  64.  
  65. sound    wav0=Activate02.wav   local
  66. sound     switch
  67. sound     switchmax
  68. sound     release
  69. sound     elevmove
  70. sound     elevstart
  71. sound     elevstop
  72.  
  73. surface   a1
  74. surface   a2
  75. surface   a3
  76. surface   a4
  77. surface   a5
  78. surface   a6
  79. surface   a7
  80. surface   a8
  81. surface   a9
  82. surface   a10
  83. surface   a11
  84. surface   a12
  85. surface   a13
  86.  
  87. cog       rdroid2
  88.  
  89. sound     est=elvt7bigelevst.wav local
  90. sound     esp=elvt7bigelevstp.wav local
  91.  
  92.  
  93. end
  94.  
  95. # ========================================================================================
  96.  
  97. code
  98.  
  99. startup:
  100.        addbeam(line0start,line0end,l_color,l_size);
  101.        addbeam(line1start,line1end,l_color,l_size);
  102.        addbeam(line2start,line2end,l_color,l_size);
  103.        addbeam(line3start,line3end,l_color,l_size);
  104.  
  105.      Rdroid_on=0;
  106.      
  107.     attachthingtothing(line0start,elevator);
  108.     attachthingtothing(line1start,elevator);
  109.     attachthingtothing(brake,elevator);
  110.  
  111.      attachthingtothing(line2start,counterweight);
  112.      attachthingtothing(line3start,counterweight);
  113.  
  114.      
  115.     droidweight = GetThingMass(GetLocalPlayerThing()) / 2.2;  // Get the player's weight
  116.         //c_weight = (droidweight) + ((rand()*20)-10); // Set th e counterweight to something near the players weight
  117.     //c_weight = (droidweight);  // Set the counterweight to something near the players weight
  118.         
  119.         // ++++++++++++++++++++++++++++++ These lines set the counterweight to a specific number
  120.     if (Rdroid_on == 0) //++++++++++++++++++ Rdroid is not on...
  121.         {
  122.                 c_weight = (290);
  123.                 c_crate = 0;
  124.                 //destroything(cube);
  125.         }
  126.         //else if (getdifficulty() == 1) //++++++++++++++++++ EASY
  127.         //{
  128.           //      c_weight = (230);
  129.           //      c_crate = 175;
  130.         //destroything(cube);
  131.         //}
  132.         else if (Rdroid_on == 1) //++++++++++++++++++ EASY
  133.         {
  134.                 c_weight = (290);
  135.                 c_crate = 175;
  136.                 //attachthingtothing(cube,elevator);
  137.         }
  138.         
  139.     c_weight = c_weight - (c_weight % 10);     // Rounds the weight to a 10
  140.     call displayweight;     
  141.     return;
  142. crossed:                // If player crosses adjoin(s)
  143.   
  144.   return;
  145.  
  146. user5:
  147.      print("user5");
  148.      //if (getthingsector(Repairdroid)==startsector);
  149.      Rdroid_on=1;
  150.      c_crate = 175;
  151.      return;
  152.        
  153. # ........................................................................................
  154.  
  155. activate:
  156. print("Cweight: Activated");
  157. printint(getsenderid());
  158. printint(getsenderref());
  159. printint(add_sand);
  160. if (GetSenderId() == 10)          // message came from release_brake
  161.     
  162.     {
  163.     //--------------------------------------------- RELEASE THE BRAKE
  164.        
  165.     if (GetWallCel(release_brake) == 1) return; //exit if the button is down already
  166.        SetWallCel(release_brake, 1);
  167.      call adjoinon; //makes it impossible to get off elevator
  168.        //dwdisablejump();
  169.      PlaySoundPos(release, SurfaceCenter(release_brake), 1.0, -1, -1, 0);  //changed wav0 to release A
  170.     //move=(elevmove, elevator, 1, -1, -1, 0x1);     
  171.     if ((droidweight + c_crate) < (c_weight)) //Up   take c_crate out?
  172.         {
  173.         dwplaycammyspeech(16009, "M3CA010.wav", 5, 2);   //c uh oh, we're moving up...
  174.                 speed = gravity - (gravity / (c_weight / (droidweight + c_crate))); 
  175.          SkipToFrame(elevator, 1, speed);      
  176.          SkipToFrame(counterweight, 1, speed);  //down
  177.           sendmessage(Rdroid, user5);   //added        
  178.          xmove=playsoundthing(elevmove, elevator, 1, -1, -1, 129); //LLL    
  179.           playsoundlocal(est, 1, 0, 0);
  180.           dwdisablejump();  //LLL
  181.         }
  182.     
  183.     if (droidweight + c_crate > c_weight) //Down
  184.         {
  185.         speed = gravity  - (gravity / ((droidweight + c_crate) / c_weight)); 
  186.            if (c_weight < 26) 
  187.             {
  188.             speed=gravity;
  189.             //dwsetmissiontext(16010);
  190.             }
  191.             else
  192.             {
  193.             //dwsetmissiontext(17106);
  194.             }
  195.         SkipToFrame(elevator, 2, speed);         
  196.          SkipToFrame(counterweight, 2, speed);  //up
  197.         sendmessage(Rdroid, user5);   //added          
  198.          xmove=playsoundthing(elevmove, elevator, 1, -1, -1, 129); //LLL
  199.           playsoundlocal(est, 1, 0, 0);
  200.           dwdisablejump();
  201.           dwplaycammyspeech(16099, "M3CA011.wav", 5, 2);
  202.         }
  203.  
  204.     if (droidweight + c_crate == c_weight) //Same
  205.         {
  206.         SetWallcel(release_brake, 0);
  207.           Playsoundlocal(switchmax, 1, 0, 0);
  208.           //dwsetmissiontext(17101);
  209.         }
  210.     printflex(speed);
  211.     }   
  212.  
  213.     //-----------------------------------------------END RELEASE 
  214.  
  215.     if (GetSenderId() == 8)      // message came from add_sand
  216.         {
  217.           if ( (getwallcel(rem_sand)==1)||(getwallcel(add_sand)==1) ) return;
  218.           call sand_add;
  219.         }
  220.      if (GetSenderId() == 9)      // message came from rem_sand
  221.          {
  222.           if ( (getwallcel(rem_sand)==1)||(getwallcel(add_sand)==1) ) return;
  223.          call sand_rem;
  224.          }
  225.  
  226.      return;
  227.     
  228.  
  229. # ........................................................................................
  230.  
  231. arrived:
  232.      //print("current elev frame:")
  233.      //printint(getc
  234.     if (GetSenderId() == 1) //the elev
  235.           {
  236.           if (GetCurFrame(elevator) == 0) 
  237.              {
  238.                SetWallCel(release_brake, 0);
  239.                PlaySoundPos(wav0, SurfaceCenter(release_brake), 0.6, -1, -1, 0);
  240.                print("STOP!  THE!  SOUND!");
  241.                 stopsound(xmove, 0.5); 
  242.                print("elevatorframeis:");
  243.                printint(getcurframe(elevator));
  244.                print("move droid");
  245.                sendmessage(rdroid, user3);  //if bottom
  246.                sendmessage(rdroid, user2);  //if top
  247.                call adjoinoff;
  248.                dwenablejump();
  249.                playsoundlocal(esp, 1, 0, 0);
  250.                }
  251.           } 
  252.     return;
  253. # ........................................................................................
  254.  
  255. sand_add:
  256.       if ( (GetWallCel(add_sand) != 1) && (GetWallCel(rem_sand) != 1) )//Nothing's already happening
  257.         {
  258.         sendmessage(sander, user1);
  259.         SetWallCel(add_sand, 1);
  260.           PlaySoundPos(switch, SurfaceCenter(add_sand), 0.6, -1, -1, 0);
  261.         sand_inc = 1;
  262.         c_dest = c_weight + step;
  263.         SetPulse(0.3);
  264.         }
  265.     return;
  266.  
  267. sand_rem:
  268.  if ( (GetWallCel(rem_sand) != 1) && (GetWallCel(add_sand) != 1) )    //Nothing's already happening
  269.         {
  270.           sendmessage(sander, user2);
  271.         SetWallCel(rem_sand, 1);
  272.           PlaySoundPos(switch, SurfaceCenter(rem_sand), 0.6, -1, -1, 0);
  273.         sand_inc = -1;
  274.         c_dest = c_weight - step;
  275.         SetPulse(0.3);
  276.         }
  277.  
  278.     return;
  279.  
  280.  
  281. pulse:
  282.     c_weight = c_weight + sand_inc;
  283.     if (c_weight < 200) 
  284.         {
  285.           sendmessage(sander, user0);
  286.         SetPulse(0);
  287.         Set