Difference between revisions of "01C3"

From GTAMods Wiki
Jump to navigation Jump to search
m (Example)
(highlight)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Icon|trilogy}}
+
{{OpCode
<hr />
+
| games      = {{Icon|t}}
'''Description'''
+
| command    = MARK_<wbr>CAR_<wbr>AS_<wbr>NO_<wbr>LONGER_<wbr>NEEDED
: Removes references to a vehicle
+
| description = Marks the vehicle as no longer needed
'''Syntaxes'''
+
| syntax1    = 01C3: mark_car_as_no_longer_needed [''car handle'']
: Sanny Builder
+
| syntax2    = Car.RemoveReferences( [''car handle''] )
:: 01C3: [''car handle'']
+
| p1t        = [''car handle'']
:: Car.RemoveReferences( [''car handle''] )
+
| p1d        = The handle of a vehicle; vehicle does not have to exist
: Mission Builder
+
| native      = [[MARK_CAR_AS_NO_LONGER_NEEDED]]
:: 01C3: [''car handle'']
+
}}
: GTAMA
 
:: cleanup_car [''car handle'']
 
: Point
 
:: CleanupCar( [''car handle''] )
 
: raw binary
 
:: <code>C3 01 [data type] [''car handle'']</code>
 
'''Parameter'''
 
: [''car handle'']
 
:: The handle of a vehicle; vehicle does not have to exist
 
'''Native analog'''
 
: [[MARK_CAR_AS_NO_LONGER_NEEDED]]
 
  
This opcode will mark the vehicle as no longer needed. The vehicle will no longer be remembered by the game. If you want your vehicle to disappear after it is destroyed or after you are finished with it, use this opcode to make it into a random traffic vehicle so it will disappear like a traffic vehicle. This opcode is only needed when the vehicle is spawned ([[00A5]], etc.) or grabbed from the streets ([[0327]], etc.). This opcode is not needed for any other cases. Using this with disregard will cause problems with other scripts trying to recognize the same vehicle.
+
This opcode marks the vehicle as no longer needed by the script and turns it into a traffic vehicle. When a vehicle is spawned ([[00A5]], etc.) or grabbed from the world ([[0327]], etc.), the vehicle will remain in the game without despawning until this opcode is called. If spawned during a [[Create a mission|mission]], calling the [[00D8|mission cleanup routine]] automatically marks any vehicles spawned during the mission as no longer needed. When the vehicle is marked no longer needed, it will be treated like a traffic vehicle and will disappear off-screen. However, as long as the vehicle remains on-screen, the script can continue to recognize the vehicle until it disappears. Opcodes that grabs the handle of the vehicle ([[03C0]], etc.) do not treat vehicles as mission vehicles, so using this opcode with disregard will cause problems with other scripts (like during missions) trying to look for the vehicle. Alternative documentation names this opcode as "remove references to car".
  
 +
== Example ==
 +
