Difference between revisions of "Grand Theft Auto: San Andreas/Game Mechanics and Glitches/Duping"

From SDA Knowledge Base

Jump to: navigation, search
(Addendum)
(Mission Chains)
Line 110: Line 110:
 
:''See also: [[Grand_Theft_Auto:_San_Andreas/Missions/Chains|Mission Chains]]''
 
:''See also: [[Grand_Theft_Auto:_San_Andreas/Missions/Chains|Mission Chains]]''
  
What makes passing the same mission twice 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.
+
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 <code>$WUZIMU_TOTAL_PASSED_MISSIONS</code>:
 
For example the Woozie missions in San Fierro have the variable <code>$WUZIMU_TOTAL_PASSED_MISSIONS</code>:

Revision as of 10:37, 11 December 2015

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, you have to hold the call before exiting the mission Not an interior, but in a room only accessible through a small doorway
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

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.

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).

Phonecalls also have a similiar check delay, read about it on the Phonecalls page.

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:

  1. Mountain Cloud Boys
  2. Ran Fa Li
  3. Lure
  4. Amphibious Assault
  5. 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.

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
Personal tools