home *** CD-ROM | disk | FTP | other *** search
- #-----------------------------------------------------------------------------
- # Droidworks
- # Sample cog for a simple conversation with Bob.
- #-----------------------------------------------------------------------------
-
- symbols
- message converse
- message startup
- message timer
- message pulse
- message activate
-
- cog R52acog
-
- sector stopsector
-
- thing Gonk
- thing player local
-
- int MetGonk=0 local
- int ConversationActive=0 local
- int gonkcurframe=0 local
- int ResponseID local
- int wait_time=2 local
- end
-
-
- code
- startup:
- player=getlocalplayerthing();
- hastalked=0;
- return;
-
- converse:
- dwplayplayerresponse();
- ResponseID = dwGetPlayerResponse();
- if (ResponseID == 0 && !ConversationActive)
- {
- ConversationActive = 1;
- playsong(0,0,0);
- dwfreezeplayer();
- dwplaycharacterspeech("R5C003", "t6bd001.wav"); # gonk: Hi, my name's Gonk.
- if (gonkftf==0) dwAddResponse(1, "R5P100", "t6xx012.wav", 72); # What are you doing here?
- dwAddResponse(20, "R5P102", "t6xx013.wav", 73); # Can you tell me how to find the hidden droid factory?
- dwAddResponse(30, "R5P104", "t6xx014.wav", 71); # Nice Weather
- dwAddResponse(40, "R5P106", "", 20); # Goodbye.
- }
-
- else if (ResponseID == 1)
- {
- dwplaycharacterspeech("R5C100", "t6bd002.wav"); # gonk: I'll go stand on that thing.
- dwAddResponse(200, "R5P200", "t6xx015.wav", 40);
- }
- else if (ResponseID == 10)
- {
- dwplaycharacterspeech("R5C999", "t6bd005.wav"); # gonk: Hello again!
- if (gonkftf==0) dwaddResponse(1, "R5P100", "t6xx012.wav", 72);
- dwAddResponse(20, "R5P102", "t6xx013.wav", 73); # Where is Jabba?
- dwAddResponse(30, "R5P104", "t6xx014.wav", 71); # Why are you here?
- dwAddResponse(40, "R5P106", "", 20); # Goodbye.
- }
- else if (ResponseID == 20)
- {
- if (gonkftf!=3) gonkftf=0;
- dwplaycharacterspeech("R5C102", "t6bd003.wav"); # gonk: I'll go stand on that thing.
- dwAddResponse(10, "R5P002", "m1xx003.wav", 60);
- }
- else if (ResponseID == 30)
- {
- if (gonkftf!=3) gonkftf=0;
- dwplaycharacterspeech("R5C104", "t6bd004.wav"); # gonk: I'll go stand on that thing.
- dwAddResponse(10, "R5P002", "m1xx003.wav", 60);
- }
- else if (ResponseID == 40)
- {
- dwplaycharacterspeech("R5C001", "t6bd006.wav");
- dwcleardialog();
- ConversationActive=0;
- shuffletracks(2, 3, 4, 5);
- dwunfreezeplayer();
- if (gonkftf==1) call gonkftf;
- }
- else if (ResponseID == 200) {
- dwplaycharacterspeech("R5C200", "t6bd007.wav");
- dwAddResponse(1000, "R5P220", "t6xx016.wav", 30);
- gonkftf=1;
- }
- else if (ResponseID == 1000)
- {
- dwplaycharacterspeech("R5C220", "t6bd008.wav");
- dwcleardialog();
- ConversationActive=0;
- shuffletracks(2, 3, 4, 5);
- dwunfreezeplayer();
- if (gonkftf==1) call gonkftf;
- }
-
-
- return;
-
- timer:
- gonkftf:
- print("gonkftf");
- gonkftf=3;
- playerpos=getthingpos(player);
- gonkpos=getthingpos(gonk);
- targetpos=getthingpos(player);
- GPdist=vectordist(gonkpos, targetpos);
- if (GPdist<.25) {
- settimer(4);
- return;
- }
- AISetMoveSpeed(gonk, 1.5);
- AISetMovePos(gonk, playerpos);
- AISetLookPos(gonk, playerpos);
- setpulse(0.25);
- settimer(4);
- return;
-
-
-
- pulse:
- gonkpos=getthingpos(gonk);
- targetpos=getthingpos(player);
- GPdist=vectordist(gonkpos, targetpos);
- printflex(GPdist);
- if (getthingsector(gonk)==stopsector) {
- setpulse(0);
- settimer(0);
- print("stop!");
- sendmessage(R52acog, user0);
- }
- if (gpdist<.25) {
- setpulse(0);
- kludgepos=getthingpos(gonk);
- AIsetmovepos(kludgepos);
- AISetMoveSpeed(gonk, 0.0);
- stopthing(gonk);
- }
- return;
-
-
-
-
-
-
-
-
-
- end
-
-
-