The following example, using Sanny Builder, will spawn a Pony close to the player character. A number is displayed on the screen to show the existence of the Pony; 0 means it does not exist and 1 means it does. If the Pony is left alone, it will not disappear. Pressing [[00E1|button 13]] (CAMERA key) will mark the Pony as no longer needed. After that, if left alone, the Pony will disappear like normal traffic vehicles.
 +
{{Pre|class=sb-code|1=
 +
<span class="c1">// set constants</span>
 +
<span class="k">const</span>
 +
SPAWNED_CAR = <span class="nv">0@</span>
 +
X_POS = <span class="nv">1@</span>
 +
Y_POS = <span class="nv">2@</span>
 +
Z_POS = <span class="nv">3@</span>
 +
PONY_EXISTS = <span class="nv">4@</span>
 +
CAR_MODEL = <span class="nt">#PONY</span>
 +
<span class="k">end</span>
  
{{Icon|LCS}}
+
<span class="c1">// spawn pony</span>
<hr />
+
[[0247]]: request_model CAR_MODEL
Equivalent opcode: 01C8
+
[[038B]]: load_requested_models
<br />
+
[[00A0]]: store_actor <span class="nv">$PLAYER_ACTOR</span> position_to X_POS Y_POS Z_POS
For the usage of 01C3 in the script, see [[01BE]].
+
X_POS += <span class="m">4.0</span>
 
+
[[00A5]]: SPAWNED_CAR = create_car CAR_MODEL at X_POS Y_POS Z_POS
{{Icon|VCS}}
+
[[0249]]: release_model CAR_MODEL
<hr />
+
PONY_EXISTS = <span class="k">true</span> <span class="c1">// pony exists</span>
Equivalent opcode: 0113
 
 
 
== Example ==
 
The following example, using Sanny Builder, will spawn a Pony in front of the player character. A number is displayed on the screen to show the existence of the Pony, 0 means it does not exist while 1 means it does. Pressing the ACTION key will mark the Pony as no longer needed. If left alone, the Pony will disappear like normal traffic vehicles.
 
<source lang="scm">
 
// spawn pony
 
Model.Load(#PONY)
 
repeat
 
    wait 0
 
    if
 
        #PONY.Available()
 
    then
 
        break
 
    end
 
until false
 
Actor.StorePos($PLAYER_ACTOR, 1@, 2@, 3@)
 
2@ += 3.0
 
Car.Create(0@, #PONY, 1@, 2@, 3@)
 
Model.Destroy(#PONY)
 
1@ = 1 // pony exists
 
  
// check the existence of and remove references to pony
+
<span class="c1">// check the existence of and mark pony as no longer needed</span>
while true
+
<span class="k">while</span> <span class="k">true</span>
     wait 10
+
     <span class="k">wait</span> <span class="m">10</span>
     if  
+
     <span class="k">if</span>
         00E1:  key_pressed 0 4 // action key
+
         [[00E1]]:  key_pressed <span class="m">0</span> <span class="m">13</span> <span class="c1">// camera key</span>
     then
+
     <span class="k">then</span>
         Car.RemoveReferences(0@)
+
         01C3: mark_car_as_no_longer_needed SPAWNED_CAR
     end
+
     <span class="k">end</span>
     if
+
     <span class="k">if</span>
         Car.Wrecked(0@)
+
         [[0119]]:  car SPAWNED_CAR wrecked
     then
+
     <span class="k">then</span>
         1@ = 0 // pony does not exist
+
         PONY_EXISTS = <span class="k">false</span> <span class="c1">// pony does not exist</span>
     end
+
     <span class="k">end</span>
     // display existence of pony as a number onscreen
+
     <span class="c1">// display existence of pony as a number onscreen</span>
     01E5: text_1number_highpriority 'NUMBER' 1@ 10 ms 1
+
     01E5: text_1number_highpriority <span class="s1">'NUMBER'</span> PONY_EXISTS <span class="m">10</span> ms <span class="m">1</span>
end
+
<span class="k">end</span>
</source>
+
}}
  
 
== Keywords ==
 
== Keywords ==
remove, cleanup, reference, references, car, vehicle
+
mark, remove, cleanup, reference, references, car, vehicle, no, longer, needed
  
[[Category:OpCodes]]
+
== See also ==
 +
* {{Icon|t}} [[01C2]], for characters
 +
* {{Icon|t}} [[01C4]], for objects

Latest revision as of 02:03, 12 December 2016

GTA III Vice City San Andreas MARK_CAR_AS_NO_LONGER_NEEDED


Description
Marks the vehicle as no longer needed
Syntax
01C3: mark_car_as_no_longer_needed [car handle]
Car.RemoveReferences( [car handle] )
Parameter
[car handle]
The handle of a vehicle; vehicle does not have to exist
Native analog
MARK_CAR_AS_NO_LONGER_NEEDED

This opcode marks the vehicle as no longer needed by the script and turns it into a traffic vehicle. When a vehicle is spawned (00A5, etc.) or grabbed from the world (0327, etc.), the vehicle will remain in the game without despawning until this opcode is called. If spawned during a mission, calling the mission cleanup routine automatically marks any vehicles spawned during the mission as no longer needed. When the vehicle is marked no longer needed, it will be treated like a traffic vehicle and will disappear off-screen. However, as long as the vehicle remains on-screen, the script can continue to recognize the vehicle until it disappears. Opcodes that grabs the handle of the vehicle (03C0, etc.) do not treat vehicles as mission vehicles, so using this opcode with disregard will cause problems with other scripts (like during missions) trying to look for the vehicle. Alternative documentation names this opcode as "remove references to car".

Example

The following example, using Sanny Builder, will spawn a Pony close to the player character. A number is displayed on the screen to show the existence of the Pony; 0 means it does not exist and 1 means it does. If the Pony is left alone, it will not disappear. Pressing button 13 (CAMERA key) will mark the Pony as no longer needed. After that, if left alone, the Pony will disappear like normal traffic vehicles.

// set constants
const
SPAWNED_CAR = 0@
X_POS = 1@
Y_POS = 2@
Z_POS = 3@
PONY_EXISTS = 4@
CAR_MODEL = #PONY
end

// spawn pony
0247: request_model CAR_MODEL
038B: load_requested_models
00A0: store_actor $PLAYER_ACTOR position_to X_POS Y_POS Z_POS
X_POS += 4.0
00A5: SPAWNED_CAR = create_car CAR_MODEL at X_POS Y_POS Z_POS
0249: release_model CAR_MODEL
PONY_EXISTS = true  // pony exists

// check the existence of and mark pony as no longer needed
while true
    wait 10
    if 
        00E1:   key_pressed 0 13  // camera key
    then
        01C3: mark_car_as_no_longer_needed SPAWNED_CAR
    end
    if
        0119:   car SPAWNED_CAR wrecked
    then
        PONY_EXISTS = false  // pony does not exist
    end
    // display existence of pony as a number onscreen
    01E5: text_1number_highpriority 'NUMBER' PONY_EXISTS 10 ms 1
end

Keywords

mark, remove, cleanup, reference, references, car, vehicle, no, longer, needed

See also

  • GTA III Vice City San Andreas 01C2, for characters
  • GTA III Vice City San Andreas 01C4, for objects