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

  1. #
  2. # gen_MoveObj.cog
  3. #
  4. #
  5. # A hack for pushing blocks around. Inspired by Reed Derleth, but actually executed by me.
  6. # Because Reed is too lazy right now.
  7. # IMPORTANT. Make sure you attach the cog to a valid object.
  8. # Make sure that the ghostthing is assigned to a ghost object.
  9. #
  10. # [SXC]
  11. #
  12. # 3/22/98 MST  Ripped the cog apart and added the setthingvel to fake pushing
  13. #              Also added part to jump on this thing and have it spin
  14. #              (Yecchh, what a hack.)
  15. #              Watch for a future implementation of this script in a future LECLLC 3D game!
  16. #
  17. # (C) 1998 LucasLearningLimited  All Rights Reserved
  18. # ========================================================================================
  19.  
  20. symbols
  21.     message   startup
  22.     message    timer
  23.      message   entered
  24.      message   pulse
  25.      message   exited
  26.      message   user0
  27.      message   user4
  28.      message   arrived
  29.      message   activate
  30.      message   touched
  31.  
  32.     vector    playervec           local
  33.     vector    newthingvec         local
  34.     vector    newvector           local
  35.  
  36.     thing     fulcrum             linkid=1
  37.      thing     lever               linkid=2  mask=0xfff
  38.      thing     crateghost
  39.  
  40.     int       direction=0         local
  41.  
  42.     float     playery=0           local
  43.     float     playerx=0           local
  44.  
  45.     sector    gensector           local
  46.      sector    ds1
  47.  
  48.      template  crateT         
  49.      thing     crateG
  50.      
  51.      surface   moveleft            linkid=3
  52.      surface   moveright           linkid=4
  53.  
  54.      vector    supervector
  55.      vector    leftvector
  56.      vector    rightvector
  57.      
  58.      surface   track
  59.      
  60.      sound     fulcrumstart=mcht6fulcstrt.wav            
  61.      sound     fulcrumstop=mcht6fulcstp.wav            
  62.      sound     fulcrumloop=mcht6fulclp.wav   
  63.      sound     switchbeep=swt00ltswch2.wav            
  64.      
  65.      vector    goodriddancevector   
  66.      
  67.      sound     dave=mch00tmchst02.wav
  68.  
  69. end
  70.  
  71.  
  72.  
  73. # ========================================================================================
  74.  
  75. code
  76.  
  77. startup:
  78.      cooltoflip=0;
  79.      crateishere=0;
  80.      supervector=vectorscale(supervector, 5.0);
  81.      print("startup");
  82.      player=getlocalplayerthing();
  83.      call createmovelever;
  84.      sxc=1.0;
  85.      timertime=0.1;
  86.      leverisdown=1;
  87.      playerison=0;
  88.      attachthingtothing(lever, fulcrum);
  89. //     call raiseit;
  90.      launchem=0;     
  91.      
  92.      return;
  93.      
  94. touched:
  95.      if ( (getsenderref()==crate)&&(getsourceref()==player) ) {
  96.           print("ten story love song");
  97.           DamageThing(player, 9999, 0x2, player);    // self-inflicted damage     
  98.      }
  99.      return;
  100.      
  101. user4:
  102.      print("ring a ding ding ding I'm going down");
  103.      crate=creatething(crateT, crateghost);
  104.      capturething(crate);
  105.      setthingvel(crate, '0,0,-1');
  106.      settimerEX(0.5, 1, 0, 0);
  107.      crateishere=1;
  108.      return;     
  109.  
  110.  
  111.  
  112. # .....................................................................................
  113.  
  114. entered:          
  115.      fulcrumx=(Vectorx(GetThingPos(fulcrum)));
  116.      playerx=(Vectorx(GetThingPos(player)));     
  117.      if (getsenderid()==2) {
  118.           if (getsourceref()==player) {
  119.                print("player entered");     
  120.                setpulse(0.1);
  121.                playerison=1;
  122.           }          
  123.           else if (getsourceref()==crate) {
  124.                print("the crate hit it");
  125.                setthingvel(crate, goodriddancevector);
  126.                settimerEX(0.05, 3, -1, -1);
  127.                if ( (leverisdown==0)&&(cooltoflip==1) ) {           
  128.                     if  ( (playerison==1)&&(playerx>fulcrumx) )launchem=1;
  129.                     print("and it's movin'");
  130.                     rotatepivot(lever, 1, -.1);     
  131. //                    destroything(crate);                  
  132.                }
  133.           }
  134.      }
  135.      return;     
  136.      
  137. exited:
  138.      if ( (getsenderid()==2)&&(getsourceref()==player) ) {
  139.           setpulse(0);
  140.           playerison=0;
  141.      }
  142.      return;
  143.  
  144. activate:
  145.      if (getwallcel(moveleft)==1) return;     
  146.      if (getwallcel(moveright)==1) return;
  147.      curframe=getcurframe(fulcrum);
  148.      printint(curframe);
  149.      if (getsenderid()==3) {
  150.           setwallcel(moveleft, 1);     
  151.           print("move left!");
  152.           playsoundlocal(switchbeep, 1.0, 0.0, 0);   
  153.           if (curframe==0) {
  154.                sleep(0.2);
  155.                call waterfall;
  156.           }
  157.           else {
  158.                playsoundthing(fulcrumstart, fulcrum, 1.0, -1, -1, 0);
  159.                sleep(0.17);
  160.                floop=playsoundthing(fulcrumloop, fulcrum, 1.0, -1, -1, 0x1);         
  161.                movetoframe(fulcrum, curframe-1, 2);
  162.                anim=slidewall(track, leftvector, 2);
  163.           }
  164.      }
  165.      else if (getsenderid()==4) {
  166.           print("move right!");
  167.           setwallcel(moveright, 1);                    
  168.           playsoundlocal(switchbeep, 1.0, 0.0, 0);   
  169.           if (curframe==9) {
  170.                sleep(0.2);
  171.                call waterfall;
  172.           }
  173.           else {        
  174.                playsoundthing(fulcrumstart, fulcrum, 1.0, -1, -1, 0);
  175.                sleep(0.17);
  176.                floop=playsoundthing(fulcrumloop, fulcrum, 1.0, -1, -1, 0x1);            
  177.                movetoframe(fulcrum, curframe+1, 2);
  178.                anim=slidewall(track, rightvector, 2);
  179.           }
  180.      }
  181.      return;
  182.  
  183. # .....................................................................................
  184.      
  185. timer:    
  186.      if (getsenderid()==1) {
  187.           if (getthingsector(crate)==ds1) {
  188.                destroything(crate);
  189.                crateishere=0;
  190.           }
  191.           else settimerEX(0.5, 1, 0, 0);
  192.      }
  193.      else if (getsenderid()==3) {
  194.           print("get rid of that crate!");
  195.           setthingvel(crate, goodriddancevector);
  196.           if (crateishere!=0) settimerEX(0.05, 3, -1, -1);
  197.      }
  198.      return;
  199. # .....................................................................................
  200. pulse:
  201.      fulcrumx=(Vectorx(GetThingPos(fulcrum)));
  202.      playerx=(Vectorx(GetThingPos(player)));
  203.      playerZ=(vectorZ(GetthingPos(player)));
  204.      if ((playerx<fulcrumx)&&(leverisdown==0)) call lowerit;
  205.      else if ((playerx>fulcrumx)&&(leverisdown==1)) call raiseit; 
  206.      return;
  207.      
  208. raiseit:
  209.      print("leverisdown=0");
  210.      playsoundthing(fulcrumstart, fulcrum, 1.0, -1, -1, 0);
  211.      leverisdown=0;
  212.      cooltoflip=1;
  213.      rotatepivot(lever, 1, 0.25);
  214.      return;
  215.      
  216. lowerit:
  217.      print("leverisdown=1");     
  218.      playsoundthing(fulcrumstart, fulcrum, 1.0, -1, -1, 0);
  219.      leverisdown=1;
  220.      rotatepivot(lever, 1, -0.25);
  221.      return;
  222. # .....................................................................................     
  223.      
  224. waterfall:
  225.      setwallcel(moveleft, 0);
  226.      setwallcel(moveright, 0);
  227.      return;
  228.  
  229. arrived:
  230.      print("arrived");
  231.      if (getsenderid()==1) {
  232.           stopsound(floop, 0.75);
  233.           playsoundthing(fulcrumstop, fulcrum, 1.0, -1, -1, 0);     
  234.           setwallcel(moveleft, 0);
  235.           setwallcel(moveright, 0);
  236.           stopanim(anim);
  237.      }
  238.      else {       
  239.           print("launchem is ");
  240.           printint(launchem);
  241.           print("playerison is");
  242.           printint(playerison);
  243.           print("cooltoflip is");
  244.           printint(cooltoflip);
  245.           if(crateishere==1) {
  246.                cooltoflip=0;
  247.                setthingvel(crate, goodriddancevector);
  248.                crateishere=0;
  249.                leverisdown=1;
  250.           }
  251.           if (launchem==1) {
  252.                print("here we go");
  253.                detachthing(player);
  254.                setthingvel(player, supervector);               
  255.                launchem=0;
  256.           }
  257.      }
  258.      return; 
  259.  
  260. # .....................................................................................
  261.  
  262.  
  263. end
  264.