Difference between revisions of "01C3"

From GTAMods Wiki
Jump to navigation Jump to search
(todo: make lists instead)
Line 2: Line 2:
 
<hr />
 
<hr />
 
'''Description'''
 
'''Description'''
: Removes references to a vehicle
+
: Marks the car as no longer needed
 
'''Syntax'''
 
'''Syntax'''
: 01C3: [''car handle'']
+
: 01C3: remove_references_to_car [''car handle'']
 
: Car.RemoveReferences( [''car handle''] )
 
: Car.RemoveReferences( [''car handle''] )
 
'''Parameter'''
 
'''Parameter'''
Line 12: Line 12:
 
: [[MARK_CAR_AS_NO_LONGER_NEEDED]]
 
: [[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 and treated similarly to traffic vehicles. 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 traffic vehicle so it will disappear like a traffic vehicle. This opcode should be used if the vehicle is spawned ([[00A5]], etc.) or grabbed from the streets ([[0327]], etc.). This opcode should not be used for other cases ([[03C0]], etc.). Using this with disregard will cause problems with other scripts trying to recognize a nonexistent vehicle.
+
This opcode marks the vehicle as no longer needed by the script. When vehicles are spawned ([[00A5]], etc.) or grabbed from the streets ([[0327]], etc.), without this opcode, the vehicle are treated as mission vehicles and will stay in the game for as long as it can. When the vehicle is marked no longer needed, it will be treated like a traffic vehicle and will disappear off-screen. The script will still continue to recognize the vehicle until the vehicle disappears entirely. 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 recognize the vehicle.
  
 
== Example ==
 
== 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. Pressing the CAMERA key will mark the Pony as no longer needed. After that, if left alone, the Pony will disappear like normal traffic vehicles.
+
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 the CAMERA key will mark the Pony as no longer needed. After that, if left alone, the Pony will disappear like normal traffic vehicles.
 
<source lang="scm">
 
<source lang="scm">
 
// set constants
 
// set constants
Line 43: Line 43:
 
PONY_EXISTS = true  // pony exists
 
PONY_EXISTS = true  // pony exists
  
// check the existence of and remove references to pony
+
// check the existence of and mark pony as no longer needed
 
while true
 
while true
 
     wait 10
 
     wait 10
Line 63: Line 63:
 
== Keywords ==
 
== Keywords ==
 
remove, cleanup, reference, references, car, vehicle
 
remove, cleanup, reference, references, car, vehicle
 +
 +
== See also ==
 +
*[[01C2]], for characters
 +
*[[01C4]], for objects
  
 
[[Category:OpCodes]]
 
[[Category:OpCodes]]

Revision as of 20:17, 24 January 2012

GTA III Vice City San Andreas


Description

Marks the car as no longer needed

Syntax

01C3: remove_references_to_car [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. When vehicles are spawned (00A5, etc.) or grabbed from the streets (0327, etc.), without this opcode, the vehicle are treated as mission vehicles and will stay in the game for as long as it can. When the vehicle is marked no longer needed, it will be treated like a traffic vehicle and will disappear off-screen. The script will still continue to recognize the vehicle until the vehicle disappears entirely. 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 recognize the vehicle.

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 the 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
repeat
    wait 0
    if
        0248:   model CAR_MODEL available
    then
        break
    end
until false
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: remove_references_to_car 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

remove, cleanup, reference, references, car, vehicle

See also