home *** CD-ROM | disk | FTP | other *** search
/ Classic Fond 52 / ClassicFond52.iso / GAMES / DROIDW.RAR / DWCD.GOB / mission_cog_t6_r5talk.cog < prev    next >
Encoding:
Text File  |  1998-11-04  |  4.3 KB  |  153 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        timer
  10.      message        pulse
  11.      message        activate    
  12.  
  13.      cog            R52acog
  14.      
  15.      sector         stopsector
  16.  
  17.     thing        Gonk
  18.      thing          player                   local
  19.  
  20.     int            MetGonk=0                local
  21.     int            ConversationActive=0     local
  22.      int            gonkcurframe=0           local
  23.     int            ResponseID              local
  24.      int            wait_time=2              local
  25. end
  26.  
  27.  
  28. code
  29. startup:
  30.     player=getlocalplayerthing();
  31.      hastalked=0;
  32.      return;
  33.  
  34. converse:
  35.      dwplayplayerresponse();
  36.     ResponseID = dwGetPlayerResponse();
  37.      if (ResponseID == 0 && !ConversationActive)
  38.     {
  39.         ConversationActive = 1;
  40.           playsong(0,0,0);
  41.           dwfreezeplayer();
  42.                dwplaycharacterspeech("R5C003", "t6bd001.wav");        # gonk: Hi, my name's Gonk.
  43.                if (gonkftf==0) dwAddResponse(1, "R5P100", "t6xx012.wav", 72);        # What are you doing here?
  44.                dwAddResponse(20, "R5P102", "t6xx013.wav", 73);       # Can you tell me how to find the hidden droid factory?
  45.                dwAddResponse(30, "R5P104", "t6xx014.wav", 71);       # Nice Weather
  46.                dwAddResponse(40, "R5P106", "", 20);       # Goodbye.
  47.      }
  48.     
  49.      else if (ResponseID == 1)
  50.     {
  51.         dwplaycharacterspeech("R5C100", "t6bd002.wav");        # gonk: I'll go stand on that thing.
  52.           dwAddResponse(200, "R5P200", "t6xx015.wav", 40);
  53.     }
  54.      else if (ResponseID == 10)
  55.     {
  56.           dwplaycharacterspeech("R5C999", "t6bd005.wav");        # gonk: Hello again!
  57.           if (gonkftf==0) dwaddResponse(1,  "R5P100", "t6xx012.wav", 72);
  58.           dwAddResponse(20, "R5P102", "t6xx013.wav", 73);       # Where is Jabba?
  59.           dwAddResponse(30, "R5P104", "t6xx014.wav", 71);       # Why are you here?
  60.           dwAddResponse(40, "R5P106", "", 20);       # Goodbye.
  61.      }
  62.      else if (ResponseID == 20)
  63.     {
  64.           if (gonkftf!=3) gonkftf=0;
  65.         dwplaycharacterspeech("R5C102", "t6bd003.wav");        # gonk: I'll go stand on that thing.
  66.           dwAddResponse(10, "R5P002", "m1xx003.wav", 60);
  67.     }
  68.      else if (ResponseID == 30)
  69.     {
  70.           if (gonkftf!=3) gonkftf=0;
  71.         dwplaycharacterspeech("R5C104", "t6bd004.wav");        # gonk: I'll go stand on that thing.
  72.           dwAddResponse(10, "R5P002", "m1xx003.wav", 60);
  73.      }
  74.      else if (ResponseID == 40)
  75.     {
  76.           dwplaycharacterspeech("R5C001", "t6bd006.wav");
  77.           dwcleardialog();
  78.         ConversationActive=0;
  79.           shuffletracks(2, 3, 4, 5);
  80.           dwunfreezeplayer();
  81.           if (gonkftf==1) call gonkftf;
  82.      }
  83.      else if (ResponseID == 200) {
  84.          dwplaycharacterspeech("R5C200", "t6bd007.wav");
  85.           dwAddResponse(1000, "R5P220", "t6xx016.wav", 30);
  86.           gonkftf=1;
  87.      }
  88.      else if (ResponseID == 1000)
  89.     {
  90.           dwplaycharacterspeech("R5C220", "t6bd008.wav");
  91.           dwcleardialog();
  92.         ConversationActive=0;
  93.           shuffletracks(2, 3, 4, 5);
  94.         dwunfreezeplayer();
  95.           if (gonkftf==1) call gonkftf;
  96.      }
  97.  
  98.           
  99.      return;
  100.  
  101. timer:
  102. gonkftf:
  103.      print("gonkftf");
  104.      gonkftf=3;
  105.      playerpos=getthingpos(player);
  106.      gonkpos=getthingpos(gonk);
  107.      targetpos=getthingpos(player);
  108.      GPdist=vectordist(gonkpos, targetpos);
  109.      if (GPdist<.25) {
  110.           settimer(4);
  111.           return;
  112.      }
  113.      AISetMoveSpeed(gonk, 1.5);
  114.      AISetMovePos(gonk, playerpos);
  115.      AISetLookPos(gonk, playerpos);
  116.      setpulse(0.25);
  117.      settimer(4);
  118.      return;
  119.  
  120.  
  121.      
  122. pulse:
  123.      gonkpos=getthingpos(gonk);
  124.      targetpos=getthingpos(player);
  125.      GPdist=vectordist(gonkpos, targetpos);
  126.      printflex(GPdist);
  127.      if (getthingsector(gonk)==stopsector) {
  128.           setpulse(0);
  129.           settimer(0);
  130.           print("stop!");
  131.           sendmessage(R52acog, user0);    
  132.      }
  133.      if (gpdist<.25) {
  134.           setpulse(0);
  135.           kludgepos=getthingpos(gonk);
  136.           AIsetmovepos(kludgepos);
  137.           AISetMoveSpeed(gonk, 0.0);
  138.           stopthing(gonk);
  139.      }
  140.      return;
  141.     
  142.      
  143.  
  144.      
  145.      
  146.           
  147.  
  148.      
  149.      
  150. end
  151.  
  152.  
  153.