home *** CD-ROM | disk | FTP | other *** search
/ Classic Fond 52 / ClassicFond52.iso / GAMES / DROIDW.RAR / DWCD.GOB / mission_cog_d0_tread1rx178.cog < prev    next >
Text File  |  1998-11-04  |  4KB  |  138 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. sector              thrustonsector2     linkid=6
  18. sector              thrustonsector3     linkid=6
  19.  
  20. surface             triggeradjoin       mask=0x484    
  21. surface             tram1block1         nolink
  22. surface             tram1block2         nolink
  23. surface             tram1block3         nolink
  24. surface             tram1block4         nolink
  25.  
  26. vector              cratepos            local
  27. vector              trampos             local
  28. vector              thrustvector
  29.  
  30. sound               playerattsound=nrg00mgntattch.wav
  31. sound               crateattsound=crat1drpcrt.wav
  32. sound               magnetstart=nrgt2magnet.wav
  33. sound               magnetloop=amb00mgntlp2.wav
  34.  
  35. end
  36.  
  37. ## Code Section
  38. code                  
  39. startup:
  40.      addbeam(beamstart, beamend, 147, .02);  
  41.      movetoframe(magnettram, 3, 25);
  42.      printflex(getadjoinflags(tram1block1));
  43.      player=getlocalplayerthing();
  44.      if (dwCheckDroidCaps(16)!=0) thrustpower=8;
  45.      else thrustpower=0;
  46.      setsectorthrust(thrustsector, thrustvector, thrustpower);     
  47.      return;
  48.      
  49. crossed:
  50.      hangoffset=('0,0,0');
  51.      achthing=getsourceref();
  52.      call movetram;
  53.      return;
  54.  
  55.  
  56.      
  57.  
  58. movetram:
  59.      call clrajnflgs;
  60.      if (achthing==player) {
  61.           playsoundthing(playerattsound, achthing, 1.0, -1, -1, 0);
  62.           dwdisablejump();
  63.      }
  64.      else playsoundthing(crateattsound, achthing, 1.0, -1, -1, 0);     
  65.      setsectorthrust(thrustsector, thrustvector, 0);
  66.      stopsound(magloop1);
  67.      totalradius = GetThingRadius(achthing) + GetThingRadius(magnettram);
  68.     VectorSet(hangoffset, 0, 0, -totalradius);
  69.  //    hangoffset = VectorAdd(hangoffset, GetThingInsertOffset(magnettram));
  70.     hangoffset = VectorSub(hangoffset, GetThingInsertOffset(achthing));
  71.     SetThingPos(achthing, VectorAdd(GetThingPos(magnettram), hangoffset));
  72.     AttachThingToThingEx(achthing, magnettram, 8);
  73.      movetoframe(magnettram, 1, 15);
  74.      return;
  75.      
  76. arrived:
  77.      //when the tram has arrived, drop the achthing and reset to stop 0
  78.      if ((getcurframe(magnettram))==2) {
  79.           if (achthing==player) {
  80.                movetoframe(magnettram,3,15);
  81.                dwenablejump();
  82.           }
  83.           detachthing(achthing);
  84.           setthingvel(achthing, '0,0,0.5');
  85.           printflex(getadjoinflags(tram1block1));
  86.      }  
  87.      else if ((getcurframe(magnettram))==1) {
  88.           removelaser(burning);
  89.           movetoframe(magnettram, 2, 15);
  90.      }
  91.      else if ((getcurframe(magnettram))==3) {
  92.           skiptoframe(magnettram, 0, 15);
  93.           burning=(addbeam(beammid, magnettram, 147, .02));
  94.      }
  95.      else if ((getcurframe(magnettram))==0) {
  96.           setsectorthrust(thrustsector, thrustvector, thrustpower);
  97.           playsoundthing(magnetstart, magnettram, 1.0, 10, 20, 0);
  98.           magloop1=playsoundthing(magnetloop, magnettram, .45, 10, 20, 0x1);         
  99.      //when the tram has reset, mark walls 'no move' again.          
  100.           clearadjoinflags(tram1block1, 2);
  101.           clearadjoinflags(tram1block2, 2);
  102.           clearadjoinflags(tram1block3, 2);
  103.           clearadjoinflags(tram1block4, 2); 
  104.      }
  105.      return;
  106.      
  107. clrajnflgs:
  108.      print("clearing flags");
  109.      setadjoinflags(tram1block1, 2);
  110.      setadjoinflags(tram1block2, 2);
  111.      setadjoinflags(tram1block3, 2);
  112.      setadjoinflags(tram1block4, 2);
  113.      return;
  114.      
  115. setajnflgs:
  116.      print("setting flags");
  117.      clearadjoinflags(tram1block1, 2);
  118.      clearadjoinflags(tram1block2, 2);
  119.      clearadjoinflags(tram1block3, 2);
  120.      clearadjoinflags(tram1block4, 2);
  121.      return;
  122.      
  123. entered:
  124.      if (getsenderid()==5) {
  125.           print("entered the checksector");
  126.           if (dwCheckDroidCaps(16)==0) {
  127.                print("non-magnetic);
  128.                call clrajnflgs;
  129.           }
  130.      }          
  131.      return;
  132.           
  133.  
  134.  
  135. end
  136.  
  137.  
  138.