Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Gord10 on Thu 11/09/2003 14:48:17

Title: Can scores change the end of the game?
Post by: Gord10 on Thu 11/09/2003 14:48:17
I want the main character's behaviors change the end of the game. If he always steal items, talk impolitely and irresponsibly; the game will end bad.
Can it be?
Title: Re:Can scores change the end of the game?
Post by: Ishmael on Thu 11/09/2003 15:04:53
Yes... script something like:

if (GetGlobalInt(200) < 100) {
NewRoom(201);
} else if (GetGlobalInt(200) < 130) {
NewRoom(202);
} else {
NewRoom(200);
}

This checks GlobalInt 200, which you can change during game with SetGlobalInt(200,newval); is under the given number, in order (so if between 100 and 130 the middle command is run).The game will go to specified room. In the rooms "Player enter screen" room interaction events you can set what happens. The GlobalInt and room numbers are just examples, so modify it to suit your need.
Title: Re:Can scores change the end of the game?
Post by: Gord10 on Fri 12/09/2003 06:23:29
Thanx. But I want to ask you one more thing: Are 200, 130, 100 scores?
Title: Re:Can scores change the end of the game?
Post by: cornjob on Fri 12/09/2003 09:04:55
In TK's example, you would use global integer #200 to store the score data. However, this can also be done by accessing the normal game.score variable like this:

if (game.score < 100) {
NewRoom(201);
} else if (game.score < 130) {
NewRoom(202);
} else {
NewRoom(200);
}

You can find a lot of interesting variables in the "text script global variables" section of the manual.
Title: Re:Can scores change the end of the game?
Post by: Gord10 on Fri 12/09/2003 14:55:49
Thanks  :)