Simultaneous Warning and Action

First, an explanation of NPC behavior, primarily in First-Person Shooters:

When an NPC sees an enemy NPC, it will immediately attack said enemy NPC with no more words than some Enemy Chatter. The same holds true if an NPC who is an enemy of the player sees the player. Even if the attacking NPC says "Put Down Your Gun and Step Away!" or "Stop or I Will Shoot!" they've already pulled out a gun and started firing.

Except in a Cutscene, of course, in which they are perfectly capable of stopping and arresting the player.

Can be easily justified if they arrest you when you run out of health.

"Githyanki: Zeeaire has foretold your coming, Kalach-Cha. She sent me to end you.
 * Deus Ex Riot cops will order JC to surrender, but will still attack him even if he drops everything.
 * In the Game Mod for Deus Ex, The Nameless Mod: Cerulean Security will order Trestkon to drop his weapons, but they will continue to attack him even if he drops his entire inventory
 * In Metal Gear Solid, guards yell "Who's that?!?" right before they open fire. Given how hard it usually is to get into where they're guarding, you would think capture and interrogation would top the list of priorities, not execution.
 * Unless, of course, their orders are to shoot intruders on sight. Which, when dealing with someone like Solid Snake, is entirely reasonable.
 * And of course, usual player reaction is A)Run away B) Charge C) Shoot them, so shooting player makes sense.
 * While this trope is still prevailent in the game's sequels, it's a little more understandable in Metal Gear Solid 4 Guns of the Patriots, where Snake is infiltrating an active warzone, and the local PMCs are all owned by his arch-nemesis. This also holds true for the third act, where the occupants enforce a strict curfew and anyone seen walking around past curfew will be shot on-sight.
 * In the single-player campaign of Operation Flashpoint, there is a mission in which the player (a US soldier) must make his way alone to an evacuation point, going through territory infested with enemies. Said enemies shoot to kill on sight, except when one reaches the evacuation point. Then a cutscene triggers in which the player character automatically surrenders to a couple of enemies. The camera pans to a field next to them, showing a bunch of dead friendly soldiers, the implication being that they have recently been killed by the very same group of soldiers that capture the player character. Yet the PC is not executed by these soldiers, instead being put into a tent that serves as a makeshift cell, and is shortly afterwards rescued by attacking partisans. In other words, the enemy kill every US soldier they can, except a particular person in a particular cutscene triggered in a particular area.
 * During a storyline Cutscene in The Chronicles of Riddick: Escape From Butcher Bay, Riddick runs into an advanced hi-tech guard, who promptly asks him for his identity and the reason for his presence, and then subsequently arrests him when he finally realizes who Riddick is. Interestingly enough, when the player encounters this enemy in-game, they attack on sight.
 * Neverwinter Nights 2 did some Lampshade Hanging:

