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

  1. # Droids Cog Script
  2. #
  3. #
  4. #
  5. #
  6. # [MT]
  7. #
  8. #
  9. # (C) 1997 LucasLearningLimited. All Rights Reserved
  10.  
  11.  
  12.  
  13. symbols
  14. message             user0
  15. message             user1
  16. message             user5
  17. message             user2
  18. message             pulse
  19. message             arrived                                                           
  20. message             startup
  21. message             entered
  22. message             exited
  23. message             timer
  24. message             activate
  25.  
  26. thing               moveitBC       nolink
  27. thing               moveitAB       nolink
  28. thing               moveitCA       nolink
  29. thing               ghostleverA    nolink
  30. thing               ghostleverB    nolink
  31. thing               ghostleverC    nolink      
  32. thing               fulcrum        linkid=1 
  33. thing               mediumgonk     nolink  
  34. thing               easygonk       nolink
  35. thing               R5             nolink     
  36. thing               ghostdoorA     nolink
  37. thing               ghostdoorB     nolink
  38. thing               ghostdoorC     nolink
  39.  
  40. template            bigdoort       nolink
  41. template            levert         nolink
  42.  
  43. sector              playercheck    nolink   
  44. sector              exitcheck1     linkid=2
  45. sector              exitcheck2     linkid=2
  46. sector              exitcheck3     linkid=2
  47.  
  48. surface             fulcrumdisplay linkid=4
  49. surface             fulcrumtext    linkid=4      
  50.  
  51. cog                 gonkAIcog
  52. cog                 gonkAICog2
  53. cog                 ThatsillyCog
  54.  
  55. sound               fulcrumstart            
  56. sound               fulcrumstop            
  57. sound               fulcrumloop            
  58. sound               prydoor          
  59.  
  60. thing               ghostcamera   
  61. sound               hitgroundsound  
  62.  
  63. surface             block1
  64. surface             block2
  65. surface             block3       
  66.  
  67. thing               teledest
  68.  
  69. vector              thrustvector
  70. sector              thrustsector
  71. sector              thrustsector2
  72. surface             standinghere1  nolink
  73. surface             standinghere2  nolink
  74.  
  75. sector              exitcheck4     linkid=2
  76. sector              exitcheck5     linkid=2
  77.  
  78. end
  79.  
  80. ## Code Section
  81. code  
  82.  
  83. startup:
  84.      ca7=0;
  85.      ca9=0;
  86.      doorisdown=1;
  87.      gonkison=0;
  88.      playerison=0;
  89.      r5ison=0;
  90.      gonkisready=0;
  91.      bigdoor=creatething(bigdoort, ghostdoorA);
  92.      lever=creatething(levert, ghostleverA);
  93.      capturething(lever);
  94.      capturething(bigdoor);
  95.      player=getlocalplayerthing();
  96.      droidmass=getthingmass(player)/2.2;
  97. //     droidmass=300;
  98.      largemass=250;
  99.      if (droidmass>largemass) masscheck=1;
  100.      else masscheck=0;
  101.      xframe=0;     
  102.      setwallcel(fulcrumtext, 1);
  103.      sendmessage(thatsillycog, user4);
  104.      setthingmass(easygonk, 0);
  105.      setthingmass(mediumgonk, 0);
  106.      setthingmass(r5, 0);
  107.      if (getdifficulty()==0) {
  108.           teleportthing(mediumgonk, teledest);
  109.           teleportthing(r5, teledest); 
  110.           setactorflags(easygonk, 8);
  111.      }
  112.      else if (getdifficulty()==1) {
  113.           teleportthing(easygonk, teledest);
  114.           teleportthing(r5, teledest); 
  115.      }
  116.      else if (getdifficulty()==2) {
  117.           teleportthing(easygonk, teledest);
  118.           teleportthing(mediumgonk, teledest); 
  119.           setactorflags(r5, 8);
  120.      }
  121. #     sleep(3);
  122. #     call fakeit;
  123.      setadjoinflags(StandingHere1, 2);  #you can now walk thru this adjoin
  124.      setadjoinflags(StandingHere2, 2);  #you can now walk thru this adjoin
  125.      return;  
  126.      
  127. fakeit:
  128.      print("show me a vision");
  129.      movetoframe(lever, 1, 0.2);
  130. //     rotatepivot(lever, 1, 1);
  131.      movetoframe(bigdoor, 1, 1.0);
  132.      return;     
  133.  
  134. user0:
  135.      print("gonk is ready to go");
  136.      gonkisready=1;
  137.      clearadjoinflags(StandingHere1, 2);  #you can NOT walk thru this adjoin
  138.      clearadjoinflags(StandingHere2, 2);  #you can NOT walk thru this adjoin     
  139.      return;     
  140.      
  141. user5:
  142.      print("medium gonk is outside");
  143.      return;
  144.  
  145. user2:
  146.      print("i'm off.");
  147.      gonkison=0;
  148.      dwunfreezeplayer();
  149.      setcurrentcamera(7);
  150.      call Xmove;
  151.      setthingmass(easygonk, 0);
  152.      setthingmass(mediumgonk, 0);
  153.      return;
  154.  
  155. activate:     
  156.      psDist1=vectordist(getthingpos(player), getsurfacecenter(fulcrumdisplay));
  157.      psDist2=vectordist(getthingpos(player), getsurfacecenter(fulcrumtext));
  158.      if ( (getsenderid()==4)||(psDist1<.095)||(psDist2<.095) ){
  159.           if (ismoving(lever)!=0) return;
  160.           if ( (gonkison==1)&&(getdifficulty()!=2) ) {
  161.                print("external cam because gonk is on the lever");
  162.                dwfreezeplayer();          
  163.                setwallcel(fulcrumtext, 0);
  164.                setcamerafocii(2, fulcrum, ghostcamera);
  165.                setcurrentcamera(2);
  166.                sendmessage(gonkAIcog, user3);
  167.                sendmessage(gonkAIcog2, user3);
  168.                setthingmass(easygonk, 150);
  169.                setthingmass(mediumgonk, 150);
  170.           }
  171.           else if (r5ison==1) return;
  172.           else call Xmove;          
  173.      }
  174.      return;  
  175.      
  176. Xmove:
  177. //user1:
  178.      setwallcel(fulcrumtext, 0);
  179.      curframe=getcurframe(fulcrum);
  180.      destroything(lever);     
  181.      destroything(bigdoor);
  182.      if (curframe==0) call movefulcrumAB;
  183.      else if (curframe==1) call movefulcrumBC;
  184.      else if (curframe==2) call movefulcrumCA;
  185.      blinky=1;
  186.      playsoundthing(fulcrumstart, fulcrum, 1.0, -1, -1, 0);
  187.      sleep(0.17);
  188.      floop=playsoundthing(fulcrumloop, fulcrum, 1.0, -1, -1, 0x1);
  189.      return;
  190.      
  191. movefulcrumBC:
  192.      oneframe=1;
  193.      twoframe=2;
  194.      movetoframe(fulcrum, 2, 0.5);
  195.      lever=creatething(levert, moveitBC);
  196.      movetoframe(lever, 1, 0.19);
  197.      bigdoor=creatething(bigdoort, ghostdoorC);
  198.      capturething(bigdoor);
  199.      return;
  200.  
  201. movefulcrumAB:
  202.      oneframe=0;
  203.      twoframe=1;
  204.      movetoframe(fulcrum, 1, 0.5);
  205.      lever=creatething(levert, moveitAB);
  206.      movetoframe(lever, 1, 0.1);
  207.      bigdoor=creatething(bigdoort, ghostdoorB);
  208.      capturething(bigdoor);
  209.      return;
  210.      
  211. movefulcrumCA:
  212.      oneframe=2;
  213.      twoframe=0;
  214.      movetoframe(fulcrum, 0, .6);
  215.      lever=creatething(levert, moveitCA);
  216.      movetoframe(lever, 1, 0.17);
  217.      bigdoor=creatething(bigdoort, ghostdoorA);
  218.      capturething(bigdoor);
  219.      return;
  220.   
  221. arrived:
  222.      if(getsenderid()==1) {                
  223.           stopsound(floop, 0.75);
  224.           playsoundthing(fulcrumstop, fulcrum, 1.0, -1, -1, 0);
  225.           destroything(lever);
  226.           curframe=getcurframe(fulcrum); 
  227.           blinky=0;        
  228.           if (curframe==1) {
  229.                setwallcel(fulcrumdisplay, 1);
  230.                lever=creatething(levert, ghostleverB);
  231.           }
  232.           else if (curframe==2) {
  233.                setwallcel(fulcrumdisplay, 2);
  234.                lever=creatething(levert, ghostleverC);
  235.           }
  236.           else if (curframe==0) {
  237.                setwallcel(fulcrumdisplay, 0);
  238.                lever=creatething(levert, ghostleverA);
  239.           }          
  240.           setwallcel(fulcrumtext, 1);
  241.           capturething(lever);
  242.      }
  243.      else if (getsenderref()==lever) playsoundthing(hitgroundsound, lever, 1.0, -1, -1, 0);
  244.      else if ( (getsenderref()==bigdoor)&&(getcurframe(bigdoor)==0) ) {
  245.           call youareblocked;
  246.           print("the door has closed");
  247.      }                             
  248.      return;     
  249.        
  250. checkon:
  251.      if ((playerison==0)&&(getthingsector(player)==playercheck)) {
  252.           call checkforgonk;
  253.           print("you stepped on the lever");
  254.           call pulse;
  255.           setpulse(0.5);          
  256.           playerison=1;
  257.           cameracheck=1;
  258.      }
  259.      return;
  260.  
  261.  
  262. entered:
  263.      if (getsenderref()==lever) {
  264.           if (getsourceref()==player) {
  265.                if ((playerison==0)&&(getthingsector(player)==playercheck)) {
  266.                     call checkforgonk;
  267.                     print("you stepped on the lever");
  268.                     call pulse;
  269.                     setpulse(0.5);          
  270.                     playerison=1;
  271.                     cameracheck=1;
  272.                     setadjoinflags(StandingHere1, 2);  #you can now walk thru this adjoin
  273.                     setadjoinflags(StandingHere2, 2);  #you can now walk thru this adjoin
  274.                }
  275.                else settimerex(.5, 6, 0, 0);
  276.           }            
  277.           if ( (getsourceref()==easygonk)&&(getdifficulty()==0) ) {
  278.                print("the easy gonk has landed");
  279.                call raiseit;
  280.                print("gonkison = 1");
  281.                gonkison=1;
  282.                setthingmass(easygonk, 0);               
  283.                setsectorthrust(thrustsector, thrustvector, 0);          
  284.                setsectorthrust(thrustsector2, thrustvector, 0);
  285.                sleep(1);
  286.                setcurrentcamera(7);
  287.                dwunfreezeplayer();
  288.           }
  289.           if ( (getsourceref()==mediumgonk)&&(getdifficulty()==1) ) {
  290.                print("the medium gonk has landed");
  291.                call raiseit;
  292.                gonkison=1;
  293.                print("gonkison = 1");
  294.                setthingmass(mediumgonk, 0);               
  295.                setsectorthrust(thrustsector, thrustvector, 0);          
  296.                setsectorthrust(thrustsector2, thrustvector, 0);
  297.                sleep(1);
  298.                setcurrentcamera(7);
  299.                dwunfreezeplayer();
  300.           }        
  301.           if (getsourceref()==r5) {
  302.                print("r5 is here!");
  303.                call raiseit;
  304.                r5ison=1;
  305.                setthingmass(r5, 0);
  306.                setsectorthrust(thrustsector, thrustvector, 0);
  307.                setsectorthrust(thrustsector2, thrustvector, 0);
  308.                sleep(1);
  309.                setcurrentcamera(7);
  310.                dwunfreezeplayer();
  311.           }
  312.      }
  313.      else if (getsenderid()==2) {
  314.           call lowerit;    
  315.      }
  316.      return;
  317.      
  318. checkoff:
  319. exited:
  320.      if (getsenderref()==lever) {
  321.           if (getsourceref()==player) {
  322.                print("exited called");
  323.                if(getthingsector(player)!=playercheck) {
  324.                     print("you stepped off the lever");
  325.                     setpulse(0);
  326.                     playerison=0;
  327.  //                   cameracheck=0;
  328.                     call lowerit;
  329.                }
  330.                else {
  331.                     settimerex(.5, 5, 0, 0);
  332.                }
  333.           }
  334.           else if  ((getsourceref()==mediumgonk)||(getsourceref()==easygonk) ) {
  335.                print("gonk has left the building");
  336.                call lowerit;
  337.                gonkison=0;
  338.           }
  339.      }        
  340.      else {
  341.           print("checking once more");
  342.           if(getthingsector(player)!=playercheck) {
  343.                print("you stepped off the lever");
  344.                setpulse(0);
  345.                playerison=0;
  346.                call lowerit;
  347.           }
  348.      }    
  349.       
  350.  
  351.      return;       
  352.      
  353. pulse:
  354.      fulcrumY=(VectorY(GetThingPos(fulcrum)));
  355.      playerY=(VectorY(GetThingPos(player)));
  356.      playerZ=(vectorZ(GetthingPos(player)));
  357.      if ((playerY>fulcrumY)&&(doorisdown==0)) call lowerit;
  358.      else if ((playerY<fulcrumY)&&(doorisdown==1)) call raiseit; 
  359.      return;
  360.  
  361. checkforgonk:
  362.      print("checking for gonk");
  363.      if (gonkisready==1) {
  364.           print("blowing out camera");
  365.           dwfreezeplayer();
  366.           setcamerafocii(2, player, ghostcamera);
  367.           setcurrentcamera(2);          
  368.           if (getdifficulty()!=2) {
  369.                if (getcurframe(fulcrum)!=0) {
  370.                     print("here comes gonk");
  371.                     sendmessage (gonkAIcog, user2);
  372.                     sendmessage (gonkAIcog2, user2);
  373.                     gonkisready=0;
  374.                     timertime=7;
  375.                     setthingmass(easygonk, 150);
  376.                     setthingmass(mediumgonk, 150);
  377.                     setsectorthrust(thrustsector, thrustvector, 8);               
  378.                     setsectorthrust(thrustsector2, thrustvector, 8);       
  379.                }
  380.                else {
  381.                     print("gonk says we don't have enough leverage");
  382.                     settimer(2);
  383.                     dwplaycharacterspeech("GKC400", "t6gk015.wav");
  384.                     dwcleardialog();
  385.                }           
  386.           }
  387.           else if (getdifficulty()==2) {
  388.                if (getcurframe(fulcrum)==2) {
  389.                     print("here comes r5");
  390.                     sendmessage (thatsillycog, user2);
  391.                     gonkisready=0;
  392.                     timertime=7;   
  393.                     setthingmass(r5, 150);                    
  394.                     setsectorthrust(thrustsector, thrustvector, 8);               
  395.                     setsectorthrust(thrustsector2, thrustvector, 8);
  396.                     setadjoinflags(StandingHere1, 2);  #you can now walk thru this adjoin
  397.                     setadjoinflags(StandingHere2, 2);  #you can now walk thru this adjoin
  398.                }
  399.                else {
  400.                     print("r5 says we don't have enough leverage");
  401.                     settimer(2);
  402.                     dwplaycharacterspeech("R5C600", "t6bd010.wav");
  403.                     dwcleardialog();
  404.                }       
  405.           }
  406.      }
  407.      else if (gonkisready==0) {
  408.           timertime=3;
  409.      }          
  410.      return;     
  411.  
  412.  
  413. youcanmovethru:
  414.      setadjoinflags(block1, 2);     
  415.      setadjoinflags(block2, 2);
  416.      setadjoinflags(block3, 2);
  417.      return;
  418.      
  419. youareblocked:
  420.      clearadjoinflags(block1, 2);     
  421.      clearadjoinflags(block2, 2);
  422.      clearadjoinflags(block3, 2);
  423.      return;
  424.  
  425.  
  426. raiseit:
  427.      print("raiseit called");  
  428.      if (doorisdown==0) {
  429.           print("the door is already up");
  430.           return;     
  431.      }
  432.      curframe=getcurframe(fulcrum);
  433.      
  434.      if (curframe==0) {
  435. #          if (droidmass>1972) {
  436. #          if (1) {       
  437.           if (0) {         
  438.                print("raising it under pressure");
  439.                call youcanmovethru;
  440.                movetoframe(lever, 1, 0.7);
  441.                movetoframe(bigdoor, 1, 1.0);
  442.                doorisdown=0;
  443.                playsoundthing(prydoor, bigdoor, 1.0, -1, -1, 0); 
  444.           }          
  445.           else {        
  446.                if ((getdifficulty()==0)&&(ca7==0)) {
  447.                     dwplaycammyspeech(16007, "t6ca003.wav", 15, 2);
  448.                     ca7=1;
  449.                }       
  450.                return; 
  451.           } 
  452.      }
  453.      print("raising it"); 
  454.      if (curframe==1) {     
  455.           if ((masscheck==1)||(gonkison==1)) {
  456.                call youcanmovethru;
  457.                movetoframe (lever, 1, 0.5);
  458.                movetoframe(bigdoor, 1, 2.2);
  459.                doorisdown=0;               
  460.                playsoundthing(prydoor, bigdoor, 1.0, -1, -1, 0); 
  461.                if (ca9==0) {
  462.                     if (getdifficulty()==1) dwplaycammyspeech(16009, "t6ca005.wav", 15, 2);
  463.                     else if (getdifficulty()==0) dwplaycammyspeech(16003, "t1ca005.wav", 15, 2);
  464.                     ca9=1;
  465.                }         
  466.           }
  467.      }           
  468.      else if (curframe==2) {
  469.           call youcanmovethru;
  470.           movetoframe (lever, 1, 0.7);
  471.           movetoframe(bigdoor, 1, 1.0);
  472.           doorisdown=0;          
  473.           playsoundthing(prydoor, bigdoor, 1.0, -1, -1, 0);
  474.           if (ca9==0) {
  475.                if (getdifficulty()==1) dwplaycammyspeech(16009, "t6ca005.wav", 15, 2);
  476.                else if (getdifficulty()==0) dwplaycammyspeech(16003, "t1ca005.wav", 15, 2);
  477.                ca9=1;
  478.           }      
  479.     }
  480.      return;
  481.      
  482. lowerit:
  483.      if (doorisdown==1) return;
  484.      curframe=getcurframe(fulcrum);
  485. #     if (curframe==0) {
  486. #          movetoframe(lever, 0, 5);
  487. #          movetoframe(bigdoor, 0, 2.2);          
  488. #          playsoundthing(prydoor, bigdoor, 1.0, -1, -1, 0);
  489. #     }
  490.      if (curframe==1) {
  491.          if (gonkison==0) {
  492.                print("moving down quickly");
  493.                movetoframe (lever, 0, 5);
  494.                movetoframe(bigdoor, 0, 2.2);
  495.                doorisdown=1;          
  496.                playsoundthing(prydoor, bigdoor, 1.0, -1, -1, 0);
  497.           }
  498.           else if (gonkison==1) {
  499.                print("lowering slowly because gonk is on");
  500.                movetoframe (lever, 0, 0.003);
  501.                movetoframe(bigdoor, 0, 0.6);
  502.                playsoundthing(prydoor, bigdoor, 1.0, -1, -1, 0);          
  503.                doorisdown=1;          
  504.           }
  505.      }
  506.      else if (curframe==2) {
  507.           if ((gonkison==0)&&(r5ison==0)) {
  508.                print("moving down quickly");
  509.                movetoframe (lever, 0, 1.4);
  510.                movetoframe(bigdoor, 0, 2.0);
  511.                playsoundthing(prydoor, bigdoor, 1.0, -1, -1, 0);               
  512.                doorisdown=1;          
  513.           }
  514.           else if  ( (gonkison==1)||(r5ison==1) ) {
  515.               print("doing nothing because gonk or r5 is on");              
  516.           }
  517. //          else if (r5ison==1) {
  518. //               movetoframe (lever, 0, 0.175);
  519. //               movetoframe(bigdoor, 0, 0.25);
  520. //               playsoundthing(prydoor, bigdoor, 1.0, -1, -1, 0);                 
  521. //               doorisdown=1;          
  522. //          }
  523.      }                                        
  524.      return;
  525.       
  526. timer:    
  527.      if (getsenderid()==5) call checkoff;               
  528.      else if (getsenderid()==6) call checkon;
  529.      else {
  530.           SetCurrentCamera(7);
  531.           dwUnfreezePlayer();
  532.      }
  533.      return;     
  534.              
  535.  
  536.                 
  537. end
  538.  
  539.