Rather complex cutscene

Started by Ciro Durán, Thu 02/10/2003 05:43:42

Previous topic - Next topic

Ciro Durán

Lo... I'm having difficulty building this cutscene, it goes like this:

1.Character triggers something noisy
2.Fade to another room, NPC says something.
3.Fade to previous room, same NPC enters room, walks to point
4.Fade to even another room, animation occurs.
5.Fade to first room, some conversation, yadda yadda yadda.
6.NPC returns where he came from, repositions himself where he was (this does not occur on-screen)

I'm having problems in room changing, as NewRoom is a function that executes only after finishing the script (in short, I can't use this function). I don't know if I missed a "Hide character" function (except if I use transparency option, couldn't find one in the API), or if I should make another view of the character "invisible". I've searched scripting tutorials, but most of them look to me for non-programmers (these are the variables, these are the functions, functions use variables, etc.).

What would you suggest me to do?  ???

Gilbert

Depends on whether the rooms you moved in would be used for other purposes or solely for this cutscene.

If these rooms are just used for this cutscene, just  in the first room, you script the stuffs until the room change, then script the stuffs happens in the 2nd room in THAT 2nd rooms' room script, until another room change, then 3rd room, etc.

If these rooms would be reused for other purposes, one way is to use a global int to determine whether the cutscene is being played, for example:

In first room do something like:
SetGlobalInt(10,1); //mark start of cutscene
blah bla bla ...
NewROomEx(blah bla bla);


In second room, inside "player enters room after fadein" (or wherever appropiate for you):
if (GetGlobalInt(10)==1){
stuffs here blah bla bla
NewRoom(blah);


etc etc etc until in last room of cutscene:
if (GetGlobalInt(10)==1){
more stuffs here blah bla bla
SetGlobalInt(0); //marks end of cutscene

MrColossal

to hide a character i usually just stick a:

character[CHARID].x = -200;

in the script and it sticks him well out of the bounds of the screen

then when i want him back i just:

character[CHARID].x = whatever the x was before
"This must be a good time to live in, since Eric bothers to stay here at all"-CJ also: ACHTUNG FRANZ!

Gilbert

Heh yeah eric's right, but I don't know if it'll affect the screen positoin if it's a scrolling room and that character's the player character (unless you use those SetViewPort(), etc. functions to control the position yourself). Another alternative method is to waste ( ;D ) a view containing only transparent sprites, and set the character's view to that one, and have him set back to the original view when it's done.

Judging from your original post, seems that you just want to make the NPC disappear, so eric's method should work fine.

Ciro Durán

Well, then I'll explain a bit further: both rooms can be explored at any moment by the character, and the NPC in the second room can be spoken to, even after the cutscene (he walks to do something, talks and then returns to his original position).

The GlobalInt solution looks good to me, although it's a bit clumsy way (I have to split the cutscene in several scripts, and I don't know if StartCutscene() and EndCutscene()  would work there.

I'll try eric's solution (as the rooms are not scrollable), and keep you informed :).

Thanks for your suggestions.

Gilbert

Actually it's a MUST to split the cutscene scripts up, as by design the NewRoom() kind of functions always run at the very end of scripts.
Moreover, if the scripts were in the room scripts, after a room change, the original room script would not continue to be executed anymore (as the previous room was unloaded, thus why NewRoom() would always come last), so you need to script what happen in the room script of the related room (Even if you get to make one single script in the global script, it's not a good habit to put cutscene codes in it, as it would make the global script large and more difficult to read).

Ciro Durán

Ok, I got your point, I haven't tried out anything yet, my question would be: How can I manage then the StartCutscene(), EndCutscene(), should they be at the beginning and end of each room script bit?, or AGS is capable enough to skip the scripts until it finds the EndCutscene()?

Gilbert

I think you just need one Start... at the start of the WHOLE thing and one End... at the end of it, shouldn't make a problem if they're in different rooms.

TeeKay

I believe AGS tracks through the scripts, over NewRoom's and those, untill it finds the EndCutscene();, and there it will skip, if skip button pressed.

Pumaman

#9
Just have one StartCutscene where you want the skippable bit to start. If the player skips it, AGS basically just continues to run the game as normal, but at 100x speed with no player input, until it reaches an EndCutscene.

Thus, the EndCutscene MUST be reached automatically in the process of the script without requiring the player to do anything. The way to test it is play the game, get to the StartCutscene and then just sit there, don't touch the mouse or keyboard, and make sure that the EndCutscene script gets run eventually.

a-v-o

To have all the scene together I tried this:

--- script header ---
import function NoiseReaction ();

--- global script ---
int part = -1;
int oldpc = -1;
int npc = -1;
int npc_room = -1;
int npc_x = -1;
int npc_y = -1;

function NoiseReaction ()
{
 part++;
 if (part <= 1)
 {
   StartCutscene (5);
   // 1. Character triggers something noisy
   MoveCharacter(GetPlayerCharacter(),217,129);
   while (character[GetPlayerCharacter()].walking) Wait(1);
   FaceLocation(GetPlayerCharacter(),217,128); Wait(10);
   DisplaySpeech(GetPlayerCharacter(),"They're locked.");
   // 2. Fade to another room, NPC says something.
   oldpc = GetPlayerCharacter ();
   npc = BERN;
   SetPlayerCharacter (npc);
   part = 1;
 }
 else if (part == 2)
 {
   npc_room = character [npc].room;
   npc_x = character [npc].x;
   npc_y = character [npc].y;
   DisplaySpeech (npc, "What's that?");  
   DisplaySpeech (npc, "I better check the room.");  
   MoveCharacterBlocking (npc, 219, 123, 0);
   // 3. Fade to previous room, same NPC enters room, walks to point
   SetPlayerCharacter (oldpc);
 }
 else if (part == 3)
 {
   Wait (40);
   ObjectOn (0);
   character [npc].x = 301;
   character [npc].y = 127;
   character [npc].room = character[GetPlayerCharacter ()].room;
   MoveCharacterBlocking (npc, 246, 132, 0);
   Wait (40);
   
   // 4. Fade to even another room, animation occurs.
   SetPlayerCharacter (LAVE); // LAVE is set to transparent view
 }
 else if (part == 4)
 {
   ObjectOn (0);
   SetObjectView (0, 6);
   AnimateObject (0, 2, 2, 0);
   while (IsObjectAnimating (0)) Wait (1);
   ObjectOff (0);
   // 5. Fade to first room, some conversation, yadda yadda yadda.
   SetPlayerCharacter (oldpc);
 }
 else if (part == 5)
 {
   DisplaySpeech (npc, "Hey...");
   DisplaySpeech (GetPlayerCharacter (), "Leave this room!!!");
   DisplaySpeech (npc, "OK");
   // 6. NPC returns where he came from, repositions himself where he was (this does not occur on-screen)      
   MoveCharacterBlocking (npc, 301, 127, 0);
   character [npc].room = npc_room;
   character [npc].x = npc_x;
   character [npc].y = npc_y;
   ObjectOff (0);
   part = -1;
   EndCutscene ();
 }
}

function repeatedly_execute()
{
 if (part >= 0) NoiseReaction ();
}

--- interaction to start cutscene ---
function hotspot5_a() {
 // script for hotspot5: Any click on hotspot
 NoiseReaction ();
}

SMF spam blocked by CleanTalk