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

  1. # DrowWorks Cog Script
  2. #    
  3. # SY_MagTram A
  4. #
  5. # First attempt at MagTram cog
  6. #
  7. # Desc:
  8. #    
  9. #
  10. #
  11. # [01/18/97] DGS Created From Matt's TreadRX script.
  12. # [03/03/98] DGS Modified to work with sector thrusts. It got totally re-written. (Del-Fi Lost Treasures)
  13. # [04/02/98] DGS  Getting totally re-written again as so it's waiting for you at said "wait point".  (Captiol Ultra-Lounge: Bachelor Pad Royale)
  14. #                   and it's a piece of junk that I just hate. 
  15.  
  16.  
  17. symbols
  18.  
  19. ## ====================== Messages
  20. message        startup
  21. message     arrived
  22. message     entered
  23. message     exited 
  24. message        pulse
  25. message        touched
  26. message        timer
  27.  
  28. ## ====================== Things
  29. thing        tram   
  30. thing        door1_o                
  31. thing        door2_o        
  32. thing        door3_o    
  33. thing        door4_o
  34. thing        door5_o    
  35. thing        door6_o    
  36.  
  37. ##  ====================== Surfaces
  38. surface     tram1block1        nolink
  39. surface     tram1block2        nolink
  40. surface     tram1block3        nolink
  41. surface     tram1block4        nolink
  42.  
  43. ## ---------------------- Door sectors
  44. int            door1_s            local
  45. int            door2_s            local
  46. int            door3_s            local
  47. int            door4_s            local
  48. int            door5_s            local
  49. int            door6_s            local
  50.  
  51. ##    ===================== Vectors
  52. vector        up_v
  53.  
  54. ## ====================== Sectors
  55. sector      pickup1_s         linkid=21
  56. sector      pickup2_s        linkid=22
  57. int            tram_sect_i        local    
  58.  
  59.  
  60.  
  61. ## ====================== Misc. Variables
  62.  
  63. flex        t_speed=15.0    local
  64. flex        door_speed=12.0    local
  65. int            cargo1_i=0        local
  66. int            cargo2_i=0        local 
  67. int            cargot_i=0        local
  68. int            pickups_i=0        local
  69. int            moveframe=0        local
  70. int            in_tram=0        local
  71. int            touchy=0        local
  72.  
  73.  
  74. end
  75.  
  76. # ========================================================================================
  77.  
  78. code
  79.  
  80. startup:
  81.     //movetoframe(tram,1,t_speed);
  82.     moveframe = 1;
  83.     call open_adjoins;
  84.     
  85.     door1_s = GetThingSector(door1_o);
  86.     SetSectorAdjoins(door1_s, 0);
  87.     door2_s = GetThingSector(door2_o);
  88.     SetSectorAdjoins(door2_s, 0);
  89.     door3_s = GetThingSector(door3_o);
  90.     SetSectorAdjoins(door3_s, 0);
  91.     door4_s = GetThingSector(door4_o);
  92.     SetSectorAdjoins(door4_s, 0);
  93.     door5_s = GetThingSector(door5_o);
  94.     SetSectorAdjoins(door5_s, 0);
  95.     door6_s = GetThingSector(door6_o);
  96.     SetSectorAdjoins(door6_s, 0);
  97.   
  98.  
  99.     return;
  100.  
  101. touched:
  102.     print("touched");
  103.     //printint(tram_pickup);
  104.     if (touchy == 0)
  105.     {
  106.     if (getsenderref() == tram)
  107.         {
  108.         call open_adjoins;
  109.         print("touched32");
  110.         touchy = 1;
  111.         tram_pickup = 0;
  112.         //print("touched");
  113.         achthing = getlocalplayerthing(); 
  114.         SectorThrust(pickups_i, up_v, 0);
  115.         sleep(0.01);
  116.         call pickup1;
  117.         settimer(1);
  118.         }
  119.     }
  120.     return;
  121.  
  122. entered:
  123.     if (dwCheckDroidCaps(16))
  124.         {
  125.         call close_adjoins;
  126.         SectorThrust(pickup1_s, up_v, 5);
  127.         }
  128.     return;
  129.     
  130.     print("entered");
  131.     // This routine handles setting up variables for when  the player (or potentially something else)
  132.     // enters a pickup zone. 
  133.     If (getsenderref()== pickup1_s) //if something entered pickup 1
  134.         {
  135.         //print("Sector 1:");
  136.         //printint(getsourceref());
  137.         cargo1_i = getsourceref();
  138.         }
  139.     if (tram_pickup == 1)
  140.         {
  141.         print("JAMZ");
  142.         //settimer(3);
  143.         }
  144.     
  145.     return;
  146.  
  147. exited:
  148.        //This routine handles clearing varibles that keep track of what's potential cargo. 
  149.     If (getsenderref()== pickup1_s)//if something exited pickup 1
  150.         {
  151.         if (cargo1_i == getsourceref()) 
  152.             {
  153.             cargo1_i = 0; //if it was potential cargo, then remove it
  154.             SectorThrust(pickup1_s, up_v, 0);
  155.             }
  156.         }
  157.         return;               
  158.  
  159. pickup1:
  160.     // This routine picks up the player (well, in therory anything)
  161.     // It was taken from Matt the Tat's tram cog. I modified it a little. -Doug
  162.     if (dwCheckDroidCaps(16))
  163.         {
  164.         print("pick me up!");
  165.         printint(achthing);
  166.         t_speed = 7.5;
  167.         hangoffset=('0,0,0');
  168.         cargot_i = achthing;
  169.         //    setsectorthrust(thrustsector, thrustvector, 0);
  170.         totalradius = GetThingRadius(achthing) + GetThingRadius(tram);
  171.         VectorSet(hangoffset, 0, 0, (-totalradius)- 0.5);
  172.         hangoffset = VectorSub(hangoffset, GetThingInsertOffset(achthing));
  173.         AttachThingToThingEx(achthing, tram, 8);
  174.         print("FREEZE!");
  175.         dwDisableJump();     
  176.         }
  177.     else
  178.         {
  179.         // Tell the player s/he's not magnetic.....
  180.         }
  181.     return;
  182.  
  183. dropoff1:
  184.     print("dropOFF:");
  185.     printint(cargot_i);
  186.     dwEnableJump();     
  187.     cargot_i = 0;        //empty out the cargo variable 
  188.     t_speed = 15;
  189.     //Sleep(2);   
  190.     in_tram = 0;
  191.     detachthing(achthing);
  192.     setthingvel(achthing, '0,0,0.5');
  193.     SectorThrust(pickup2_s, up_v, 3);
  194.     setpulse(3);
  195.     return;
  196.  
  197. arrived:
  198.    if (getsenderref() == tram)
  199.         {
  200.         if ((getcurframe(tram))==0)
  201.             {
  202.             moveframe = 1;
  203.             settimer(3);
  204.             } 
  205.         else if ((getcurframe(tram))==1)
  206.             {
  207.             SetSectorAdjoins(door1_s, 1);  //Turn on door adjoins
  208.             movetoframe(door1_o,1,door_speed);
  209.             movetoframe(tram,3,t_speed);
  210.             } 
  211.          else if ((getcurframe(tram))==3)
  212.             {
  213.             movetoframe(door1_o,0,door_speed);
  214.             movetoframe(tram,4,t_speed);
  215.             }
  216.          else if ((getcurframe(tram))==4)
  217.             {
  218.             SetSectorAdjoins(door2_s, 1);  //Turn on door adjoins
  219.             movetoframe(door2_o,1,door_speed);
  220.             movetoframe(tram,5,t_speed);
  221.             }
  222.          else if ((getcurframe(tram))==5)
  223.             {
  224.             movetoframe(door2_o,0,door_speed);  // Close door
  225.             movetoframe(tram,6,t_speed);
  226.             
  227.             }   
  228.          else if ((getcurframe(tram))==6)
  229.             {
  230.             SetSectorAdjoins(door3_s, 1);  //Turn on door adjoins
  231.             movetoframe(door3_o,1,door_speed);
  232.             movetoframe(tram,8,t_speed);
  233.             } 
  234.          else if ((getcurframe(tram))==8)
  235.             {
  236.             movetoframe(door3_o,0,door_speed);  // Close door
  237.             movetoframe(tram,9,t_speed);
  238.             }
  239.          else if ((getcurframe(tram))==9)
  240.             {
  241.             SetSectorAdjoins(door4_s, 1);  //Turn on door adjoins
  242.             movetoframe(door4_o,1,door_speed);
  243.             movetoframe(tram,10,t_speed);
  244.             } 
  245.          else if ((getcurframe(tram))==10)
  246.             {
  247.             movetoframe(door4_o,0,door_speed);  // Close door
  248.             movetoframe(tram,12,t_speed);
  249.             }
  250.          else if ((getcurframe(tram))==12)
  251.             {
  252.             call dropoff1;
  253.             moveframe = 13;
  254.             settimer(3);
  255.             }
  256.         }
  257.     else if (getsenderref() == door1_o) //if it's door 1 
  258.         {
  259.         if (getcurframe(door1_o) == 0) SetSectorAdjoins(door1_s, 0);  //Turn off door adjoins
  260.         }
  261.     else if (getsenderref() == door2_o) 
  262.         {                                            
  263.         if (getcurframe(door2_o) == 0) SetSectorAdjoins(door2_s, 0);  //Turn off door adjoins
  264.         }
  265.     else if (getsenderref() == door3_o)                            
  266.         {                                            
  267.         if (getcurframe(door3_o) == 0) SetSectorAdjoins(door3_s, 0);  //Turn off door adjoins
  268.         }
  269.     else if (getsenderref() == door4_o)                            
  270.         {                                            
  271.         if (getcurframe(door4_o) == 0) SetSectorAdjoins(door4_s, 0);  //Turn off door adjoins
  272.         }
  273.     else if (getsenderref() == door5_o)                            
  274.         {                                            
  275.         if (getcurframe(door5_o) == 0) SetSectorAdjoins(door5_s, 0);  //Turn off door adjoins
  276.         }
  277.     else if (getsenderref() == door6_o)                            
  278.         {                                            
  279.         if (getcurframe(door6_o) == 0) SetSectorAdjoins(door6_s, 0);  //Turn off door adjoins
  280.         }
  281.     
  282.     return;
  283. timer:
  284.     // this routine is used to control the movement of the tram after it's waited at 
  285.     // the stop for a settimer() amount of ti
  286.     print("I pity the fool");
  287.     tram_pickup = 0;
  288.     movetoframe(tram,moveframe,t_speed);
  289.     return;
  290.  
  291. pulse:
  292.     SectorThrust(pickup2_s, up_v, 0);
  293.     setpulse(0);
  294.     return;
  295.  
  296. open_adjoins:
  297.      print("clearing flags");
  298.      setadjoinflags(tram1block1, 2);
  299.      setadjoinflags(tram1block2, 2);
  300.      setadjoinflags(tram1block3, 2);
  301.      setadjoinflags(tram1block4, 2);
  302.      return;
  303.      
  304. close_adjoins:
  305.      print("setting flags");
  306.      clearadjoinflags(tram1block1, 2);
  307.      clearadjoinflags(tram1block2, 2);
  308.      clearadjoinflags(tram1block3, 2);
  309.      clearadjoinflags(tram1block4, 2);
  310.      return;
  311.  
  312.  
  313. end
  314.