Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Flyman on Fri 03/02/2012 14:07:21

Title: Two way
Post by: Flyman on Fri 03/02/2012 14:07:21
Hi,
I've a problem!!
I've decided that before player from room (0) enter in a room (1) start a cutscene. After  when player return in room (0) and he enter again in room (1) i'will that cutscene not start.
I've used "Game.DoOnceOnly", but don't work!!
What's wrong in code:
{
if (UsedAction (A_WALK_TO)) {
  if (MovePlayer (244, 90)) {
    if (Game.DoOnceOnly("cutsceneinside")) {
    FaceDirection (GetPlayerCharacter (), DIR_UP);
    Wait(5);
    EnterRoom (28, 354, 134, DIR_DOWN);
     }
 
}
    else {
    if (UsedAction (A_WALK_TO)) {
    if (MovePlayer (244, 90)) {
    EnterRoom (30, 59, 134, DIR_DOWN);
    FaceDirection (GetPlayerCharacter(), DIR_RIGHT);
    }
    }
}
}
Title: Re: Two way
Post by: on Fri 03/02/2012 14:12:02
Since you want the cutscene to start when the player ENTERS A ROOM, use this instead:
Create a "After Fade-In" event for Room1 (or whatever room must trigger your cutscene, then:


function room_AfterFadeIn()
{
if (Game.DoOnceOnly("Enter this room")
//RUN CUTSCENE
}
Title: Re: Two way
Post by: Flyman on Fri 03/02/2012 15:03:01
How can set for the object (in this case the door), a first time and a after fade in??
I don't know but I've see that is true only for player event...I ask me because the code I'm write not work, only the first event work but after the game block!
Title: Re: Two way
Post by: Khris on Sat 04/02/2012 00:43:14
You need to get your code logic straight:


  if (UsedAction(A_WALK_TO)) {
    if (MovePlayer(244, 90)) {
      FaceDirection(player.ID, DIR_UP);
      Wait(5);
      if (Game.DoOnceOnly("cutsceneinside")) {
        EnterRoom (28, 354, 134, DIR_DOWN);
      }
      else {
        EnterRoom (30, 59, 134, DIR_DOWN);
      }
    }
  }


And your indentation.
Title: Re: Two way
Post by: Flyman on Sat 04/02/2012 15:00:13
Great!! Thanks Chris  8)