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

  1. # d_0 JawaTalk.cog
  2. #    
  3. # A simple communiCog ripped off from Doug
  4. #
  5. # Desc:
  6. #      Sucker Fool I stole it from Matt, I didn't even change
  7. #    The variable GONK.     - Love Ya, Doug
  8. #    
  9. #    Yeah, well I stole it back so bite me.  --Matt
  10. # 12/08/97 DGS    Stole from Matt's GonkTalk
  11. # 12/08/97 MST Stole back from Doug's JawaTalk
  12. #-----------------------------------------------------------------------------
  13.  
  14. symbols
  15.      message        converse
  16.      message       startup
  17.      message        arrived
  18.      message        pulse
  19.      message        timer
  20.      
  21.      thing        Gonk
  22.      thing          player                   local
  23.      thing          x2callcratedummy          
  24.      thing          x3angledummy
  25.      thing          x4launchdummy
  26.      
  27.      surface        block1
  28.      surface        block2
  29.      surface        block3
  30.      
  31.      int             Met=0                    local
  32.      int             spoken_1=0                local
  33.      int             ConversationActive=0     local
  34.      int              gonkcurframe=0           local
  35.      int             ResponseID              local
  36.      int            walkthatjawa=0           local
  37.      flex             wait_time=1.3             local
  38.      thing          teledest
  39. end
  40.  
  41.  
  42. code
  43. startup:
  44.      if (getdifficulty()==2) {
  45.           print("this is difficulty 2");
  46.           setfacegeomode(block1, 0);
  47.           setfacegeomode(block2, 0);
  48.           setfacegeomode(block3, 0);
  49.           teleportthing(gonk, teledest);          
  50.      }
  51.      settimer(3);
  52.      x2pos=getthingpos(x2callcratedummy);
  53.      x3pos=getthingpos(x3angledummy);
  54.      x4pos=getthingpos(x4launchdummy);
  55.      walkthatjawa=0;
  56.     hastalked=0;
  57. //     call walkthatjawa;
  58.      player=getlocalplayerthing();
  59.      return;     
  60.  
  61. converse:
  62.      dwplayplayerresponse();
  63.      playerpos=getthingpos(player);
  64.      settimer(0);
  65.      # What response did the player select?
  66.      ResponseID = dwGetPlayerResponse();
  67.      
  68.      
  69.      if (ResponseID == 0 && !ConversationActive) {
  70.           # Response 0 is reserved to indicate that a conversation is starting
  71.           ConversationActive = 1;   
  72.           PlaySong(0,0,0);          
  73.           dwfreezeplayer();        
  74.                ResponseID = 1;
  75.           }
  76.      
  77.      if (ResponseID == 1) {                 #beginning Node    
  78.           print("jawaiswalking=");
  79.           printint(jawaiswalking);
  80.           print("sentbyplayer=");
  81.           printint(sentbyplayer);     
  82.           if ((jawaiswalking==1)&&(sentbyplayer==1)) {
  83.                print("hold on!");
  84.                dwplaycharacterspeech("JR8", "t1jc012.wav");
  85.                dwcleardialog();
  86.                ConversationActive=0;
  87.                ShuffleTracks(2, 3, 4, 5);
  88.                dwunfreezeplayer();
  89.                //call walkthatjawa;
  90.           }
  91.           else if ((jawaiswalking==1)&&(sentbyplayer==0)) {               
  92.                jawaishere=getthingpos(gonk);
  93.                aisetmovepos(gonk, jawaishere);
  94.                aisetlookpos(gonk, playerpos);
  95.                target=jawaishere;
  96.                setpulse(1);
  97.                print("I'm guessing it would crash here");  
  98.                dwplaycharacterspeech("JR0", "t1jc001.wav");        # Hello droid.  May I help you?                       
  99.                dwAddResponse(100, "PDR1", "t1xx001.wav", 71);        // What do I do here?
  100.                dwAddResponse(700, "PDR7", "t1xx007.wav", 20);        // Goodbye.
  101.           }
  102.           else if ((met == 2)&&(sentbyplayer!=1)) {
  103.                print("meeting again.");
  104.                dwplaycharacterspeech("JR0A", "t1jc002.wav");        # Hello again, droid.  Do you have more questions?
  105.                dwAddResponse(100, "PDR1", "t1xx001.wav", 71);        // What do I do here?
  106.                dwAddResponse(700, "PDR7", "t1xx007.wav", 20);        // Goodbye.
  107.           }         
  108.           else if ((met ==0)&&(sentbyplayer!=1)) {
  109.                print("initial meeting");
  110.                dwplaycharacterspeech("JR0", "t1jc001.wav");        # Hello droid.  May I help you?                       
  111.                met = 2;
  112.                dwAddResponse(100, "PDR1", "t1xx001.wav", 71);        // What do I do here?
  113.                dwAddResponse(700, "PDR7", "t1xx007.wav", 20);        // Goodbye.
  114.           }
  115.           else if (sentbyplayer==1) {
  116.                sentbyplayer=0;
  117.                print("sent by player");
  118.                if (jawaisat<=2) {
  119.                     dwplaycharacterspeech("JR2", "t1jc006.wav");
  120.                     dwAddResponse(150, "JAP000", "t7xx001.wav", 60);
  121.                }
  122.                else if (jawaisat<=3) {
  123.                     dwplaycharacterspeech("JR3", "t1jc007.wav");
  124.                     dwAddResponse(150, "JAP000", "t7xx001.wav", 60);
  125.                }
  126.                else if (jawaisat<=4) {
  127.                     dwplaycharacterspeech("JR4", "t1jc008.wav");
  128.                     dwAddResponse(150, "JAP000", "t7xx001.wav", 60);
  129.                }
  130.                else if (jawaisat<=5) {
  131.                     print("i'm begging you.");
  132.                     setpulse(0);
  133.                     aisetlookpos(gonk ,getthingpos(player));
  134.                     aisetmode(gonk, 0x4);
  135.                     settimer(3);
  136.                }           
  137.           }                    
  138.           else  {
  139.                print("the catchall");
  140.                stopthing(jawa);
  141.                setpulse(0);
  142.                aisetmovepos(gonk, getthingpos(player));
  143.                aisetlookpos(gonk, getthingpos(player));
  144.                dwplaycharacterspeech("JR0", "t1jc001.wav");
  145.                dwAddResponse(100, "PDR1", "t1xx001.wav", 72);        // What do I do here?
  146.                dwAddResponse(700, "PDR7", "t1xx007.wav", 20);        // Goodbye.
  147.           } 
  148.      } 
  149.      if (ResponseID == 100)    //            # Security
  150.           {
  151.           dwplaycharacterspeech("JR1", "t1jc005.wav"); 
  152.           dwAddResponse(150, "JAP000", "t7xx001.wav", 60);           // Back to root node (ID 1);
  153.           }
  154.                 
  155.      if (ResponseID == 150) {
  156.                dwplaycharacterspeech("JR01", "t1jc003.wav");           // Do you have any questions?           
  157.                dwAddResponse(900, "PDR9", "t6xx012.wav", 72);       // What are you doing here?
  158.                dwAddresponse(200, "PDR2", "t1xx002.wav", 71);       // How do I call a crate?
  159.                dwAddResponse(300, "PDR3", "t1xx003.wav", 72);       // How do I adjust the angle?
  160.                dwAddResponse(400, "PDR4", "t1xx004.wav", 73);       // How do I launch a crate?
  161. //               dwAddResponse(500, "PDR5", "t1xx005.wav", 71);       // Why do you Jawas wear cloaks?
  162.                dwAddResponse(1000, "PDR10", "t1xx010.wav", 73);
  163.                dwAddResponse(700, "PDR6", "t1xx006.wav", 71);       // Goodbye
  164.           }        
  165.      if (ResponseID == 200) {    //            # How do I call a crate?     
  166.           if ((jawaisat>=2)&&(jawaisat>0)) {
  167.                dwplaycharacterspeech("JR02", "t1jc004.wav"); 
  168.                dwAddResponse(7, "JAP000", "t7xx001.wav", 60);        // Back to Root node (ID 1);   
  169.                jawawantstogoto=2;  
  170.                sentbyplayer=1;      
  171.           }
  172.           else {
  173.                dwplaycharacterspeech("JR2", "t1jc006.wav");
  174.                dwAddResponse(150, "JAP000", "t7xx001.wav", 60);
  175.           }
  176.      }
  177.      if (ResponseID == 300) {    //            # How do I adjust the angle?
  178.           if ((jawaisat>3)||(jawaisat<=2)) {
  179.                dwplaycharacterspeech("JR02", "t1jc004.wav"); 
  180.                dwAddResponse(7, "JAP000", "t7xx001.wav", 60);        // Back to Root node (ID 1);   
  181.                jawawantstogoto=3;
  182.                sentbyplayer=1;
  183.           }
  184.           else  {
  185.                dwplaycharacterspeech("JR3", "t1jc007.wav");
  186.                dwAddResponse(150, "JAP000", "t7xx001.wav", 60);
  187.           }
  188.      }
  189.      if (ResponseID == 400) {  //            # How do I launch crate?
  190.           if ((jawaisat>4)||(jawaisat<=3)) {
  191.                dwplaycharacterspeech("JR02", "t1jc004.wav");            
  192.                dwAddResponse(7, "JAP000", "t7xx001.wav", 60);        // Back to Root node (ID 1);   
  193.                jawawantstogoto=4;
  194.                sentbyplayer=1;
  195.           }
  196.           else  {
  197.                dwplaycharacterspeech("JR4", "t1jc008.wav");
  198.                dwAddResponse(150, "JAP000", "t7xx001.wav", 60);
  199.           }
  200.      }
  201.      if (ResponseID == 900) {
  202.           dwplaycharacterspeech("JR7", "t1jc011.wav");
  203.           dwAddResponse(150, "JAP000", "t7xx001.wav", 60);
  204.      }
  205.      if (ResponseID == 1000) {
  206.           dwplaycharacterspeech("JR9", "t1jc013.wav");
  207.           dwAddResponse(150, "JAP000", "t7xx001.wav", 60);
  208.      }
  209.      if (ResponseID == 500)    //            // Why wear cloaks?
  210.           {
  211.           dwplaycharacterspeech("JR5", "t1jc009.wav");            
  212.           dwAddResponse(150, "EDP024", "t1xx014.wav", 70);        // Back to Root node (ID 1);   
  213.           walkthatjawa=5;
  214.           }
  215.      if (ResponseID == 700)    //            # bye
  216.           {
  217.           #PLAYER: Gotta go!
  218.           # Terminate the conversation
  219.           dwplaycharacterspeech("JR6", "t1jc010.wav");
  220.           dwcleardialog();
  221.           ConversationActive=0;     
  222.           ShuffleTracks(2, 3, 4, 5);
  223.           # Enable the player
  224.           dwunfreezeplayer();
  225.           settimer(3);
  226.           }
  227.      if (ResponseID == 7)
  228.      {
  229.           #PLAYER: Gotta go!
  230.           # Terminate the conversation
  231.           dwcleardialog();
  232.           ConversationActive=0;     
  233.           ShuffleTracks(2, 3, 4, 5);
  234.           # Enable the player
  235.           dwunfreezeplayer();
  236.           call walkthatjawa;
  237.      }   
  238.      return;
  239.          
  240. walkthatjawa:
  241. //     print ("walk that jawa called");
  242.      if (ConversationActive==1) return;
  243.      
  244.      settimer(0);
  245.      aiclearmode(gonk, 0xa06);
  246.      aisetmovespeed(gonk, 0.7);
  247.      setpulse(1);
  248.      jawaiswalking=1;
  249.      if (jawawantstogoto<=2) {
  250.           aisetlookpos(gonk, x2pos);
  251.           aisetmovepos(gonk, x2pos);
  252.           target=x2pos;    
  253.          }
  254.      else if (jawawantstogoto<=3) {
  255.           aisetlookpos(gonk, x3pos);
  256.           aisetmovepos(gonk, x3pos);
  257.           target=x3pos;    
  258.           }
  259.      else if (jawawantstogoto<=4) {
  260.           aisetlookpos(gonk, x4pos);
  261.           aisetmovepos(gonk, x4pos); 
  262.           target=x4pos;   
  263.           }          
  264.      else if (jawawantstogoto<=5) {
  265.           setpulse(0);
  266.           aisetlookpos(gonk ,getthingpos(player));
  267.           aisetmode(gonk, 0x4);
  268.           settimer(3);
  269.      }    
  270.      return;     
  271.  
  272. pulse:
  273.      if (vectordist(getthingpos(gonk), target) < .25) {
  274.           setpulse(0);
  275.           sleep(1.5);
  276.           aisetlookpos(gonk ,getthingpos(player));
  277.           aisetmode(gonk, 0x4);
  278.           settimer(3);
  279.           jawaiswalking=0;
  280.           jawaisat=jawawantstogoto;
  281.           jawawantstogoto=0;
  282.      }
  283.      return;
  284.      
  285. timer:
  286.      xRandom=rand();
  287.      if (xRandom>=.5) {
  288.           aisetlookpos(gonk, getthingpos(player));
  289.           settimer(3);
  290.      }
  291.      else {
  292.           sentbyplayer=0;
  293. //          print("there he goes.");
  294.           jawawantstogoto=xRandom*10;
  295. //          printint(jawawantstogoto);
  296.           call walkthatjawa;
  297.      }     
  298.      return;
  299.  
  300. end
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.