Grand Theft Auto: San Andreas/Game Mechanics and Glitches/Duping

From SDA Knowledge Base

Jump to: navigation, search

Duping is the duplication of missions, which means starting several instances of the same mission on top of eachother.

How Duping works

Basic principle

The game uses a variable called $ONMISSION (or short $OM) to track whether the player is currently on a mission or just freeroaming. When a mission is started it is set to the value 1 (true) and when the player leaves a mission (e.g. passes/fails) it is set to the value 0 (false). As long as $OM=1 then the game will not allow you to start another mission. Missions include not only story missions, but also side missions like Quarry, Trucking, Races, Vigilante and so on.

While all missions check if $OM=0 before they start, not all are the same when it comes to setting $OM=1 when they are started. Some missions (e.g. Trucking and Quarry) have a bit of a delay between starting the mission and setting $OM=1, allowing for a very short window of opportunity (as in under a second) to start another mission. Of course when starting Trucking, it's kind of hard to start e.g. a story mission at the same time since it's on the other side of the map.

As opposed to e.g. GTA:VC there is no way to remotely start a mission through replays, but luckily phonecalls also count as small missions, with the same restraints as well as effects: You can only receive phonecalls when $OM=0, once the phone rings it will set $OM=1 (sort of like a mission starting) and when it is cancelled (or taken and put down again) it will set $OM=0.

Phonecalls are on a fixed timer, so it's possible to know when you will receive one. So you can walk into e.g. the Trucking mission marker just at the right time, Trucking will start, still $OM=0 (because of the delay until $OM=1 unique to some missions), the phone will ring, now $OM=1, but with both the mission still starting and the phonecall still active. So now you have a ringing phone and a mission started at the same time, on $OM=1. Now if you cancel the phonecall, this will set $OM=0 and you are free to start another mission, even though you are still on the Trucking mission.

Duping Trucking isn't very useful (at least in any%), what you really want to do is dupe story missions. So having done the above, you are on the Trucking mission with $OM=0, able to start missions. You might think about starting Story Mission A, then failing Trucking somehow, which sets $OM=0 and starting Story Mission A again. However starting most missions together with Trucking will make the game crash, but luckily again phonecalls come to the rescue. Being on $OM=0 you are able to receive phonecalls, so you can go to Story Mission A, wait for your phone to ring (setting $OM=1), fail Trucking (setting $OM=0 with the phone ringing), start Story Mission A, cancel the phonecall (setting $OM=0) and then starting Story Mission A again. Another way would be holding the phonecall and failing Trucking immediately (setting $OM=0), which means you have a ringing phone while also being able to start missions.

So the overall process is:

  1. Phonecall start setup mission (with delayed $OM=1), so the phone is ringing during the setup mission
  2. Set $OM=0 while the phone is ringing, to be able to start a mission despite the phonecall:
    • Hold phonecall and fail setup mission immediately, then drive to the mission to dupe while holding the phonecall
    • Or drive to the mission to dupe, then hold phonecall and fail setup mission remotely/on a timer
  3. Start mission to dupe
  4. Cancel phonecall to set $OM=0 (if phonecall held let go/take it)
  5. Start mission to dupe again

Phonecall starting Setup Mission

As mentioned before, some missions don't set $OM=1 immediately when started, allowing for a phonecall to be received after starting the mission. These missions include:

Mission Delay Remote Fail Comments
Quarry 0ms 2:30 Timer or Satchel Huge Despawn Zone (radius 1000) making it impossible to keep a vehicle
Trucking 250ms 1:00 Timer after getting out of cab or disconnecting trailer or Satchel Medium Despawn Zone (about 10s sprinting)
Bike School 0ms Not possible Not an interior, but in a room only accessible through a small doorway
Blood Bowl 250ms Not possible Have to wait 30s inside the mission for it to fail

The delay refers to how often a check is performed as to whether the mission should be started. When a mission or group of missions becomes available (e.g. Bike School is unlocked), the script starts a new thread that continuosly checks in an endless loop if the player is in the marker and if other requirements for starting the mission are satisfied. Some of these loops have a small delay in between checks, while others have a delay of 0 (which probably means it's checked on every frame).

That delay can be relevant for phonecall starting the mission:

  • Quarry-style has a delay of 0ms, which means the mission starts immediately and thus before a phonecall, even if the phonecall is already ready to ring (but still prevented by e.g. being in a car or aiming a gun). So with the phonecall ready to ring as soon as you get off, this allows you to get off your bike directly into the marker and still start the mission before the phonecall.
  • Trucking-style has a 250ms delay, with phonecalls having a check delay ranging between 90ms and 1000ms (depending on which call it is), which means there is a good chance that the phonecall will come before the mission is started and setting $OM=1, thus preventing you from starting the mission until you cancel the call and try again. With this type of mission, you have to time the phonecall so that you receive it just after starting the mission. Pausebuffering after stepping into the marker can help to receive the phonecall and make the timing a bit easier.
    • Low-priority phonecalls (e.g. Catalina calls) have a 1000ms check delay, which means there is a decent chance that you can do Quarry-style phonecall starting even with Trucking or similiar missions, however this should only be used as a backup (e.g. if you know that you can't make it in time anymore and would have to wait 60s otherwise), since there is no guarantee that it will work.

Addendum

Mission Starter Thread Example

The following is an example of a thread in the mission script that is responsible for starting missions, in this case the Bike School mission. It checks a few prerequisites like if the player is on a mission and is in the mission marker, and then starts the mission. This is a rather simple example, other threads can e.g. decide which of several different missions of the same group to start. In addition, some threads will stop when all missions they can start are completed, however in this example it will run indefinitely, since Bike School can be repeated how often the player wants.

Notable about this one in particular is that it goes into a fade and starts the mission without setting $OM=1 (which is done on the mission). Other missions have the $OM=1 statement before the fade, after the script decided that it is going to start the mission.

:BIKES
thread 'BIKES' 

:BIKES_11
wait 0 
if 
  $ONMISSION == 0 
else_jump @BIKES_125 # Skip over starting the mission if $OM=1
if 
   Player.Defined($PLAYER_CHAR)
else_jump @BIKES_125
if 
00FF:   actor $PLAYER_ACTOR sphere 1 in_sphere $2370 $2371 $2372 radius 1.0 1.0 1.5 on_foot 
else_jump @BIKES_125 # Skip over starting the mission if player not in marker on foot
if 
   Player.Controllable($PLAYER_CHAR)
else_jump @BIKES_125 
Player.CanMove($PLAYER_CHAR) = False
gosub @LITCAS_267 # Fade
start_mission 120  // Bike School

:BIKES_125
jump @BIKES_11 # Jump to the start
Personal tools