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

  1. #This script handles the mfagnet tram in the phrik mine
  2. # It turns on the thrust after the player enters the catapult area.
  3. # Then it tells Sneaky.cog to have the FITTO move
  4.  
  5. symbols
  6. message        user1
  7. message        arrived
  8. message        startup
  9. message        crossed
  10. message        entered
  11. message        timer
  12. message        user6
  13.  
  14. template       w50cratetemplate
  15.  
  16. surface        triggeradjoin            mask=0xfff
  17.  
  18. sector         thrustsector        mask=0xfff     linkid=5  
  19. vector         thrustvector
  20.  
  21. thing          wcreatecrateghost
  22. thing          newtram 
  23. thing          ghostcamera
  24.  
  25. thing          AD                  
  26. thing          stopdoor
  27. thing          gonk
  28. thing          ADcamera
  29.      
  30. cog            ADaicog
  31. cog            catapultcog
  32. cog            sneakycog
  33.  
  34. sector         roomsector          linkid=1
  35.  
  36. sound          t1dropcrate
  37. sound          t1trammove
  38. sound          t1tramstart
  39.  
  40. sector         thrustonsector1     linkid=6
  41. sector         thrustonsector2     linkid=6
  42. sector         thrustonsector3     linkid=6
  43. template       ADmq
  44. thing          ADmqGhost
  45.  
  46.  
  47. surface             tramblock1          nolink
  48. surface             tramblock2          nolink
  49. surface             tramblock3          nolink
  50.  
  51. template       ADtemplate
  52. thing          teledoordest
  53. thing          telehideaway
  54. int            isattached=0             local
  55. end
  56.  
  57. code
  58. startup:
  59.      player=getlocalplayerthing();
  60.      movetoframe(stopdoor, 1, 5);
  61.      crateishere=0;
  62.      yet=0;  
  63.      sleep(2);   
  64.      call clearadjoinflags;
  65.      sabotage=0;
  66.      isattached=0;
  67.      return;    
  68.      
  69. entered:
  70.      if ( (yet==0)&&(getsenderid()==1) ) {
  71.           stopthing(player);
  72.           dwfreezeplayer();
  73.           setactorflags(player, 8);
  74. //          AIclearmode(AD, 0xffff);
  75. //          AIsetmode(AD, 0x2000);
  76.           movetoframe(stopdoor, 0, 5);
  77.           setcamerafocii(2, gonk ,ghostcamera);
  78.           setcurrentcamera(2);
  79.           dwplaycharacterspeech("SDX001", "m2bd034.wav");
  80.           dwcleardialog();
  81.           call setadjoinflags;
  82.           yet=0.5;     
  83.           sendmessage(SneakyCog, user0);
  84.      }
  85.      if  ( (yet==2)&&(dwCheckDroidCaps(16)==0) ) {          
  86.           if (getsenderid()==5) {
  87.                print("sectorthrustoff");
  88.                setsectorthrust(thrustsector, thrustvector, 0);               
  89.                call clearadjoinflags;
  90.           }
  91.           else if (getsenderid()==6) {
  92.                print("sectorthruston");
  93.                setsectorthrust(thrustsector, thrustvector, 8);          
  94.                call setadjoinflags;
  95.           }     
  96.      }
  97.      if (getsenderid()==5) {
  98.           print("something entered the thrustsector");
  99.           if ( (getthingtemplate(getsourceref())==ADtemplate)&&(yet==2)&&(isattached==0) ) {
  100.                achthing=getsourceref();
  101.                print("and it was the AD");
  102.                hangoffset=('0,0,0');
  103.                destroything(getsourceref());
  104.                tramspeed=1.5;
  105.                xADmq=creatething(ADmq,ADmqghost);               
  106.                call movetram;
  107.           }
  108.      }
  109.      return;     
  110.      
  111. timer:
  112.      if (getsenderid()==4) {
  113.           dwenddialog();
  114.           dwclearresponses();
  115.      }
  116.      else if (getsenderid()==3) {
  117.           dwunfreezeplayer();
  118.           setcurrentcamera(7);     
  119.      }
  120.      return;    
  121.  
  122. user1:
  123.      yet=1;
  124.      print("bing bang boom");
  125.      crateishere=1;
  126.      smallcrate=creatething (w50cratetemplate, wcreatecrateghost);
  127.      return;
  128.      
  129. user6:
  130.      yet=2;
  131.      return;
  132.                
  133. arrived:
  134.      if (getsenderref()==newtram) {
  135.           if (getcurframe(newtram)==0) {
  136.                if (yet>=1) setsectorthrust(thrustsector, thrustvector, 8);  
  137.                isattached=0;              
  138.                call setadjoinflags;
  139.           }          
  140.           else if (getcurframe(newtram)==2) {
  141.                if (crateishere!=1) sendmessage(ADaicog, user0);
  142.                movetoframe(newtram, 4, tramspeed);
  143.           }
  144.           else if (getcurframe(newtram)==4) {
  145.                sleep(2);          
  146.                if (crateishere==1) {
  147.                     destroything(achthing);
  148.                     sendmessage(catapultcog, user1);
  149.                     crateishere=0;
  150.                     playsoundthing(t1dropcrate, newtram, 1, -1, -1, 0);          
  151.                }
  152.                else {             
  153.                     playsoundthing(t1dropcrate, newtram, 1, -1, -1, 0);          
  154.                     if (achthing==player) {
  155.                          dwenablejump();
  156.                          detachthing(achthing);                     
  157.                          setthingvel(achthing, '0,0,1.0');
  158.                     }         
  159.                     if (tramspeed==1.5) {
  160.                          destroything(xADmq);
  161.                          sendmessage(catapultcog, user4);   #create AD and send him down
  162.                        #  teleportthing(AD, telereturn);               
  163.                        #  setthingvel(AD, '0,0,1.0');
  164.                     }
  165.                }      
  166.                movetoframe(newtram, 0, 25);
  167.           }    
  168.      }
  169.      if ( (getsenderref()==stopdoor)&&(getcurframe(stopdoor)==0) ) {
  170.           print("teleporting AD");
  171.           teleportthing(AD, teledoordest);
  172.           setsectorthrust(thrustsector, thrustvector, 8);               
  173.      }
  174.      return;
  175.      
  176. crossed:
  177.      if ( (yet>=1)&&(isattached==0) ) {
  178.           print("something crossed...");
  179.           isattached=1;
  180.           hangoffset=('0,0,0');
  181.           achthing=getsourceref();
  182.           if (getthingtemplate(achthing)==ADtemplate) {
  183.                print("and it was the assassin droid");
  184.                destroything(achthing);
  185.                tramspeed=1.5;
  186.                xADmq=creatething(ADmq,ADmqghost);               
  187.           }          
  188.           else if (achthing==player) {
  189.                dwdisablejump();
  190.                tramspeed=15;
  191.           }        
  192.           else tramspeed=15;
  193.           call movetram;
  194.      }
  195.      return;
  196.      
  197. ADcatchcam:
  198.      print("switching to ADcatchcam");
  199.      dwplaycammyspeech(16023, "m2ca023.wav", 20, 2);
  200.      dwfreezeplayer();
  201.      setcamerafocii(2, newtram, ADcamera);
  202.      setcurrentcamera(2);
  203.      settimerEX(7, 3, 0, 0);
  204.      return;
  205.      
  206. movetram:
  207.      //turn off sectorthrust
  208.      if (tramspeed==1.5) {
  209.           movetoframe(xADmq, 3, 1.5);    
  210.           call ADcatchcam;
  211.           print("you've got to hide your love away");
  212.      }        
  213.      setsectorthrust(thrustsector, thrustvector, 0);          
  214.      call clearadjoinflags;
  215.      totalradius = GetThingRadius(achthing) + GetThingRadius(newtram);
  216.     VectorSet(hangoffset, 0, 0, -totalradius);
  217.      hangoffset = VectorSub(hangoffset, GetThingInsertOffset(achthing));
  218. #     hangoffset = GetThingInsertOffset(achthing);     
  219. #     hangoffset = VectorSet(0, 0, VectorZ(hangoffset) - GetThingRadius(achthing));
  220. #     hangoffset = VectorSet(0, 0, -0.6    MAGIC NUMBER);
  221.     SetThingPos(achthing, VectorAdd(GetThingPos(newtram), hangoffset));
  222.     AttachThingToThingEx(achthing, newtram, 8);
  223.      movetoframe(newtram, 2, tramspeed);
  224.      return;
  225.  
  226. clearadjoinflags:
  227.      print("clearing flags");
  228.      setadjoinflags(tramblock1, 2);
  229.      setadjoinflags(tramblock2, 2);
  230.      setadjoinflags(tramblock3, 2);
  231.      return;
  232.      
  233. setadjoinflags:
  234.      print("setting flags");
  235.      clearadjoinflags(tramblock1, 2);
  236.      clearadjoinflags(tramblock2, 2);     
  237.      clearadjoinflags(tramblock3, 2);
  238.      return;
  239.  
  240. end
  241.  
  242.