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

  1. #-----------------------------------------------------------------------------
  2. #  Droidworks
  3. #  Sample cog for a simple conversation with Bob.
  4. #-----------------------------------------------------------------------------
  5.  
  6. symbols
  7.     message        converse
  8.      message        startup
  9.      message        arrived
  10.      message        user2
  11.      message        user3
  12.      message        timer
  13.      message        pulse
  14.  
  15.     thing        Gonk
  16.      thing          player                   local
  17.  
  18.     int            MetGonk=0                local
  19.     int            ConversationActive=0     local
  20.      int            gonkcurframe=0           local
  21.     int            ResponseID              local
  22.      int            wait_time=2              local
  23.      
  24.      cog            fulcrumcog
  25.      sector         ts1
  26.      sector         ts2
  27.      vector         thrustvector
  28.      vector         target                   local     
  29.      thing          gGhost1
  30.      thing          gGhost2
  31.      thing          gGhost3
  32.      thing          gGhost4
  33.      thing          gGhost5
  34.      thing          gGhost6
  35.      thing          gGhost7
  36.      thing          gGhost8
  37.  
  38. end
  39.  
  40.  
  41. code
  42. startup:
  43.      gonkisresetting=0;
  44.     player=getlocalplayerthing();     
  45.      gonkcurframe=1;
  46.      gonkspeed=2.0;     
  47.     AISetLookFrame(gonk, 1);
  48.     AISetMoveFrame(gonk, 1);
  49.      AISetMoveSpeed(gonk, gonkspeed);
  50. //     if (getdifficulty()==1) settimer(4);
  51.      hastalked=0;
  52.      target=gpos1;
  53.      gPos1=getthingpos(gGhost1);
  54.      gPos2=getthingpos(gGhost2);
  55.      gPos3=getthingpos(gGhost3);
  56.      gPos4=getthingpos(gGhost4);
  57.      gPos5=getthingpos(gGhost5);
  58.      gPos6=getthingpos(gGhost6);
  59.      gPos7=getthingpos(gGhost7);
  60.      gPos8=getthingpos(gGhost8);
  61.      setactorflags(Gonk, 8);
  62.      
  63.      
  64.      return;
  65.  
  66. timer:
  67.      setthingmass(gonk, 150);
  68.      setsectorthrust(ts1, thrustvector, 4);           
  69.      setsectorthrust(ts2, thrustvector, 4); 
  70.      return;     
  71.  
  72. converse:
  73.     # What response did the player select?
  74.      dwplayplayerresponse();
  75.     ResponseID = dwGetPlayerResponse();
  76.  
  77.     
  78.      if (ResponseID == 0 && !ConversationActive)
  79.     {
  80.         ConversationActive = 1;
  81.           playsong(0,0,0);
  82.           dwfreezeplayer();
  83.           if (Metgonk)
  84.         {
  85.                dwplaycharacterspeech("GKC002", "t6gk009.wav");        # gonk: Hello again!                               
  86.                if (gonkcurframe==1) dwAddResponse(1, "GKP070", "M1xx040.wav", 60);        # Help me, Gonk!
  87.                dwAddResponse(20, "GKP020", "t6xx007.wav", 72);       # Where is Jabba?
  88.                dwAddResponse(40, "GKP040", "", 20);       # Goodbye.
  89.              }
  90.         else
  91.         {
  92.                dwplaycharacterspeech("GKC000", "t6gk007.wav");        # gonk: Hi, my name's Gonk.
  93.                # TODO: Play and wait for the appropriate wave
  94.                dwAddResponse(1, "GKP070", "M1xx040.wav", 60);        # Help me, Gonk!
  95.                dwAddResponse(20, "GKP020", "t6xx007.wav", 72);       # Where is Jabba?
  96.                dwAddResponse(40, "GKP040", "", 20);       # Goodbye.
  97.                Metgonk = 1;
  98.         }
  99.     }
  100.     
  101.      else if (ResponseID == 1)
  102.     {
  103.         dwplaycharacterspeech("GKC001", "t6gk008.wav");        # gonk: I'll go stand on that thing.
  104.           dwAddResponse(50, "GKP050", "t6xx010.wav", 60);
  105.     }
  106.      else if (ResponseID == 10)
  107.     {
  108.           dwplaycharacterspeech("GKC002", "t6gk009.wav");        # gonk: Hello again!
  109.           if (gonkcurframe==1) dwAddResponse(1, "GKP070", "M1xx040.wav", 71);       # Where is Jabba?
  110.           dwAddResponse(20, "GKP020", "t6xx007.wav", 72);
  111.           dwAddResponse(40, "GKP040", "", 20);       # Goodbye.
  112.      }
  113.      else if (ResponseID == 20)
  114.     {
  115.         dwplaycharacterspeech("GKC020", "t6gk010.wav");        # gonk: I'll go stand on that thing.
  116.           dwAddResponse(10, "GKP002", "t6xx006.wav", 60);
  117.           gonkftf=0;
  118.     }
  119.      else if (ResponseID == 40)
  120.     {
  121.           dwplaycharacterspeech("GKC040", "t6gk012.wav");
  122.           dwcleardialog();
  123.           conversationactive=0;
  124.           shuffletracks(2, 3, 4, 5);
  125.           dwunfreezeplayer();
  126.      }
  127.      else if (ResponseID == 50)
  128.     {
  129.         dwplaycharacterspeech("GKC230", "t6gk003.wav");        # gonk: I'll go stand on that thing.
  130.           dwAddResponse(7, "GKP060", "t6xx011.wav", 30);
  131.           gonkftf=1;
  132.     }
  133.      
  134.      
  135.      else if (ResponseID == 7)
  136.     {
  137.            
  138.           dwplaycharacterspeech("GKC100", "t6gk013.wav");
  139.         #PLAYER: Gotta go!
  140.            
  141.           dwcleardialog();         
  142.         # Terminate the conversation
  143.         ConversationActive=0;
  144.           shuffletracks(2, 3, 4, 5);
  145.         # Enable the player
  146.         dwunfreezeplayer();
  147.           if (gonkftf==1) {    
  148.                gonkftf=0;
  149.                gonkcurframe=0;
  150.                call gonkhelpsout;       
  151.           }      
  152.     }   
  153.     return;
  154.      
  155. //gonkhelpsout:
  156. //     AIclearmode(0xffff);
  157. //     print("gonk helps out");
  158. //     gonkcurframe=2;
  159. //     return;
  160.      
  161.  
  162. #arrived:
  163.      printint(gonkcurframe);
  164.      if (gonkcurframe==1) {
  165.           sendmessage(fulcrumcog, user5);
  166.           setthingmass(gonk, 0);
  167.          setsectorthrust(ts1, thrustvector, 0);           
  168.           setsectorthrust(ts2, thrustvector, 0);
  169.     }   
  170.      if (gonkcurframe==2) {          
  171.           if (gonkisresetting==1) {           
  172.                print("I just jumped off the fulcrum and gir=");
  173.                printint(gonkisresetting);
  174.                gonkisresetting=0;
  175.                sendmessage(fulcrumcog, user2);               
  176.          }
  177.           else {
  178.                print("moving on like i'm supposed to.");
  179.                AISetMoveSpeed(gonk, gonkspeed);
  180.               AISetLookFrame(gonk, 3);
  181.               AISetMoveFrame(gonk, 3);
  182.                gonkcurframe=3;
  183.           }
  184.      }
  185.      else if (gonkcurframe==3) {
  186.           print("here I am at frame 3");
  187.           AISetMoveSpeed(gonk, gonkspeed);
  188.      AISetLookFrame(gonk, 4);
  189.          AISetMoveFrame(gonk, 4);
  190.           gonkcurframe=4;
  191.      }
  192.     else if (gonkcurframe==4) {
  193.           AISetMoveSpeed(gonk, gonkspeed);
  194.          AISetLookFrame(gonk, 5);
  195.      AISetMoveFrame(gonk, 5);
  196.           gonkcurframe=5;
  197.      }
  198.      else if (gonkcurframe==5) {
  199.          AISetMoveSpeed(gonk, gonkspeed);
  200.          AISetLookFrame(gonk, 6);
  201.          AISetMoveFrame(gonk, 6);
  202.           gonkcurframe=6;
  203.      }
  204.     else if (gonkcurframe==6) {
  205.           AISetMoveSpeed(gonk, gonkspeed);
  206.          AISetLookFrame(gonk, 7);
  207.          AISetMoveFrame(gonk, 7);
  208.           gonkcurframe=7;
  209.      }
  210.      else if (gonkcurframe==7) {
  211.           AISetMoveSpeed(gonk, gonkspeed);
  212.      AISetLookFrame(gonk, 8);
  213.          AISetMoveFrame(gonk, 8);
  214.           gonkcurframe=8;
  215.           sendmessage(fulcrumcog, user0);
  216.      }     
  217.  
  218.      return;
  219.      
  220.      
  221. user2:
  222.      print("Medium gonk is going!");
  223.      AISetMoveSpeed(gonk, gonkspeed);
  224.      AISetLookFrame(gonk, 9);
  225.      AISetMoveFrame(gonk, 9);
  226.      gonkcurframe=9;
  227.      return;
  228.        
  229. user3:
  230.      print("gt2 user3 received");    
  231.      gonkisresetting=1;
  232.      gonkcurframe=0;
  233.      setthingmass(gonk, 150);
  234.      call gonkhelpsout;     
  235.      return;
  236.      
  237.      
  238. pulse:
  239.      if (vectordist(getthingpos(gonk), target) < .1) {
  240.           setpulse(0);
  241.           if (gonkcurframe==8) {
  242.                print("GONK IS HERE, BABEEE!!!");
  243.                sendmessage(fulcrumcog, user0);          
  244.           }
  245.           else if ( (gonkcurframe==1)&&(gonkisresetting==1) )  {
  246.                setthingmass(gonk, 0);
  247.                print("I'm back, son.");
  248.                sendmessage(fulcrumcog, user2);
  249.                gonkisresetting=0;
  250.           }
  251.           else {          
  252.                call gonkhelpsout;
  253.           }        
  254.      }
  255.      return;
  256.  
  257. gonkhelpsout:     
  258.      setsectorthrust(ts1, thrustvector, 0);           
  259.      setsectorthrust(ts2, thrustvector, 0);
  260.      if (gonkcurframe==8) return;
  261.      setpulse(0.01);
  262.      AIclearmode(0xffff);
  263.      print("gonk helps out");     
  264.      if (gonkcurframe==0) target=gpos1;
  265.      else if (gonkcurframe==1) target=gpos2;
  266.      else if (gonkcurframe==2) target=gpos3;
  267.      else if (gonkcurframe==3) target=gpos4;
  268.      else if (gonkcurframe==4) target=gpos5;
  269.      else if (gonkcurframe==5) target=gpos6;
  270.      else if (gonkcurframe==6) target=gpos7;
  271.      else if (gonkcurframe==7) target=gpos8;
  272.      AISetMoveSpeed(gonk, 1.5);
  273.      AISetLookPos(gonk, target);
  274.      AISetMovePos(gonk, target);     
  275.      gonkcurframe=gonkcurframe+1;
  276.      print("now gonk wants to go to frame");
  277.      printint(gonkcurframe);
  278.      return;
  279.  
  280.  
  281.  
  282.     
  283.      
  284.  
  285.      
  286.      
  287.           
  288.  
  289.      
  290.      
  291. end
  292.  
  293.  
  294.