I was just wondering, how people keep track of the progress of the story in a game. It doesn't really matter what programming language.
For example: A character has to say something that leads the player to a dungeon, once this dungeon has been cleared the same character is in a different area of the map. The character then leads the player to a switch that opens up a new area, after which the character continues to be nothing more then generic until the player completes several dungeons and meets some other characters. This character then plays a role in a sidequest.
Show content
Some more concrete examples: In OOT when does the game know that Sheik has to turn up at the temple of time, then death mountain, then Lake Hylia, after which in Kakariko Village and then in the desert and finally back in the temple of time.
OR:
In the minish cap when Talon and Malon have to get back in their home, link has to go in the house; get the key; get out of the house and then give the key to Talon. Resulting in Talon being in the house, Malon with horse and cart in town.
OR:
again MC. When does the game know how to activate the scene in North Hyrule field when Vaati attacks Link, coming out of Hyrule Castle, in between the four trees. Or to trigger the scene that Vaati takes over the King.
I was think about two options:
1) some local variables denoting the state of instances in the world, which results in many variables being saved in a save file. Variables which can be unnecessary in a linear progression of parts.
2) using a finite state machine. Less variables to save, but can be big and confusing when there are a lot of nodes and transitions. Especially when there is not a definite linear order of the nodes. But the problem of size can be solved by making more and smaller finite state machines.
As I said it doesn't matter much in which language, it is more about the design.