Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: fluxmaster on Thu 14/02/2008 05:03:20

Title: Using SetRestartPoint() in a cut-scene
Post by: fluxmaster on Thu 14/02/2008 05:03:20
I am trying to use SetRestartPoint() to set the point that the game will go to when F9 is pressed.  If I put the function in my room script the game hangs up when the player presses F9.  In a previous thread, a user suggested executing the function at the first idle moment after the room is entered.  I have tried this, but there is one problem:  The room where I want to execute this function has no idle time--it is a cut scene that automatically loads the next room.  So pressing F9 restarts the game in the next room, not the cut scene where I want it to start.  Is there a way around this?

I am using version 2.72.  Does this function work better in the latest version?  I don't want to convert my game right now, although I may later.  Is there a way to get this to work in the version that I am using?
Title: Re: Using SetRestartPoint() in a cut-scene
Post by: Khris on Thu 14/02/2008 07:53:23
Try this: In after fadein, instead of starting the cutscene, call SetRestartPoint(), then set a timer to expire after 5 loops or some other low number.
Then use the usual timer code in the room's rep_ex:
function my_cutscene() {

  // cutscene code here

}

// room's rep_ex
  if (IsTimerExpired(X)) my_cutscene();


I've never used SetRestartPoint(), but it might work this way.
Title: Re: Using SetRestartPoint() in a cut-scene
Post by: Pumaman on Thu 14/02/2008 20:51:09
Yes, something like that would do the trick. At any point in your cutscene, you can allow it to save by breaking out of a chain of blocking animations with a timer or something to give a couple of game loops where no script is running to allow the save to take place.
Title: Re: Using SetRestartPoint() in a cut-scene
Post by: fluxmaster on Fri 15/02/2008 18:47:32
Yup, that did it.  Thanks!