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

  1. #
  2. # Droids Cog Script
  3. #
  4. # 03_Tanks.cog
  5. #
  6. #    bin 27    gear, this number can be changed.  Right now, it's Doug's large gear bin number.
  7. # Desc: 
  8. #     This cog is responsible for keeping track of what gears are in the Gear assembly and where.
  9. #    It's also in charge of moving the lock either to the right or to the left, depending on where
  10. #    the gears are placed.  There are also separate cogs for the gear pieces themselves when found.
  11. #    After they've been placed in this assembly, they are part of this script.  This cog will trigger 
  12. #    the water in the water tanks moving up and down also.  
  13. #     
  14. #
  15. # 1/27/98    [JP]         Created, mostly with lines taken from Doug's mega Gear cog...  
  16. #
  17. # <C> 1998 LucasLearningLimited.  All Rights Reserved--------------------------------------------------------------------------------
  18.  
  19.  
  20. symbols
  21.     
  22.     message    startup
  23.      message   used
  24.      message   arrived
  25.      message   user0
  26.      message   taken
  27.      message   timer
  28.      message   entered
  29.      message   pulse
  30.      
  31.     //surface    button0             linkid=2
  32.      surface   sign0
  33.      
  34.     ## Parts
  35.      thing     screw0              linkid=11          //horizontal worm gear
  36.      thing     lock                linkid=3           //tank lock
  37.      thing     big_gear_vert     linkid=11          //permanent big gear vertical, you don't place or take this
  38.      thing     big_gear_hori     linkid=11          //permanent big gear horizontal, you don't place or take this
  39.      thing     med_gear_vert     linkid=9          //permanent med gear vertical, you don't place or take this11
  40.      
  41.  
  42.      ##Ghost Objects
  43.      thing     lower_left_spindle_g     linkid=30
  44.      thing     lower_right_spindle_g    linkid=31
  45.      thing     upper_left_spindle_g     linkid=32
  46.      thing     upper_right_spindle_g    linkid=33
  47.      
  48.      ##Ghost creation integers
  49.      int       lower_left_spindle_i=0   linkid=30      local
  50.      int       lower_right_spindle_i=0                 local
  51.      int       upper_left_spindle_i=0                  local
  52.      int       upper_right_spindle_i=0                 local   
  53.      
  54.      ##Spin Direction integers
  55.      flex      lower_left_spindle_d=0.0      local
  56.      flex      lower_right_spindle_d=0.0     local
  57.      flex      upper_left_spindle_d=0.0      local
  58.      flex      upper_right_spindle_d=0.0     local
  59.      flex      big_gear_vert_d=0.0         local
  60.      flex      big_gear_hori_d=0.0         local
  61.      flex      med_gear_vert_d=0.0         local
  62.      
  63.      
  64.      ##templates
  65.      template  med_gear_t
  66.      
  67.      ##Sectors
  68.      //sector    lower_left_sector2         //for placing gear in lower left slot
  69.      //sector    lower_right_sector2         //  "          "   in lower right slot
  70.      //sector    upper_left_sector2          //  "          "   in upper left
  71.      //sector    upper_right_sector2         //  "          "   in upper right
  72.      
  73.      ##cogs
  74.      cog       tank_button2_cog //switch
  75.      cog       watermove1       //small tank adjoin and state changes
  76.      cog       watermove2       //medium tank adjoin and state changes
  77.      cog       watermove3       //large tank adjoin and state changes
  78.      cog       ecam             //to external camera
  79.      cog       pipemove
  80.      cog       rdroid
  81.      
  82.      ##sounds
  83.      sounds    machine_on          //moving .wav
  84.      sounds    place_gear          
  85.  
  86.      ## Integral Variables
  87.     float     speed=2.0                local
  88.     int        on_button0=0              local        
  89.      int       xrotate                   local
  90.      int       lower_left_spindle=0     local
  91.      int       lower_right_spindle=0    local
  92.      int       upper_left_spindle=0     local
  93.      int       upper_right_spindle=0    local
  94.      int       timermode=0              local
  95.      int       part_id=0                local
  96.      int       bin=27                   local
  97.      
  98.      
  99.      sound     motorfree=MCHt9MotFree.WAV       
  100.      sound     motor=MCHt9MotFree.WAV           
  101.      sound     switch=MCHt9MotStrt.WAV  //button
  102.      sound     attach=SWTt9GearOn.WAV           
  103.      sound     taken=SWTt9GearOff.WAV           
  104.      sound     grind=MCHt9GearBog.WAV           
  105.      sound     rotating=MCHt9MotStrss.WAV       
  106.      sound     closing=DORt7BoltSlide.WAV 
  107.      
  108.      thing     bottomspindles      linkid=9  //was11
  109.      thing     topspindles         linkid=10 //was11
  110.      thing     plat1               linkid=10
  111.      thing     plat2               linkid=10
  112.      thing     lockpod             linkid=9 //that cracked white thing
  113.      thing     motorpod            linkid=9 
  114.      cog       maps        
  115.      cog       waterfall
  116.      
  117.      sound     gearon=swtt9gearon.wav local
  118.      sound     gearoff=swtt9gearoff.wav local
  119.      
  120.      cog       arrows
  121.      
  122.      surface   s1
  123.      surface   s2
  124.      
  125.      sound     start2=MCHt9MotStrt.wav local
  126.      sound     fin2=MCHt9MotStp.wav local
  127.      
  128.      surface   s3
  129.      surface   s4
  130.      
  131.      surface   a1   linkid=5
  132.  
  133. end
  134.  
  135. ## Code Section
  136. code
  137.  
  138. startup:
  139.      //xrotate = 1;
  140.      //lower_left_spindle_d = -0.5;
  141.      //lower_right_spindle_d = 0.5;
  142.      //big_gear_vert_d = -0.5;
  143.      //big_gear_hori_d = 0.5;
  144.      //med_gear_vert_d = 0.5;
  145.      //call rotate_gears;
  146.      //print ("try4");
  147.      SetWallCel(sign0, 1);
  148.      AttachThingToThing (screw0, big_gear_vert);
  149.      player=getlocalplayerthing();
  150.      motorpos=vectory(getthingpos(med_gear_vert));
  151.      MiddleY=motorpos+.1969;  // was .1619, was .1969  
  152.      setpulse(0.5);
  153.      return;
  154.  
  155.  
  156. #==================================
  157. user0:
  158.           //User0 gets called when the player hits the motor switch, see tank_activate2.cog
  159.      print("user0");
  160.      if (xrotate == 0)  call start_motor;
  161.      return;
  162.  
  163. ##======================================
  164. used: 
  165.           // Section is executed when the user uses an inventory object.  
  166.           print("used2");
  167.           printint (dwGetActivateBin());
  168.           printint (getsenderid());
  169.           if (xrotate == 0)
  170.                {
  171.                if ( getinv(getlocalplayerthing(), dwGetActivatebin()) > 0)
  172.                     {
  173.                     if (GetSenderId() == 9)
  174.                          {
  175.                          playery=vectory(getthingpos(player));
  176.                          printflex(playery);
  177.                          printflex(MiddleY);
  178.                               {
  179.                               if (playery < MiddleY)
  180.                                    {
  181.                                    call handle_lower_right;
  182.                                    }
  183.                                    
  184.                               if (playery > MiddleY)
  185.                                    {
  186.                                    call handle_lower_left;
  187.                                    }
  188.                               }
  189.                               
  190.                          }
  191.                          
  192.                     else if (GetSenderId() == 10)
  193.                          {
  194.                          playery=vectory(getthingpos(player));
  195.                          printflex(playery);
  196.                          printflex(MiddleY);
  197.                               {
  198.                               if (playery < MiddleY)
  199.                                    {
  200.                                    call handle_upper_right;
  201.                                    }
  202.                                    
  203.                               if (playery > MiddleY)
  204.                                    {
  205.                                    call handle_upper_left;
  206.                                    }
  207.                                    
  208.                               }
  209.                          }
  210.                          
  211.                     else if (GetSenderId() == 5)
  212.                          {
  213.                          playery=vectory(getthingpos(player));
  214.                          printflex(playery);
  215.                          printflex(MiddleY);
  216.                               {
  217.                               if (playery < MiddleY)
  218.                                    {
  219.