Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Guyserman82 on Sun 13/12/2009 00:34:57

Title: (Solved) Programming after events
Post by: Guyserman82 on Sun 13/12/2009 00:34:57
Hi. I notice in games like Ben Jordan and 5 Days a Stranger that certain conversation options are only available after you've done a certain thing in a game. In We Are Vectors (http://www.adventuregamestudio.co.uk/games.php?action=detail&id=1249), I told AGS not to do something unless the player had a certain item. Now, while my strategy worked, I was wondering how you tell AGS not to do something until the player has done something without getting an item.
Title: Re: Programming after events
Post by: Crimson Wizard on Sun 13/12/2009 01:29:57
Why, by using the variable ofcourse! Either global one, or local (in room), depending on situation.
For example, add variable in the Global variables table, like boolean CharacterDidWhatNeeded.
When character actually does what needed you write:

CharacterDidWhatNeeded = true;

When you need to check if he did it, you write:

if (CharacterDidWhatNeeded)
{
  ...
}

If more than two things has to be done, make another variable, like CharacterDidSecondThing, in this case condition should be:

if (CharacterDidWhatNeeded && CharacterDidSecondThing)
{
   ...
}
Title: Re: Programming after events
Post by: Guyserman82 on Sun 13/12/2009 19:43:08
Oh, right! Not at all meaning to sound sarcastic here. I haven't been programming long, so it didn't occur to me to use variables. Thanks!
Now, how do I say this thing is solved?
Title: Re: Programming after events
Post by: Matti on Sun 13/12/2009 20:04:02
Just edit the title of your first post.