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

  1. #standard type magnetic tram cog.
  2. #don't forget to set blocking walls to "no move"
  3. symbols
  4. message             startup
  5. message             arrived
  6. message             crossed
  7. message             entered
  8.  
  9. thing               magnettram   
  10. thing               beammid
  11. thing               beamstart
  12. thing               beamend
  13.  
  14. sector              thrustsector        linkid=5   
  15. sector              thrustonsector0     linkid=6
  16. sector              thrustonsector1     linkid=6
  17.  
  18. surface             triggeradjoin       mask=0x484    
  19. surface             tram1block1         nolink
  20. surface             tram1block2         nolink
  21.  
  22. vector              cratepos            local
  23. vector              trampos             local
  24. vector              thrustvector
  25.  
  26. sound               playerattsound=nrg00mgntattch.wav
  27. sound               crateattsound=crat1drpcrt.wav
  28.  
  29. sound               magnetstart=nrgt2magnet.wav
  30. sound               magnetloop=amb00mgntlp2.wav
  31.  
  32. end
  33.  
  34. ## Code Section
  35. code                  
  36. startup:
  37.      addbeam(beamstart, beamend, 147, .02);  
  38.      movetoframe(magnettram, 3, 25);
  39.      printflex(getadjoinflags(tram1block1));
  40.      setsectorthrust(thrustsector, thrustvector, 8);
  41.      player=getlocalplayerthing();
  42.      if (dwdCheckDroidCaps(16)!=0) print ("droid is magnetic");
  43.      return;
  44.      
  45. crossed:
  46.      hangoffset=('0,0,0');
  47.      achthing=getsourceref();
  48.      call movetram;
  49.      return;
  50.  
  51. entered:
  52.      //if magnetic check is true return
  53.      if (dwCheckDroidCaps(16)!=0) return;     
  54.      if (getsenderid()==5) {
  55.           call clrajnflgs;
  56.           setsectorthrust(thrustsector, thrustvector, 0);
  57.           stopsound(magloop1);
  58.      }
  59.      else if (getsenderid()==6) {
  60.           call setajnflgs;
  61.           setsectorthrust(thrustsector, thrustvector, 8);                        
  62.      }
  63.      return;     
  64.      
  65.  
  66. movetram:
  67.      call clrajnflgs;
  68.      if (achthing==player) {
  69.           playsoundthing(playerattsound, achthing, 1.0, -1, -1, 0);
  70.           dwdisablejump();
  71.      }
  72.      else playsoundthing(crateattsound, achthing, 1.0, -1, -1, 0);     
  73.      setsectorthrust(thrustsector, thrustvector, 0);
  74.      totalradius = GetThingRadius(achthing) + GetThingRadius(magnettram);
  75.     VectorSet(hangoffset, 0, 0, -totalradius);
  76.  //    hangoffset = VectorAdd(hangoffset, GetThingInsertOffset(magnettram));
  77.     hangoffset = VectorSub(hangoffset, GetThingInsertOffset(achthing));
  78.     SetThingPos(achthing, VectorAdd(GetThingPos(magnettram), hangoffset));
  79.     AttachThingToThingEx(achthing, magnettram, 8);
  80.      print("attaching to tram");
  81.      movetoframe(magnettram, 1, 15);
  82.      return;
  83.      
  84. arrived:
  85.      //when the tram has arrived, drop the achthing and reset to stop 0
  86.      if ((getcurframe(magnettram))==2) {
  87.           if (achthing==player) {
  88.                movetoframe(magnettram,3,15);
  89.                dwenablejump();
  90.           }
  91.           detachthing(achthing);
  92.           setthingvel(achthing, '0,0,0.5');
  93.           printflex(getadjoinflags(tram1block1));
  94.      }  
  95.      else if ((getcurframe(magnettram))==1) {
  96.           removelaser(burning);
  97.           movetoframe(magnettram, 2, 15);
  98.      }
  99.      else if ((getcurframe(magnettram))==3) {
  100.           skiptoframe(magnettram, 0, 15);
  101.           burning=(addbeam(beammid, magnettram, 147, .02));
  102.      }
  103.      else if ((getcurframe(magnettram))==0) {        
  104.           print("RX thrust on");   
  105.           setsectorthrust(thrustsector, thrustvector, 8);
  106.           playsoundthing(magnetstart, magnettram, 1.0, 10, 20, 0);
  107.           magloop1=playsoundthing(magnetloop, magnettram, .45, 10, 20, 0x1);           
  108.      //when the tram has reset, mark walls 'no move' again.          
  109.           clearadjoinflags(tram1block1, 2);
  110.           clearadjoinflags(tram1block2, 2);
  111.      }
  112.      return;
  113.      
  114. clrajnflgs:
  115.      print("clearing flags");
  116.      setadjoinflags(tram1block1, 2);
  117.      setadjoinflags(tram1block2, 2);
  118.      return;
  119.      
  120. setajnflgs:
  121.      print("setting flags");
  122.      clearadjoinflags(tram1block1, 2);
  123.      clearadjoinflags(tram1block2, 2);
  124.      return;
  125.           
  126.  
  127.  
  128. end
  129.  
  130.  
  131.