Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Bernie on Thu 18/09/2003 16:35:42

Title: Complicated Cutscene
Post by: Bernie on Thu 18/09/2003 16:35:42
I want to make a cutscene in which two characters sit on a cart. The cart will be animated all the time, wheels moving, etc, and I want the characters to be able to talk while the cart is moving. And the screen should follow the cart (scrolling). Can anyone give me a few tips how I can achieve this? Just a general description will do, thanks! :3
Title: Re:Complicated Cutscene
Post by: Bernie on Thu 18/09/2003 16:58:28
Here's a pic so you can imagine what I wanna do:

(http://www.faind.com/bernie/moo!.jpg)
Title: Re:Complicated Cutscene
Post by: SSH on Thu 18/09/2003 17:32:12
First, you can edit posts rather than double-post  ::)

Now, if the player character is moving, even in a cutscene, the screen will follow them. So, if you do the MoveCharacter on the player (views set appropriately to match your animation). Now, to get the other character(s) to stay in the correct place, you could put in the repeatedly_execute:

character[CARTGUY].x=player.x;
character[CARTGUY].y=player.y;

during the cutscene.

So, I recommend having the driver, horse and cart all as one sprite, and the guy on the back as another (these are also two separate characters.

Then, to start them moving:
 MoveCharacter(EGO, 779, 59);
 SetGlobalInt(3, DisplaySpeechBackground(EGO, "This is fun!"));
 SetGlobalInt(2, 1);

and in your repeatedly_execute:

if (IsOverlayValid(GetGlobalInt(3))==0) {
 if (GetGlobalInt(2)==1) {
   SetGlobalInt(3, DisplaySpeechBackground(CARTGUY, "you like riding on carts?"));
   SetGlobalInt(2, 2);
 } else if (GetGlobalInt(2)==2) {
   SetGlobalInt(3, DisplaySpeechBackground(EGO, "I love carts, ever since I was a boy!"));
   SetGlobalInt(2, 3);
 }  // etc. etc.
}

and to do something when they stop moving, this goes again in your repeatedly_execute:

if (player.walking == 0) {

}

You might need to extra if statement to check that you are actually in your cutscene, or course. And presumably you've read the manual on how to do large scrolling screens...

the code above is actually taken (with a bit of modification) from my new game  http://www.agsforums.com/yabb/index.php?board=5;action=display;threadid=8436;start=0#lastPost
so you can see how it works.
Title: Re:Complicated Cutscene
Post by: Scummbuddy on Thu 18/09/2003 17:35:04
You *could* create a really long animation with you doing all the things you wanted, by just pixel pushing in your favorite art program....

or you could

1. Check out and add in here "StartCutscene" in the manual
set animating objects above the wheels of your wheels when moving, and continue to do
--------------------
DisplaySpeech
DisplaySpeech (CHARID, string message)

Displays the text MESSAGE as speech above the specified character's head. The text will remain on screen for a limited time, and the user may or may not be able to click it away depending on the setting of "Player can't skip speech text". The text displayed by this function looks identical to that used by the dialog system.
NOTE: This function allows variables like "%d" and "%s" in the message.

Example:

DisplaySpeech (EGO , "My name is ego");

will display the message above the character’s EGO head like the LEC games and play the character’s talking animation.
--------------------------------
Check out and put in here "EndCutscene" from the manual.

And put this on a large attributes bg, and possibly a constant counter adding to a variable that inturn will change the setbackgroundframe over by a couple pixels every second or something.



Nice sprites by the way.
Title: Re:Complicated Cutscene
Post by: Bernie on Thu 18/09/2003 17:41:28
Hey, thanks, very useful info! :D I'll go and try this now.
Title: Re:Complicated Cutscene
Post by: Bernie on Thu 18/09/2003 23:02:46
Ok, I got everything to work, many thanks! :D

I found it to be more practical to always substract 1 to the current x pos to get the movement effect... movecharacter needs to be set again after changing main char animations, and doing so results in shaking.

Only I don't understand what IsOverlayValid does... I checked the manual, but I didn't really understand the description. How come it sets the Global Value 3 back to 0 if the message has disappeared?
Title: Re:Complicated Cutscene
Post by: Ishmael on Fri 19/09/2003 10:38:01
IsOverlayValid check if the specified number overlay is on screen. All speech is overlays, and when the speech disappears, the overlay is no longer valid, so the number is se back to 0. when the overlay is valid, the variable comtains the overlay ID, which is needed when you want to remove the overlay or change it's text.