(Solved) Programming after events

Started by Guyserman82, Sun 13/12/2009 00:34:57

Previous topic - Next topic

Guyserman82

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.

Crimson Wizard

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)
{
   ...
}

Guyserman82

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?

Matti

Just edit the title of your first post.

SMF spam blocked by CleanTalk