Event Flag

"Jellies? Never seen 'em before, but now that you mention it, they're right out the door!"

- Cave Story's entry for this trope

A condition in game programming that causes a variable to change. Event Flags are set off when certain events take place -- Boss Battles, Cutscenes, leveling up, One Ups—anything that's important to the plot or to your stats. Flags can also trigger anything, from changing a character's status to activating subquests or side-plots to adjusting what sort of Random Encounters show up.

It's important to note that there need not be any logical connection between the action and the results. Sometimes there is a relationship, as when the completion of one quest makes you eligible for others, but very often the game programmers just decided to enforce the order of events. If the door to the Black Tower is impenetrably sealed, but spontaneously unlocks itself after you give 10 flowers to a completely unrelated NPC on the other side of the world, an Event Flag is the little chunk of computer code that made it happen.

Setting off certain Event Flags is necessary for the computer to know when you've won most games. Sequence Breaking in the wrong places can make the game Unwinnable if a flag that was supposed to be triggered gets stuck in the wrong state.

Generally, a Broken Bridge is "repaired" by an event flag, and an unsolvable puzzle gets its solution from it as well.

The term is often used for gags in Anime and Japanese games, where Genre Savvy characters talk about needing to set off flags for the plot or relationships to move in a favored direction. More commonly it is a joke about Tempting Fate, where once a certain event has been set off, something inevitable will follow. Anybody who talks about what they're going to do after a war, for example, has raised a death flag.


 * One spot in Super Paper Mario can only be passed via Stupidity Is the Only Option. If you try to delay doing what will trigger the bad event, the character you are conversing with will eventually bring up event flags.
 * An infamous bug is found in Ultima VII Part Two, Serpent Isle. In a haunted house near a lighthouse you visit early in the game, speaking to certain ghosts shows you dialogue from much, much later in the game. This information is useless at that point and doesn't really make sense yet, but more importantly that conversation sets a few event flags that may cause future areas to become impassable.
 * In Super Metroid, the large crashed ship is supposed to be entered from the west; a boss fight there triggers an event flag which turns the power on. Through heavy-duty Sequence Breaking, it can also be entered from the east, but it will be completely empty until this flag is triggered.
 * In Prince of Persia, one might expect that picking up the sword in the first level is an event flag (because you can't very well enter a sword fight without it). Turns out that it's not; through trickery, you can enter the second level even without the sword, at which point you'll magically be able to swordfight anyway.
 * One walkthrough, purporting to be a translation of the ancient tale of the protagonist, lampshades this by explaining that the story splits into two different versions at this place, and speculating that the Prince might have (in the quick version) found the sword on the stairs.
 * Fallout 2 has hundreds of Event Flags, some for as obscure things as the particular branches you took in earlier conversations.
 * This is also the case with Arcanum, as well as every other role playing game in which the dialogue choices actually matter.
 * Rune Factory 2 has only a very few of these. Those it lacks often lead to rather humorous conversations where villagers ask what you think about their Love Interest after you've married her. And you still respond with "i dunno lol".
 * One point in Cave Story has a pretty transparent event flag—there's only critters and bats outside when you first enter Grasstown, but once you've talked to Chaco and she mentions you need to kill a Giant Jelly, the entire place is now magically filled with flying Jellyfish (including several visible from her doorstep).
 * Also in the Core Chamber: Curly notices something interesting and wants you to come look at it, and the cutscene leading directly to the Boss Fight is triggered when you go talk to her. It's significant because.
 * Dr. Booster in the Labyrinth as well.
 * A bug in Castlevania: Portrait of Ruin makes the game Unwinnable this way: Death has some dialogue immediately after you beat him, and at the end of the dialogue, his "boss beaten" event flag is set. However, if you skip the cutscene, the flag never gets set, so re-entering the room seals the doors just as if you had a boss battle, but the boss never appears; you are locked in the room until you reset the game. Worse yet, if you went back out of the room to take advantage of the nearby savepoint, you obviously can't get through the room, which is where the rest of the game is, and the only recourse is to restart the file.
 * Konata of Lucky Star often goes on about event flags as if they happen in real life.
 * The characters of Hayate the Combat Butler occasionally do this as well.
 * The Elder Scrolls IV: Oblivion is just about run by event flags, ranging from new enemies suddenly appearing based on your level and/or reaching a certain point in a quest all the way to keeping track of what every NPC is supposed to be doing at any given time of in-game day. However, some of these event flags are notoriously prone to glitching, sometimes with disastrous results.
 * Fallout 3 upgraded that engine with a more sophisticated AI system, allowing for more flexible scheduling, conditionals and parameters. There's now quadruple redundancy possible, with event flags set by triggers, spell effects, dialog or AI. A dialog can set an AI flag, which will execute and set a Global variable, which will be checked when a door or object is triggered or a spell times out...and many other possible permutations and chained event flags. Unfortunately, this inconsistency makes it easier to break and harder to debug the chain, which a study of the game in the Construction Set shows many designers have done...
 * Skies of Arcadia has event flags. This presents a problem if you use a cheat to find all discoveries before going to the ice continent, as the discovery of a city on the continent is an event flag - you cannot progress in the game and have to start over.
 * Certain text adventures enforce intended solutions with event flags. Wishbringer was a classic example of this. There were two cases where you needed to say something to progress. Even if you know what you are supposed to say already (from having solved the puzzle before), when you type it in, unless you learned it in game, you will see something like "The poodle decides you're only guessing it's name and yaps all the louder." It's not enough that one of three is randomly chosen at game start, but if you happen to guess it right anyway, it won't work until the game has told you what it is. And at the time you need to use it, that word of power is Lost Forever if you don't know it by then, as backtracking is impossible. Hopefuly you kept a save from just before you should have gotten it? This doesn't even qualify as a handwave.
 * Lampshade Hanging in Flower, Sun, and Rain. In Scenario 4, there's a point when you will probably have already figured out the solution to a puzzle, but aren't actually offered the chance to solve it. You first have to talk to Stephen Charbonie, who, as part of his usual bizarre rant will mention that "digital games also need flags" and that he's going to "trigger a flag for you." From then on, he mentions "flags" every time he allows you to progress further.
 * The Unreal Engine's Scripting Language Kismet is designed specifically to manage Event Flags, rather than going through the more complicated Unreal Script or C++ routes, kept for more standard functionality.
 * Phantasy Star relies heavily on event flags, to the point where you won't be able to access a chest that should be in plain sight until a person tells the characters about it.
 * Several of the Total War series games (notably Rome) have their historical progression events driven by the actions of one faction - eliminate that faction and history stands still for everyone else. This is often a lot more noticeable in realism mods like Europa Barborum, if only because a lot more happens on the back of the event flags.
 * The Exile scenario editor charmingly names these Stuff Done Flags.
 * Games produced by Paradox Interactive run on this trope.
 * Technically, all but the smallest games run on Event Flags
 * Partway through The Legend of Zelda the Wind Waker, you're asked to provide a password to get back inside Tetra's pirate ship. However, even if you solve the password riddle perfectly, capital letters and all, the game still won't let you into the ship until you view the correct cutscene where Link overhears the password from two pirates (thus triggering the event flag).
 * Opening the portal to Black Castle in An Untitled Story requires the player to talk to the girl on LongBeach. Aside from this, these two things are otherwise totally unrelated.
 * Anybody playing Land Of The Dead will quickly discover that yes, the five-minute trek back to where you need to be (fighting a hoard of zombies the whole way) is absolutely necessary. Event flags are used to ensure that the gamer doesn't cheat by using the "ghost" cheat to just fly through walls and to the goal. If the player doesn't walk all the way through each area, no zombies will spawn and it won't trigger the level end. Until you go back to where you broke the sequence, you're left wandering around.
 * The whole premise behind the anime/manga The World God Only Knows is based on setting flags. The main character, Keima, is a hardcore Dating Sim otaku so interactions with other characters, mundane everyday tasks and random events all end up being flags.
 * EarthBound uses event flags to an insane level. Random people you have to talk to to trigger events miles away, state changes that are never obvious...there are so many Guide Dang It event flags in the game, Nintendo decided to include a guide with the game. Thankfully, the sequel improves massively.
 * Albion's Beloveno Arc depends entirely on event flags, that are set off when talking to certain people in a certain order, a certain amount of times. For example, while collecting information on a plot to assassinate the council president, the player will be prompted to talk to a certain NPC once he discussed the issue with two particular individuals. Talking to the NPC in question, will trigger the assassination. If the president was warned before that happens, the attempt will be twarted and the player will be rewarded for their service. Othervise, he will be killed.
 * In one level of Medal of Honor: Frontline, you have to blow up several trucks. The last truck doesn't appear until you get the deployment roster. Destroying it collapses a girder, creating a ramp over the otherwise insurmountable wall to the next level.
 * In one TIE Fighter mission, a different set of enemies would appear depending on the order in which the player destroyed his first two targets.
 * In Septerra Core, Maya's father won't know that until you ask Azziz the same question (he answers "I don't know, ask your father). Lo and behold,  shows up in  instantly after talking to Maya's father.
 * Sam and Max games in general, and Episode 302: Tomb of Sammun-Mak in particular are all about this trope.
 * Left 4 Dead uses event flags mainly in finales. Until you trigger the button/radio/whatever to start the finale, you are stuck where you are until you start the event. Left 4 Dead 2 have two finales that are triggered by riding an elevator down to the lower floor but sometimes, due to a glitch or lag online, the finale event fails to start, thus the flag is never triggered. However, thanks to The Dev Team Thinks of Everything, there's an object that can be "activated" to trigger the finale flag as a failsafe should the first flag fail in triggering.
 * Soulcaster and Soulcaster II make heavy use of event flags for controlling traps, ambushes, monster spawns, and other such triggers.
 * It is a Discussed Trope in Hikonin Sentai Akibaranger, a Super Sentai parody. Not only is it mentioned in the Theme Song, but Akiba Red remarks e.g. in the first episode that every time an enemy commander leaves saying something like "I leave it to you", this is a flag for the heroes to defeat the Monster of the Week. Sure enough, the Rangers suddenly start winning. However, the show also likes to play with the rules of sentai. When they expect Make My Monster Grow to happen after the monster's first apparent destruction, it doesn't. The monster is really dead. The team complains about that, just because it's not how it's supposed to go.
 * Metroid: Other M gives Samus upgrades merely for being in the right place with the right event flags triggered. Most noticeably, this happens with the Grapple Beam and the Wave Beam.