home *** CD-ROM | disk | FTP | other *** search
- #
- # b0_mazeDroid.cog
- #
- # CommuniCog for the Droid in the Dark Maze.
- #
- # Desc:
- # He's a droid, yes, and he's a talkin' like a [insert talky thing here]
- #
- # 12/23/97 DGS Created.
- #-----------------------------------------------------------------------------
-
- symbols
- message converse
- message startup
- message user1
- message arrived
- message timer
- message pulse
- sector stopsector
- thing Gonk
- thing player local
-
- int Met=0 local
- int Joke=0 local
- int spoken_1=0 local
- int gears=0 local
- int ConversationActive=0 local
- int gonkcurframe=0 local
- int ResponseID local
- int getit=0 local
- int bye=0 local
- int turnoff=0 local
- sound goalsound=00tAccomplish.wav local
- flex wait_time=1.3 local
- end
-
-
- code
- startup:
- setthingmass(gonk,100);
- hastalked = 0;
- return;
-
- converse:
- // What response did the player select?
- ResponseID = dwGetPlayerResponse();
- print("Converse");
- if (getit==1) return;
-
- if (ResponseID == 0 && !ConversationActive)
- {
- ConversationActive = 1;
- playsong(0,0,0);
- dwfreezeplayer();
- ResponseID = 1;
- }
-
- if (ResponseID == 1) #beginning Node
- {
- //+++++++++++++++++++++++++++++++++++++++++++++++ Greetings setup
- if (met == 0) // If they haven't met.
- {
- //dwSetDialogText("STC000"); // Droid: Are you ever a site for sore sensors
- dwplaycharacterspeech("STC000","T8TD001.wav");
-
- met = 2; // Tell him to say "anything else?"
- }
- else if (met == 1)
- {
- //dwSetDialogText("STC001"); // Droid: Hello again
- dwplaycharacterspeech("STC001","T8TD002.wav");
- met = 2; // Tell him to say "anything else?"
- }
- else if (met == 2)
- {
- dwplayplayerresponse();
- //dwSetDialogText("STC003"); // Droid: ..And?
- dwplaycharacterspeech("STC003","T8TD004.wav");
- }
- else if (met == 3)
- {
- dwplayplayerresponse();
- //dwSetDialogText("STC004"); // Droid: That's more than I can say...And?
- dwplaycharacterspeech("STC004","T8TD005.wav");
- met = 2;
- }
- //+++++++++++++++++++++++++++++++++++++++++++++++ END Greetings setup
- dwAddResponse(100, "STP100","T6xx012.wav",71); //Player: What are you doing here?
- dwAddResponse(200, "STP200","T8xx005.wav",71); //Player: How do I get out of here?
- dwAddResponse(300, "STP300","T8xx006.wav",71); //Player: Are you afraid of the dark?
- if (follow == 0) dwAddResponse(400, "STP400","T8xx007.wav",70); //Player: I'm here to rescue you...
- else dwAddResponse(600, "STP600","T8xx013.wav",70); //Player: Follow Me, I know a way...
- if (follow == 0) dwAddResponse(500, "STP500","IDxx222.wav",20); //player: Take it easy, I'm outta here
-
- }
-
- if (ResponseID == 100)
- {
- dwplayplayerresponse();
- //dwSetDialogText("STC100"); // Droid: I got lost during a test run....
- dwplaycharacterspeech("STC100","T8TD007.wav");
- met = 3;
- dwAddResponse(1,"STP003","T8xx003.wav",60); //: Ah, I see. (send it back to the root node)
- }
- if (ResponseID == 200) // How do I get outta here?
- {
- dwplayplayerresponse();
- //dwSetDialogText("STC200"); // Droid: Beats me.
- dwplaycharacterspeech("STC200","T8TD009.wav");
- dwAddResponse(1,"STP002","T3xx002.wav",60); // Player: Thanks. (send it back to the root node)
- }
- if (ResponseID == 300) // Are you afraid of the dark?
- {
- dwplayplayerresponse();
- //dwSetDialogText("STC300"); // Droid: Me? Nah.
- dwplaycharacterspeech("STC300","T8TD010.wav");
- dwAddResponse(302, "STP302","T8xx008.wav",71); //player: Tell me about the Assassins.
- dwAddResponse(1 , "STP001","T1xx014.wav",72); // player: Thanks. (send it back to the root node)
- }
- if (ResponseID == 302) // Tell me about these assassins
- {
- dwplayplayerresponse();
- //dwSetDialogText("STC302"); // Droid: They're tough
- dwplaycharacterspeech("STC302","T8TD012.wav");
- dwAddResponse(303, "STP303","T8xx009.wav",72); //player: So, you know about the factory, eh?
- dwAddResponse(1, "STP001","T1xx014.wav",30); // player: Thanks. (send it back to the root node)
- }
- if (ResponseID == 303) // SO, you know about that faxtory?
- {
- dwplayplayerresponse();
- //dwSetDialogText("STC303"); // Droid: Hey, If I did, etc, etc.
- dwplaycharacterspeech("STC303","T8TD013.wav");
- dwAddResponse(1,"STP001","T1xx014.wav",30); // player: Thanks. (send it back to the root node)
- }
- if (ResponseID == 400) // I'm here to rescue you....
- {
- dwplayplayerresponse();
- //dwSetDialogText("STC400"); // droid: Great! I needs a battery...
- dwplaycharacterspeech("STC400","T8TD011.wav");
- if ( (GetInv(getlocalplayerthing(), 16) > 0)|| (GetInv(getlocalplayerthing(), 17) > 0)|| (GetInv(getlocalplayerthing(), 18) > 0) ) //if battery inv bin is greater than 0
- {
- dwAddResponse(410,"STP410","T8xx010.wav",30); // player: Here's a battery.
- dwAddResponse(420,"STP420","T8xx011.wav",70); // player: let me think.
- }
- else dwAddResponse(430,"STP430","T8xx012.wav",40); // player: I don't have any.
- }
- if (ResponseID == 410) // Here's a battery
- {
- dwplayplayerresponse();
- //dwSetDialogText("STC410"); //Droid: Thanks!
- call gonkftf;
- dwplaycharacterspeech("STC410","T8TD014.wav");
- if (GetInv(getlocalplayerthing(), 16) > 0) ChangeInv(getlocalplayerthing(), 16, -1);// Remove the battery from the INV
- else if (GetInv(getlocalplayerthing(), 17) > 0) ChangeInv(getlocalplayerthing(), 17, -1);// Remove the battery from the INV
- else if (GetInv(getlocalplayerthing(), 18) > 0) ChangeInv(getlocalplayerthing(), 18, -1);// Remove the battery from the INV
- follow = 1;
- // ================================= INV management
- if (GetInv(getlocalplayerthing(), 16) == 0) SetInvAvailable(getlocalplayerthing(), 16, 0); // Remove the batt from the inv
- if (GetInv(getlocalplayerthing(), 17) == 0) SetInvAvailable(getlocalplayerthing(), 17, 0); // Remove the batt from the inv
- if (GetInv(getlocalplayerthing(), 18) == 0) SetInvAvailable(getlocalplayerthing(), 18, 0); // Remove the batt from the inv
-
- dwAddResponse(1,"STP002","T3xx002.wav",60); // PLayer: Thanks. (send it back to the root node)
- }
-
- if (ResponseID == 420) // Let me think about it.
- {
- dwplayplayerresponse();
- //dwSetDialogText("STC420"); // Droid: AH, Circuit Breakers!
- dwplaycharacterspeech("STC420","T8TD015.wav");
- dwAddResponse(1,"STP001","T1xx014.wav",60);// player: OKay ( it back to the root node)
- }
-
- if (ResponseID == 430) // Let me think about it.
- {
- dwplayplayerresponse();
- //dwSetDialogText("STC430"); // Droid: Sorry to hear that!
- dwplaycharacterspeech("STC430","T8TD016.wav");
- dwAddResponse(1,"STP001","T1xx014.wav",60); // player: OKay ( it back to the root node)
- }
-
- if (ResponseID == 600) // Follow me
- {
- dwplayplayerresponse();
- //dwSetDialogText("STC600"); // Droid: Okay, but don't go to far....
- dwplaycharacterspeech("STC601","T8TD017.wav");
- dwAddResponse(1,"STP001","T1xx014.wav",60); // player: OKay ( it back to the root node)
- dwcleardialog();
- ConversationActive = 0;
- ShuffleTracks(2, 3, 4, 5);
- dwunfreezeplayer();
- follow = 2;
- }
-
- if (ResponseID == 500) // # bye
- {
- dwplayplayerresponse();
- //dwSetDialogText("STC005"); //Complete goodbye
- dwplaycharacterspeech("STC005","T8TD006.wav");
- met = 1; //Reset the greeting so he'll say "Hello again" instead of "anything else?"
- dwcleardialog();
- ConversationActive = 0;
- ShuffleTracks(2, 3, 4, 5);
- dwunfreezeplayer();
- }
- return;
-
- timer:
- gonkftf:
- print("gonkftf");
- playerpos=getthingpos(player);
- AISetMoveSpeed(gonk, 2.0);
- AISetMovePos(gonk, playerpos);
- AISetLookPos(gonk, playerpos);
- setpulse(1);
- settimer(2);
- return;
-
-
-
- pulse:
- gonkpos=getthingpos(gonk);
- targetpos=getthingpos(player);
- GPdist=vectordist(gonkpos, targetpos);
- printflex(GPdist);
- if ((getthingsector(gonk)==stopsector) && (getit == 0))
- {
- garbage = playsoundlocal(goalsound,1.0,0.0,0);
- setInv(getlocalplayerthing(), 6, 1); // Goal !!!! ! ! !! ! !
- getit = 1;
- }
-
-
- if ((gpdist<.35) && (turnoff == 0))
- {
- settimer(0);
- turnoff = 1;
- }
- if ((gpdist>.35) && (turnoff == 1))
- {
- settimer(2);
- turnoff = 0;
- }
-
- return;
-
- arrived:
-
- return;
- end
-
-
-