Player: I'm surprised you're talking to me. Most githyanki just attack."


 * In the Grand Theft Auto games, if the character is wanted by the police, they will be calling out that the character is under arrest, all the while attempting to either hit him with nightsticks or shoot him. You can evade them as you see fit, save in a Cutscene, when, of course, Gameplay and Story Segregation steps in.
 * Averted in GTA 4, where the police generally don't start firing until you shoot at them or otherwise indicate or are indicated as dangerous. Its possible to walk in front of a car, get knocked over, start a fistfight with the driver who steps out, and then when the cop comes, if you don't fight back against the other guy, the cop will arrest him and not you.
 * Also, in this one, they do try to arrest you and for once, you can actually comply if you don't feel like triggering a chase (not to mention that resisting arrest will pretty much guarantee that you'll get shot at least once, will attract more policemen and cars, and they won't bother with arresting you anymore);
 * Interestingly, the police will keep shooting you at point-blank range even after you're dead.
 * Strangely enough, the cops will arrest you if they manage to open your car's door and point their gun at you. Also, despite trying to kill you most of the time, they WILL arrest you if they manage to knock you down.
 * Used all through the Star Wars: Dark Forces series. Most hilariously, in Jedi Outcast and Jedi Academy, when stormtroopers would yell such fearsome battle cries as "Hey, you there." or "Let's see some ID!" before cutting loose with a hail of blaster fire. In fairness, no matter how long their individual line is, the game always waits until the sound file finishes playing before they fire, even the long ones ("Stop, or I'll shoot!"). Of course, it's still pretty amusing to hear a lone member of a swarm of stormtroopers saying in an only half-confrontational way, "Let's see some ID." as your character plows through the squad with a lightsaber.
 * Exception: SWAT 4's NPC SWAT members did a pretty good job of NOT shooting on sight... until they were quickly incapacitated by hostiles.
 * The Elder Scrolls III: Morrowind and its successor Oblivion are notable aversions. Even killing a guard didn't get you immediately murdered by his fellow officers: you still had the choice of jail, a fine, or resisting arrest. There is one mission in Oblivion where guards will attack you indiscriminately, but this is rather justified here, as you've just broken into the classically-styled sewer system - where the Emperor of all Tamriel was assassinated.
 * Played straight with Daggerfall's guards. Say it with me: HALTHALTHALTHALTHALTHALTHALTHALTHALT...
 * Averted in The Elder Scrolls V: Skyrim: sometimes you'll find giants guarding a herd of mammoths. You can approach them and they'll bang their weapons around and try to intimidate you, but won't actually attack you. But if you get too close to them, attack them or their mammoths, or do anything else threatening, they'll go after you.
 * Another Skyrim aversion: occasionally an enemy will utter "Back off, I'm warning you!" and won't attack unless you get closer or attack them first.
 * Exception: Commandos. In the first game, if one of the commandos was caught and not doing anything particularly suspicious (doing so would usually get them shot on sight) the enemy would yell 'HALT!'. If you didn't move the commando or take out the enemy soldier, they may either maintain this position indefinitely or imprison the commando. Of course, if you disregarded their command, they tended to open fire. At least they gave you a meaningful warning though.
 * "Halt!" cry the low-ranking, conscripted, I'm not supposed to be here today guards in the Crusader series of games, opening fire, while facing down a guy that combines the most frightening aspects of Boba Fett and the Emperor's Royal Guard.
 * Averted in Syndicate. While armed guards and hostile agents have no problem with shooting you on sight without saying a thing, the police will give you a warning to put away your weapon if you have one readied. If you comply within a few seconds, they'll leave you alone.
 * Averted in Postal 2, where the cops will actually try to arrest you instead of shooting you on sight if they see you breaking the law. Of course, if you start shooting people, all bets are off, unless if you drop your weapon and quit attacking or running away from them.
 * Averted in Mafia: City of Lost Heaven, where the cops would either try to ticket you or arrest you for breaking the law, and would only switch to lethal force if you fired back with your guns or used your car as a weapon.
 * If you go on a civilian slaughtering spree in Baldur's Gate, the Flaming Fist hit squad that shows up to stop you is pretty good about talking to you and telling you your crimes before attacking you. Of course, since the game world has no jail, ultimately their only action is pretty much to act as judge, jury, and executioner.
 * Averted in Splinter Cell: Double Agent, where certain enemies will try to capture you at gunpoint (you can escape from them by completing quicktime events).
 * Schutzstaffel!
 * Vampire Bloodlines contains a particularly bad example. Your character can have maxed diplomacy and seduction traits, and supernatural powers of persuasion to boot, and still, with very few exceptions, the police and even museum security guards will shoot at you as soon as they see you (after saying "stop right there," of course).
 * Averted in the Tek War FPS. Police officers will draw their guns and shout for you to put your gun down if you display a weapon in their presence.
 * In Red Faction: Guerilla, the EDF forces will demand that you pull over your vehicle bombing a gas station and speeding away, with them trying to ram your car off the road while telling YOU to pull over. The shooting of you after you actually exit the vehicle is justified because they're massively corrupt and abusive of every miner on Mars to the point of random shootings anyway. However, this does not justify the fact that even in the middle of a pitched military battle, the supporting scout trucks will continue to demand that you pull your tank to the side of the road.
 * The original Red Faction is like this too. The guards will demand you put away your weapon. If you do so they shoot you. If you shoot a guard enough times he will put away his gun and start running around or crouching with their hands over their heads shouting things like "DON'T SHOOT I'M UNARMED!". If you decide to have mercy and put away your gun, they take theirs back out and shoot you. Lovely fellas.
 * Tasen scouts in Iji can say "stop!" or "hold it!" when they see the Player Character, but they shoot on sight anyway.
 * Soldiers yell "Halt!" as well. On the other hand, the Komato shouts upon seeing you are all along the lines of "Die!", "Kill!" or "Terminate!".
 * Justified in both cases: in the latter, they're just here to kill everyone, and in the former, Iji can take a few bullets, thanks to her Nanotechnology.
 * Partial aversion in Oddworld. Slig guards will yell "Freeze!" upon seeing you. If you don't, they shoot you. If you do, they wait a fraction of a second and then shoot you (not surprising, since there's a massive bounty on your head, and it probably takes them that long to identify you).
 * Double averted in Scarface the World Is Yours. Policemen usually give you a chance to talk your way out of trouble if you stop and let them catch up. Past a certain point of "wantedness", though, they will attack.
 * You can even exploit this if you time it right. If you attack a gang and the cops arrive before you're done slaughtering them, you can put your gun away and the cops will do the work for you.
 * Also double subverted in The Godfather: The Game. If your Vendetta or Heat is low, most cops or enemy gangsters will not attack unless you have a weapon in hand or strike first. On the other hand, if your Vendetta or Heat is high enough, they will attack on sight. Then there are some cops who will attack anyway even if your police relations are cordial, enemy gangsters in the backroom rackets will always attack, and then bank security guards will attack if you get too close to their protected area even if your weapon isn't out.
 * In the first two Driver games, if the police see you so much as run a freaking stop light or drive at night with a broken light, they will immediately turn on their lights then BASH YOU with their vehicle until your car stops running. That is some badass law enforcement.
 * Driv3r had the on-foot version, with police that constantly shout "YOU ARE UNDER ARREST" every few seconds, in between hails of gunfire.
 * In World of Warcraft one of the death knights feature you slaughtering civilians. They will occasionally beg for mercy, while attacking you. Admittedly they stand no chance, but maybe if they want clemency they should stop punching you in the face. This was recently patched over so the mooks in question will instead cower in fear while begging for your mercy.
 * Played completely straight in Mirror's Edge, to a pretty disturbing degree. Faith is a completely unarmed Runner, as well as visually unimposing. Granted, she's under suspicion for murder... but for the murder of a single man, using a gun that the authorities know she no longer has, and she has no previous record of even so much as physical assault so far as we know. Yet no matter what Faith does when the authorities yell at her not to run -- even if she complies and stands completely still -- they will shoot her dead. Yes, it's all a Government Cover Up, but even ordinary police officers do this with no provocation at all.
 * Actually a subversion. Looking closely enough on their uniforms reveals the supposedly normal cops as Pirandelo-Kruger mercenaries in a uniform resembling a police suit. They're already under orders to kill Faith, and by the second level it's likely Faith is wanted for multiple accounts of murder.
 * Lampshaded in the game to the point of being a Plot Point. The Runners are surprised by being fired upon without provocation.
 * In Saints Row 2, police will arrest the player character they're close enough when he falls down (usually because a patrol car rammed into him) but otherwise either ignore him (if his Wanted level is low enough) or shoot to kill. Rival gangs also ignore the player if he's not currently doing anything to annoy them (except on certain missions), and it's possible to provoke enemy factions into fighting each other.
 * Scribblenauts has a weird variation of this, since nobody talks. Things you can summon that will have a hostile reaction to each other (such as two boxers, a basketball player and a referee) will always fight to the death, even if that doesn't make much sense. They apparently just can't pull their punches.
 * Parodied in Ratchet and Clank A Crack In Time. Dr Nefarious' robotic minions will frequently say "We come in peace" or "We were just kidding, would you like to go have some pie?" while shooting at you.
 * Averted in Borderlands: human enemies will ask the players to stay away from them ("This is a restricted area!" "You don't want none of this, merc!"). Should the players actually comply, the enemies will continue to roam around their station and ignore the players.
 * A variation of this in the Pokémon games that feature police officers as challengable opponents. They will confront you, order you to stop what you're doing, under the assumption that you're a criminal, and then send a Pokemon out after you. When the battle is over, they'll say that it was dark enough that they didn't realize you were a 10-year-old until then.