Cutscene problem

Started by frobozz, Thu 17/04/2003 03:54:15

Previous topic - Next topic

frobozz

Hey all,

OK, here's the situation:  I've got a scene in my game's opening cinematic where two characters are talking while walking down a hallway.  Now, they're supposed to be walking WHILE talking (for sort of a West Wing-feel).  Now, this was what I was planning to do:

Code: ags

  // Cinematic 1 (con't)
MoveCharacter(EGO, 280,146);
MoveCharacter(FORSYTH, 259,148);
Wait(40);
DisplaySpeechBackground(EGO, "So why me?");
DisplaySpeechBackground(FORSYTH, "Sir, as the Duke Ambassador to Airital, the envoy falls under your command.");
DisplaySpeechBackground(EGO, "Then why doesn't anyone do what I say?");
DisplaySpeechBackground(EGO, "You're technically my butler, and you boss me around like a god.");
DisplaySpeechBackground(FORSYTH, "I merely give suggestions, Sir.");
DisplaySpeechBackground(FORSYTH, "And seeing as how you came to this position last week...");
DisplaySpeechBackground(FORSYTH, "...you should be wise to heed them.");
DisplaySpeechBackground(EGO, "So why don't you just do my job?");
DisplaySpeechBackground(EGO, "Or did I already ask that?");
DisplaySpeechBackground(FORSYTH, "Every day, Sir.  And the answer will always be the same.");
DisplaySpeechBackground(EGO, "Yeah, yeah.");
DisplaySpeechBackground(EGO, "The position of the Duke is hereditary, and your father wasn't the Duke.");
DisplaySpeechBackground(EGO, "Lucky bastard.");
DisplaySpeechBackground(FORSYTH, "Not as lucky as you might think.  I am, after all, still your secretary.");
DisplaySpeechBackground(EGO, "And I thank God for that everyday.");


Of course, the problem here is that all the lines of dialogue are displayed at the same time (or they would be if the engine wouldn't crash ;) ), so I need to figure out some way to have the speech displayed one line at a time while still having characters walk in the background.  

I was thinking about using some sort of for-next loop with each line being the repeated element, or possibly just using Wait(); and having the engine wait for however long the text is displayed onscreen (which would require a great deal of trial and error) but I'm wondering if other people have run into a similar problem and have another, cleverer solution (especially since I haven't used a for-next loop since my days of BASIC in junior high school)....

Thanks,
-Fro.

Gilbert

Try this:
Code: ags

int overlayid;
MoveCharacter(EGO, 280,146);
MoveCharacter(FORSYTH, 259,148);
Wait(40);
overlayid = DisplaySpeechBackground(EGO, "So why me?");
while (IsOverlayValid(overlayid)) Wait(1);
overlayid=DisplaySpeechBackground(FORSYTH, "Sir, as the Duke Ambassador to Airital, the envoy falls under your command.");
while (IsOverlayValid(overlayid)) Wait(1);
overlayid=DisplaySpeechBackground(EGO, "Then why doesn't anyone do what I say?");
while (IsOverlayValid(overlayid)) Wait(1);
overlayid=DisplaySpeechBackground(EGO, "You're technically my butler, and you boss me around like a god.");
while (IsOverlayValid(overlayid)) Wait(1);
overlayid=DisplaySpeechBackground(FORSYTH, "I merely give suggestions, Sir.");
while (IsOverlayValid(overlayid)) Wait(1);
overlayid=DisplaySpeechBackground(FORSYTH, "And seeing as how you came to this position last week...");
while (IsOverlayValid(overlayid)) Wait(1);
overlayid=DisplaySpeechBackground(FORSYTH, "...you should be wise to heed them.");
while (IsOverlayValid(overlayid)) Wait(1);
overlayid=DisplaySpeechBackground(EGO, "So why don't you just do my job?");
while (IsOverlayValid(overlayid)) Wait(1);
overlayid=DisplaySpeechBackground(EGO, "Or did I already ask that?");
while (IsOverlayValid(overlayid)) Wait(1);
overlayid=DisplaySpeechBackground(FORSYTH, "Every day, Sir.  And the answer will always be the same.");
while (IsOverlayValid(overlayid)) Wait(1);
overlayid=DisplaySpeechBackground(EGO, "Yeah, yeah.");
while (IsOverlayValid(overlayid)) Wait(1);
overlayid=DisplaySpeechBackground(EGO, "The position of the Duke is hereditary, and your father wasn't the Duke.");
while (IsOverlayValid(overlayid)) Wait(1);
overlayid=DisplaySpeechBackground(EGO, "Lucky bastard.");
while (IsOverlayValid(overlayid)) Wait(1);
overlayid=DisplaySpeechBackground(FORSYTH, "Not as lucky as you might think.  I am, after all, still your secretary.");
while (IsOverlayValid(overlayid)) Wait(1);
overlayid=DisplaySpeechBackground(EGO, "And I thank God for that everyday.");


frobozz

Ahhhhh!  Works like a charm.  Thanks, Gilbot!

-Fro.

Igor

Talking about SpeechBackground: is there any way to not make all the background speech appear at the same time- without using any Wait command?
I have some background characters in game that should talk with each other every now and then, but they should not interfere (pause) the game.
I figure this could be done with timer. But i'm still wondering if there's some other way to do the same?

Gilbert

#4
when you don't want the game to pause, you can do something like below (just rough idea, you may need to polish it to work better).

Add on top of the script:
int speechid, paultalk;

Whenever you need a character to talk in background, start it with something like:
speechid=DisplaySpeechBackground(PAUL, "Blah bla bla");
paultalk=1;


Then add to repeatedly executed:
if ((paultalk==1)&&(IsOverlayValid(speechid)==0)){
// ie. if the speech had been started and ended
put whatever you want to do after that line of speech here
paultalk=0; //reset it so the above codes won't be exectue again in next loop.
}


SMF spam blocked by CleanTalk