home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Classic Fond 52
/
ClassicFond52.iso
/
GAMES
/
DROIDW.RAR
/
DWCD.GOB
/
mission_cog_d0_tgonktalk.cog
< prev
next >
Wrap
Text File
|
1998-11-04
|
7KB
|
259 lines
#-----------------------------------------------------------------------------
# Droidworks
# Sample cog for a simple conversation with Bob.
#-----------------------------------------------------------------------------
symbols
message converse
message startup
message user1
message arrived
message user2
message user3
message activate
message pulse
cog fulcrumcog
thing Gonk
thing player local
int MetGonk=0 local
int ConversationActive=0 local
int gonkcurframe=0 local
int ResponseID local
thing gGhost1
thing gGhost2
thing gGhost3
thing gGhost4
thing gGhost5
thing gGhost6
thing gGhost7
thing gGhost8
vector target local
end
code
startup:
gonkisresetting=0;
hastalked=0;
gonkspeed=2.0;
AISetMoveSpeed(gonk, gonkspeed);
AISetLookFrame(gonk, 1);
AISetMoveFrame(gonk, 1);
gonkcurframe=1;
helpful=0;
target=gpos1;
gPos1=getthingpos(gGhost1);
gPos2=getthingpos(gGhost2);
gPos3=getthingpos(gGhost3);
gPos4=getthingpos(gGhost4);
gPos5=getthingpos(gGhost5);
gPos6=getthingpos(gGhost6);
gPos7=getthingpos(gGhost7);
gPos8=getthingpos(gGhost8);
return;
user1:
if (hastalked==0) return;
else {
AISetMoveSpeed(gonk, gonkspeed);
AISetLookFrame(gonk, 1);
AISetMoveFrame(gonk, 1);
}
return;
converse:
dwPlayPlayerResponse();
ResponseID = dwGetPlayerResponse();
if (ResponseID == 0 && !ConversationActive) {
ConversationActive = 1;
playsong(0,0,0);
dwfreezeplayer();
if (Metgonk) {
dwPlayCharacterSpeech("GKC250", "T6GK005.wav");
if (gonkcurframe==1) dwAddResponse(10, "GKP250", "T6xx004.wav", 10);
dwAddResponse(20, "GKP020", "t6xx007.wav", 72); # Where is Jabba?
}
else {
dwPlayCharacterSpeech("GKC200", "T6GK001.wav");
dwAddResponse(1, "GKP200", "T6xx001.wav", 10);
dwAddResponse(20, "GKP020", "t6xx007.wav", 72); # Where is Jabba?
}
dwAddResponse(3, "GKP230", "", 20); # Goodbye.
}
else if (ResponseID == 1)
{
dwPlayCharacterSpeech("GKC210", "T6GK002.wav");
dwAddResponse(4, "GKP210", "t6xx002.wav", 60);
}
else if (ResponseID == 4)
{
# dwSetDialogText("GKC230"); # gonk: I'll go stand on that thing.
dwPlayCharacterSpeech("GKC230", "T6GK003.wav");
helpful=1;
dwAddResponse(3, "GKP230", "", 20);
}
else if (ResponseID == 10)
{
dwPlayCharacterSpeech("GKC260", "T6GK006.wav");
helpful=1;
dwAddResponse(3, "GKP240", "t6xx003.wav", 30);
}
else if (ResponseID == 20)
{
dwplaycharacterspeech("GKC020", "t6gk010.wav"); # gonk: I'll go stand on that thing.
dwAddResponse(100, "GKP002", "t6xx006.wav", 60);
helpful=0;
}
else if (ResponseID == 100)
{
dwplaycharacterspeech("GKC002", "t6gk009.wav"); # gonk: Hello again!
if ( (gonkcurframe==1)&&(metgonk==0) ) dwAddResponse(4, "GKP210", "T6xx002.wav", 60);
else if ( (gonkcurframe==1)&&(metgonk==1) ) dwAddResponse(10, "GKP250", "T6xx004.wav", 60);
dwAddResponse(20, "GKP020", "t6xx007.wav", 72); # Where is Jabba?
dwAddResponse(3, "GKP040", "", 20); # Goodbye.
}
else if (ResponseID == 3)
{
#PLAYER: Gotta go!
# Terminate the conversation
dwClearDialog();
ConversationActive=0;
ShuffleTracks(2, 3, 4, 5);
dwUnfreezeplayer();
if (helpful==1) {
helpful=0;
gonkcurframe=0;
call gonkhelpsout;
}
}
return;
//gonkhelpsout:
// met=1;
// AIclearmode(0xffff);
// print("gonk helps out");
// gonkcurframe=2;
// return;
arrived:
if (gonkcurframe==2) {
if (gonkisresetting==1) {
gonkisresetting=0;
sendmessage(fulcrumcog, user2);
}
else {
AISetMoveSpeed(gonk, gonkspeed);
AISetLookFrame(gonk, 3);
AISetMoveFrame(gonk, 3);
gonkcurframe=3;
}
}
else if (gonkcurframe==3) {
AISetMoveSpeed(gonk, gonkspeed);
AISetLookFrame(gonk, 4);
AISetMoveFrame(gonk, 4);
gonkcurframe=4;
}
else if (gonkcurframe==4) {
AISetMoveSpeed(gonk, gonkspeed);
AISetLookFrame(gonk, 5);
AISetMoveFrame(gonk, 5);
gonkcurframe=5;
}
else if (gonkcurframe==5) {
AISetMoveSpeed(gonk, gonkspeed);
AISetLookFrame(gonk, 6);
AISetMoveFrame(gonk, 6);
gonkcurframe=6;
}
else if (gonkcurframe==6) {
AISetMoveSpeed(gonk, gonkspeed);
AISetLookFrame(gonk, 7);
AISetMoveFrame(gonk, 7);
gonkcurframe=7;
}
else if (gonkcurframe==7) {
AISetMoveSpeed(gonk, gonkspeed);
AISetLookFrame(gonk, 8);
AISetMoveFrame(gonk, 8);
gonkcurframe=8;
sendmessage(fulcrumcog, user0);
}
return;
user2:
print("here I go!");
AISetMoveSpeed(gonk, gonkspeed);
AISetLookFrame(gonk, 9);
AISetMoveFrame(gonk, 9);
gonkcurframe=9;
return;
user3:
gonkisresetting=1;
gonkcurframe=0;
call gonkhelpsout;
setthingmass(gonk, 150);
return;
pulse:
if (vectordist(getthingpos(gonk), target) < .1) {
setpulse(0);
if (gonkcurframe==8) {
print("GONK IS HERE, BABEEE!!!");
sendmessage(fulcrumcog, user0);
}
else if ( (gonkcurframe==1)&&(gonkisresetting==1) ) {
setthingmass(gonk, 0);
print("I'm back, son.");
sendmessage(fulcrumcog, user2);
gonkisresetting=0;
}
else {
call gonkhelpsout;
}
}
return;
gonkhelpsout:
metgonk=1;
if (gonkcurframe==8) return;
setpulse(0.01);
AIclearmode(0xffff);
print("gonk helps out");
if (gonkcurframe==0) target=gpos1;
else if (gonkcurframe==1) target=gpos2;
else if (gonkcurframe==2) target=gpos3;
else if (gonkcurframe==3) target=gpos4;
else if (gonkcurframe==4) target=gpos5;
else if (gonkcurframe==5) target=gpos6;
else if (gonkcurframe==6) target=gpos7;
else if (gonkcurframe==7) target=gpos8;
AISetMoveSpeed(gonk, 1.5);
AISetLookPos(gonk, target);
AISetMovePos(gonk, target);
gonkcurframe=gonkcurframe+1;
print("now gonk wants to go to frame");
printint(gonkcurframe);
return;
end