Grand Theft Auto: San Andreas/Game Mechanics and Glitches/Duping
From SDA Knowledge Base
The information on this page mostly applies to the PC 1.x versions of the game. Duping doesn't seem to fully work on the Steam or Console versions. |
Duping is the duplication of missions, which means starting several instances of the same mission on top of eachother.
Related interesting pages:
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:
- Phonecall start setup mission (with delayed $OM=1), so the phone is ringing during the setup mission
- 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
- Start mission to dupe
- Cancel phonecall to set $OM=0 (if phonecall held let go/take it)
- 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). Remote failing can be useful because never getting into the truck prevents traffic from spawning. |
Bike School | 0ms | Not possible, you have to hold the call before exiting the mission | Not an interior, but in a room only accessible through a small doorway, so only bikes are suitable for parking next to the marker. |
Blood Bowl | 250ms | Not possible, you have to hold the call before exiting the mission | Have to wait 30s inside the mission for it to fail, failing it by dying doesn't seem to work. Gives SMG, setting ammo after the timer runs out to what you had before (but only the SMG ammo you had before, so if you had e.g. Uzi you are left with no ammo, just an empty SMG, which is actually good if you use a bike while holding the phonecall). |
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 check delay of 0ms, which means the mission triggers immediately as you enter the marker. So if you are parked next to the Quarry marker, with a call ready to ring as you exit the car, the mission will trigger as soon as you are on foot, with the call taking a bit longer and ringing a few milliseconds after during the fade. So the only thing you have to be careful about is that the call is already ready as you leave your car into the Quarry marker.
- An exception where additional care is required are low-priority calls (Catalina), which have a 1000ms check delay, so they can take longer than the fade to trigger, so Pausebuffering is advised (see explanation below).
- Trucking-style has a 250ms check delay, with phonecalls having a check delay ranging between 90ms and 1000ms (depending on which call thread it is part of), which means if you were to exit a vehicle directly into the marker with a call ready, there is a good chance that the phone will ring before the mission is triggered, the ringing setting $OM=1, thus preventing you from starting the mission (in which case you would have to cancel the call and try again). With this type of mission, you have to time it so that you enter the marker before the call is ready, so you receive it just after triggering the mission. Pausebuffering can make the timing a bit easier (see explanation below).
- 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.
The check delay of Phonecalls (and other interesting stuff) is documented on the Phonecalls page.
Pause Buffering
Pausebuffering can help with receiving the phonecall on time after entering the setup mission marker. Pausing/unpausing apparently injects frames and advances the timer that triggers the call, so you basicially make it ring faster (as far as the game is concerned, not in real time).
For example if the window of opportunity for the phone to ring during the fade of the Setup Mission is 500ms long, but you enter the marker 1 second before the phone will ring, then usually it wouldn't ring in time. However you can pausebuffer to make the phone timer advance faster, so the phone will ring earlier than it should be. To know when to stop Pausebuffering, pay attention to either the ringing sound or the info popup that tells you how to answer the phone.
Pausebuffering is especially useful for Trucking-style setup so you don't have to time the call exactly, but is also necessary for Quarry-style setup when using low-priority calls, which have a check delay of 1000ms and may not ring in time during the short fade-out.
Note on Blood Bowl & Bike School
After you phonecall started the mission, you are inside the mission and can't freely move around. For Blood Bowl you are in an interior and Bike School in the menu, so you can only fail the mission immediately. Hold the call before exiting the mission to get an $OM=0 call you can dupe with.
Blood bowl is interesting in that regard because when you call start the mission, you are put inside an interior, which cancels the call, setting $OM=0 while inside the Stadium. After waiting for the mission timer to run out and the mission to fail, the next high-priority call will already be ready again, but not ringing yet, because you're in an interior. Once the mission fails, it puts you outside, the phone rings and then a fraction of a second later the mission will finish cleaning up and set $OM=0 again, with the phone still ringing, now being an $OM=0 call you can dupe with.
Another side effect of the Blood Bowl duping setup is that you get to keep your weapons when dying once after that. The mission lets your keep your weapons when you die inside the mission, however doing the duping setup doesn't properly clear up that "keep your weapons when dying" flag, which means you can die once after Blood Bowl and still keep all your weapons (but you still get warped to a hospital as usual). Important: If you die and keep your weapons while having a parachute, that parachute will not actually work despite still being equipped (the parachute doesn't load properly and you will die when hitting the ground). You can save/reload (no need to restart the game) to fix the parachute. Simply picking up another parachute doesn't appear to work, the parachute still doesn't open properly. This is especially important for Stowaway where you require a working parachute.
Phonecall timing
Phonecalls are on a fixed recall delay, so you'll know when to expect a call. Read the page about Phonecalls for information on the specific recall and check delays and what calls there are.
For the Quarry-style setup you just have to know that the phone is ready to ring when you get out your vehicle into the marker. For the Trucking-style setup, you would get out of your vehicle a bit early, let the phone ring, cancel it, make a note of the time and calculate when it will ring again and then make your way to the setup mission marker, entering it at the right time. This way you don't have to wait the whole recall delay in front of the marker. Another way, if you get the call earlier than you would want to cancel it, is hold the call in your vehicle while driving to the setup mission and then let go of holding at a point from where you can make it to the setup mission marker in time. This way you can get nice timing without having to get out/in your vehicle again, in case you already received the phonecall before anyway (e.g. if you fell of your bike).
Holding phonecalls
Unless you're going to wait for the timer of the setup mission to run out, you're going to need to hold the phonecall in order to not cancel it when failing the setup mission. Holding a call means sort of keeping it in a state of answering it, but note quite answering it yet. This way it can persist through you using most weapons, cutscenes, missions fails and entering a vehicle. This is in particulary necessary for missions like Bike School, where you have to quit the mission immediately and can't remote fail it. So you have to phonecall start the mission, then hold the call and quit out of it, holding the call all the way to the marker of the mission to dupe.
Duping with $OM=0 phonecall
Once you failed the setup mission and now have the phone ringing with $OM=0 (either failing the setup mission immediately and holding call all the way, or remote failing the setup mission in front of the mission marker), you can do the actual dupe.
Usually you want to start the mission, wait for the cutscene (don't skip it) and then let go of holding the call. This will:
- Cancel the call immediately for cutscenes that take place in an interior (because you can't take calls in interiors, just like you can't take calls in vehicles and letting go of holding a call will just cancel it immediately)
- Take the call for cutscenes that take place outside, in which case you have to also spam F (or whatever the appropriate key is) to put down the call
Duping the mission while inside a cutscene is required for missions that are nothing more than a cutscene (e.g. Verdant Meadows, where skipping the cutscene would immediately complete the mission and not allow you to start it again) and usually recommended for other missions, because it starts the mission in the context of the cutscene, which means no traffic on the roads (and if the cutscene takes place in an interior, funky interior sky).
In order to successfully dupe inside cutscenes, it's important to note that CJ has to be standing inside the mission marker during the cutscene. So make sure you don't sprint into and thus accidentally past the marker when starting the mission for the first time. In addition, some missions will make CJ walk a bit during the fade (usually towards the door of where the cutscene takes place), which can make him walk out of the marker. So make sure to enter the marker carefully from the other side of where CJ will walk towards, so that he stays in the marker and you can start the mission again while in the cutscene. This is especially important for missions like Fish in a Barrel, that only consist of a cutscene.
You can usually also dupe outside of cutscenes, however besides that you still get traffic, it can apparently sometimes cause issues if you skip the cutscene to quickly.
When you have to take the call to dupe (either because the cutscene is outside or because you let go of holding the call outside the cutscene), you actually do take the call, which means it's not available anymore, as opposed to the other way, where the call is merely cancelled and still available later.
Why is duping useful?
Duping a mission can have different results, depending on the mission:
- The duped mission crashes the game at some point
- Only one instance of the mission passes, while the other keeps running, crashing the game when a different mission is started
- One instance of the mission passes, but the other one fails (for example when a mission character who has to survive is destroyed by the cleanup of one instance passing, the other instance can fail)
- Both instances of the mission pass, with the same results as if you had done it twice (if that were possible otherwise)
In the last case, where the mission basicially passes twice, there are two different ways this can affect the game, again depending on the mission:
- If this mission starts another thread of missions when passed, that thread is started twice, which causes all the following missions in that thread to be started twice. Depending on how the missions in the thread can be duped, this will possibly crash the game eventually.
- The mission simply passes twice, increasing the counters of the chain of missions it is part of
As you can probably tell by now, not all dupes are actually useful. The last one, both instances pass and the mission simply passes twice increasing some counters, is the most common dupe.
Mission Chains
- See also: Mission Chains
What makes passing the same mission twice useful is how the game decides which mission to start. As soon as a group of missions is unlocked the game starts a separate thread that continuously checks if the player is in the mission marker. If there is only one mission available for that marker, like in the Mission Starter Thread Example below for Bike School, it simply starts that mission. However most missions are part of a longer chain of missions, so it has to decide which of those missions to start. To track progress, the game has different variables for each chain, where it simply counts how many missions of that chain have already been completed.
For example the Woozie missions in San Fierro have the variable $WUZIMU_TOTAL_PASSED_MISSIONS
:
- Mountain Cloud Boys
- Ran Fa Li
- Lure
- Amphibious Assault
- The Da Nang Thang
So at first the variable is 0, then increases to 1 by passing Mountain Cloud Boys, which the game then uses to determine that the next mission must be Ran Fa Li, which then increases it to 2, making the next mission Lure and so on.
Duping and finishing Ran Fa Li makes that mission pass twice, which also increases the counter twice, so $WUZIMU_TOTAL_PASSED_MISSIONS
would now be at 3 after Ran Fa Li, instead of 2 as it should be. When you now start the next Woozie mission, the game will check the variable (which looks like it would after passing Lure) and start Amphibious Assault, skipping Lure.
Some missions may have additional requirements than that to be started, for example the missions after Learning to Fly specifically require Flightschool to be passed, which is an addtional separate variable. So in that case duping Verdant Meadows doesn't skip Flightschool, even though it is the next mission. It instead skips N.O.E. because passing Flightschool also increases the progress variable, in addition to the variable that sets Flightschool as being completed.
Phonecall Management
San Fierro
- This includes the dupes until Verdant Meadows because calls unlocked in San Fierro are relevant until then
The Zero call is unlocked after "Wear Flowers In Your Hair" and the Jethro (Driving School) call after "Deconstruction". Both of these calls you don't have to answer until the Monster mission, so they can be used for duping. At first, you shouldn't answer any calls in San Fierro, except for the one that unlocks the Woozie missions, which gets unlocked after finishing "Jizzy". None of the dupes in San Fierro (if done correctly) use up phonecalls, but it's just safer to have 2 calls and it shouldn't make any difference time-wise.
You can start answering calls after the dupes, so after Amphibious Assault. There is a chance right before Pier 69, before Toreno's Last Flight and before Yay-Ka-Boom-Boom. You have to answer all high-priority calls before you can take the call that unlocks Monster.You have to make sure not to answer the Catalina call, which is required to dupe Highjack. You can tell if you answered the Zero and Jethro calls already by looking at the blips on the minimap (outside missions/calls of course). If you did answer both already, you shouldn't answer any other calls until after Yay-Ka-Boom-Boom, where you take one call to unlock Monster.
If you want to make really sure to not answer the Catalina call, you shouldn't answer any call when it's been more than 60s since the last call/mission. For one, this ensures that you don't accidentally answer another call after already answering all high-priority ones, but there is also the (very low) chance that the Catalina call will ring even if you still do have high-priority (15s) calls (if the phone timer is at more than 60s). The Catalina call unlocks after completing Ran Fa Li. On the way to Monster taking the boat automatically gives you an opportunity to answer the Monster call way before 60s have passed since finishing Yay Ka-Boom-Boom.
There is also the Truth call from "Are You Going To San Fierro?", which you can choose to skip and start the mission anyway. However you don't really need it and since it's in another thread it's kind of random when you get it. So it probably makes more sense to just get it out of the way and take it before the mission, as intended.
For duping Highjack the Catalina call is used. For duping Verdant Meadows the call for Interdiction is used, which doesn't need to be taken because Interdiction is skipped. The mission marker for Verdant Meadows will be invisible when you skipped Interdiction and didn't answer the call, but you can still start the mission.
So the recommended approach is:
- Remember if you answered the Truth call before "Are You Going To San Fierro?"
- It probably makes sense to answer it, because it's kind of random when you will get it between the other calls
- Don't answer any calls, except one after Jizzy to unlock Woozie missions
- Usually the Woozie call is answered right before where the Woozie mission will appear
- Start answering calls after the dupes, don't answer the Catalina call
- Check the blips on the minimap to double-check which ones you already answered
- Answer one call after Yay-Ka-Boom-Boom to unlock Monster
- Answer one call after Monster to unlock Highjack
- Don't answer any more calls until after the Verdant Meadows dupe
- Never answer any calls after Ran Fa Li more than 60s after the last mission to keep the Catalina call
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 then done in the actual mission script). This provides a small gap where you can take a phonecall, with the mission already on track to be started without further checks. Other missions set $OM=1 before the fade, right 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