From The Elite Wiki
Jump to: navigation, search

This is a description of NPC guards within GoldenEye 007


Guards (General)

  • Guards who dual-wield any weapon can never pull grenades. [1]
  • Guards have a 1 in 128 chance to do an idle animation per frame.[2]
  • For idle animations, guards have a 5 / 256 chance (~1.95%) to sneeze.[2]
  • Targeting guards that do a sharp angle change can become frozen, but it is unclear why. This only occurs on NTSC-U, and not PAL or NTSC-J. They must lose health to become unfrozen, but can later become re-frozen. All dual-wielding Moonraker guards and third Baron can also become similarly frozen with a rolling animation under more unknown specifics, but this can occur on all versions. [1]

Types of Guards

0002 Guard

The most common guard. Stays idle, runs to you/fires at you when he sees/hears you. Afterwards continues chasing your former positions until seeing you again or 10s passes, if the latter, becomes idle again.

Patrolling Guard

Normal guard but will initially be moving along a path

Targeting Guard

Aims at you and updates their angle continuously.

Cloner Guard

Normal guard, but capable of cloning if you haven't looked at him yet. They clone themselves and send off the clone instead, while staying in place and being otherwise idle. [3]

Spawn Guard

Guards who spawn after an event.

Alarm guards

Look around when alerted by a noise, a nearby shot or a hit on a guard that they can see. They then run to their assigned alarm and activate it on arrival, before becoming a normal guard and chasing bond (once). If they see Bond directly then they run to the alarm without looking around.

Guard Attack Scripts

This is an outline of the AI Script the guard uses to attack.

Standard Attack Script

Most guards run this standard attack script[4] to select an attack (there are still plenty of exceptions, i.e. spawn guards on S2, blue hat caverns guards to name a few). The randomness used to decide an attack is kinda clear if you can read these scripts, but there are requirements for most of the attacks which I've dug out of the assembly[5].

Note: all space related tests ignore other guards and even objects, they're just looking at 'level geometry'.

Listing these in the order that they are potentially tried, and splitting them into 4 groups:

Group 1 : grenade

  • [1A] Roll for grenade
    • Selects a random number 0-254 (255 possibilities) and this must be less than the guard's grenade probability. I've often said this was 0-255 (256 possibilities) before but I was wrong :p

Group 2 - dodging

  • [13] Roll and fire
    • Requires 2m to the left / right of the guard looking at the guard from the player's point of view. Selects direction randomly, but will try the other direction if the first is blocked.
  • [0F] Side hop
    • Similarly requires 2m to the left / right but from the guard's point of view.
    • Additionally the player must be in the front or rear quadrants of the guard. i.e. if ahead of the guard is north, the player must be between NW and NE or between SE and SW.
  • [0E] Sidestep - identical to the hop, but only requires 1m of room.
  • [10] Run sideways
    • Has a weird first test, which is something like "the guard hasn't begun anything in the last 3 seconds".
    • Then it uniformly selects a random distance between 2 and 4m. It requires this to the left / right of the guard looking at the guard from the player's point of view, as for Roll & fire.

Group 3 : charging

  • [12,13] Walk / Run & Fire
    • Same 3s tests as for running sideways
    • The player must be more than 10m away from the guard (3D test)

Group 4 : stationary attacks

  • [14, 15] Stand / Crouch & Shoot
    • These always succeed.

With the probabilities, working backwards kinda makes sense. In group 4 the guard has a 50% chance to crouch, and 50% to stand. Simple. In group 3, if the guard started something in the last 3s, or is within 10m of Bond, then continue to group 4. Otherwise:

  • 25% chance to walk & fire
  • 25% chance to run & fire
  • 50% chance to continue to group 4 anyway

Group 2 is more complicated because some are from the player's POV, some from the guard's, and some care about which quadrant the player is in and others don't. So possibilities and odds will vary, but lets pick the simplest case where the guard is directly facing Bond, so left / right from the two POV's are just reversed which doesn't matter, and Bond is in the NW -> NE quadrant so that check passes. Further assuming that there's plenty of space either side of the guard, we have these odds:

  • 4.3% chance to roll & fire
  • 4.1% chance to hop
  • 9.3% chance to sidestep
  • 16.4% chance to run sideways
  • 65.9% chance to continue to group 3

