Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: llamaman on Thu 10/05/2007 21:24:51

Title: scripted cutscene returns
Post by: llamaman on Thu 10/05/2007 21:24:51
So, I have a cutscene that plays when I use an item on another character.  However,  I want it to work such that I can make that happen from any room, and then make the characters talk in the current room.  Currently, I just have it hardcoded to only work in one room.  I would guess I need to do something like check my global "returning from cutscene" variable, possibly in the repeatedly execute part, but I can't find an "Onroomload" function in the scripting interface.
Title: Re: scripted cutscene returns
Post by: Khris on Thu 10/05/2007 22:26:30
Check on_event in http://www.adventuregamestudio.co.uk/manual/TextScriptEvents.htm

EDIT:
Btw, re-reading your post, "hardcoding" a character interaction to work in only one room seems weird. Characters are handled globally, as are their interactions.
If the cutscene is happening in another room, simply use player.PreviousRoom to return to the previous room.
Title: Re: scripted cutscene returns
Post by: llamaman on Sat 12/05/2007 04:06:53
I'm not sure how I'd use that at the moment.  Currently I want it such that it goes to another room, stuff happens, which I have working up to this point, but then, I want them to talk when it returns.  So, I'm guessing I'd in on_event
if(event=eEventLeaveRoom && data=cCharacter.Room())
{
if (returningfromcutscene==1)
...speech and stuff...
returningfromcutscene=0;
}
or something?  And then just set a variable for returningfromcutscene in the cutscene?

Thanks.
Title: Re: scripted cutscene returns
Post by: Khris on Sat 12/05/2007 13:53:54
Unfortunately, there's no eEventRoomAfterFadein.
eEventLeaveRoom won't work because it is called right before the room change.

I can't think of an alternative to adding a RunScript to every room's "Player enters screen (after fadein)" right now.

Well, there one thing, but it's a bit dodgy. You could do this:
function on_event(EventType event, int data) {
  if (event==eEventRoomBeforeFadein && player.PreviousRoom==CUTSCENE_ROOM) {
    SetTimer(1, 60); // fadein time
  }
}

function repeatedly_execute {
  if (IsTimerExpired(1)) {
    ... // speech here
  }
}