- Marks the vehicle as no longer needed
- 01C3: mark_car_as_no_longer_needed [car handle]
- Car.RemoveReferences( [car handle] )
- [car handle]
- The handle of a vehicle; vehicle does not have to exist
- Native analog
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".
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 = [email protected] X_POS = [email protected] Y_POS = [email protected] Z_POS = [email protected] PONY_EXISTS = [email protected] 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
mark, remove, cleanup, reference, references, car, vehicle, no, longer, needed