So more than 1/3 chance of doing trollery basically. But note that if he doesn't have much space then he may only be able to side step, which would then have higher odds of 10.2% because the previous attacks would never prevent you rolling for a side step.

Finally group 1 is very simple. It has an X/255 chance of pulling a grenade. If it fails to, continue to group 2. X varies depending on the guard.

Technical Details

Ghost Doors

Conditions for a guard to open a door[6]:

  1. The guard is walking along a path or chasing Bond
  2. The guard is within 2m of it (3D test, door considered as a point)
  3. The guard's chase timer is a multiple of 10
  4. The door is the 1st one that the line from the guard to his local target point intersects

All doors opened by guards are opened by this mechanic. It's worth noting that all double doors / gates / glass are actually just individual doors which are linked. Aztec glass consists of 3 doors.

The chase timer

When a guard starts chasing Bond, the chase timer is set to a random value from 0 to 99, chosen uniformly. It increases by 1 every time the guard updates, which is every drawn frame I think (unlike PD). So for 'frame perfect' tricks like ghost doors (see below), you effectively have a 1 in 10 chance of passing the chase timer test. And strats like mainframe glass get their consistency from having a large number of consecutive frames for which the guard passes the other tests.

The local target

The intended purpose of the local target is to avoid dynamic objects like other guards and to navigate using the clipping tiles when they get close to their target. The standard way we manipulate these into / behind doors is by placing a second guard by the door, and the 1st guard sets their local target inside the door, trying to avoid the 2nd guard. But when a guard unloads, the local target doesn't get updated. And in fact the local target doesn't get updated until the 2nd frame that the guard is loaded. This will give rise to ghost doors.

Aztec Glass

Video: Behind the mainframe strat curtain.


  • The 2m circle around the doors
  • The guard's normal target
  • The guard's local target

The conditions are monitored in the top left. Condition 4 is True the whole time that the guard's local target is inside the door.

The magic of the mainframe strat is that

  • because the 1st guard arrives unloaded, the 2nd guard's local target is always inside the glass
  • the 2nd guard spends a long period in range of the door that he'll open

Note that you mustn't be too far behind the crack when you do the lures, else the guard will only be able to open the middle glass "door". This completely loses this 2nd great advantage and the consistency will plummet.


This is a general mechanic, so can be applied to any level but we'll deal with the classic archives one. As Henrik showed, it's the patrolling guard who opens it on the 1st frame that he loads, as he heads away from it.

On Archives, Miskin is in the path of this guard, and the patrolling guard can spend a long time circling him, staying loaded. When I set up this ghost door myself, he was loaded when I lured him, and stayed loaded for a little while, even opening the door to Miskin's room. This put his local target directly behind the ghost door, before he then unloaded.

He goes through the door unloaded and starts going along the corridor. When I loaded him then the line mentioned in condition (4) goes straight through the middle of the door. Conditions (1) and (2) are trivially true. And (3) is essentially a 10% chance.


Local targets persist after resetting the level. But when guards first start chasing Bond (when the 28 command succeeds for the guard script boffins) they always set a flag invalidating the current local target.

This restriction is worse though because it means that the guards must set their local target then unload and move to the front of the door in a single movement. They can't arrive somewhere and then hear you again or even chase you because they were alerted recently.

Shoot Alert Time

When you shoot near a guard and alert him you have a 50% chance of him attacking and a 50% chance for him to look about. If he looks about, the length of the animation is equally likely to be[7]:

  • 0.60s
  • 1.38s
  • 2.20s


  • For guard hops there are 4 different ones but they are all a frame within 1.47s [7]
  • And again for both the guard stands up briefly at the end of the animation.


  1. 1.0 1.1 Icy. "the-elite Goldeneye facts topic post on miscellaneous function explorer facts". Retrieved July 16, 2021.
  2. 2.0 2.1
  3. Icy. "the-elite forum Goldeneye facts post on guard AI". Retrieved July 16, 2021.
  4. Ryan Dwyer. "Goldeneye/Perfect Dark function explorer". Retrieved July 16, 2021.
  5. Whiteted. "the-elite forum Goldeneye facts post on standard guard attack script". Retrieved July 16, 2021.
  6. Whiteted. "the-elite Goldeneye facts topic post on ghost doors". Retrieved July 16, 2021.
  7. 7.0 7.1 Whiteted. "the-elite Goldeneye facts topic post on a few more guard details". Retrieved July 16, 2021.