Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Simon_Hill_2006 on Tue 03/07/2007 02:25:57

Title: Ending A Game!
Post by: Simon_Hill_2006 on Tue 03/07/2007 02:25:57
I have created a game and am not sure how to end it my game is an adventure game and i am wondering if you can make it once you get to a certain score or found all the objects you can win can any one help?

and also is there any way to lock a room untill you have found a certain item?

thanks Simon
Title: Re: Ending A Game!
Post by: Khris on Tue 03/07/2007 03:25:33
You might be looking for this: Working with variables (http://americangirlscouts.org/agswiki/Scripting%2C_Code_%26_Interaction#Working_with_variables:_the_basics)

To constantly check for a certain condition, put it inside the repeatedly_execute function in the global script:

// in rep_ex:
  if (game.score==100) {
    Display("Yay!");
    QuitGame(0);
  }


Although in this case, using the on_event function is more applicable:

function on_event (EventType event, int data) {
  if (event==eEventGotScore && game.score==100) {
    ...
  }
}


EDIT: Please read the forum rules before asking any more questions / starting new threads.
No offense, but it's obvious you don't.
Title: Re: Ending A Game!
Post by: Ashen on Tue 03/07/2007 11:42:23
Also in the BFAQ, and even more to the point: How to end your game (win/lose/die) or kill off your character (http://americangirlscouts.org/agswiki/Graphics%2C_Characters%2C_Text_%26_Rooms#How_to_end_your_game_.28win.2Flose.2Fdie.29_or_kill_off_your_character), which already includes the on_event method.

And, since it's obvious you didn't read the BFAQ (and nither did KhrisMUC, by the looks of it...) topic locked.