Difference between revisions of "00A5"

From GTAMods Wiki
Jump to navigation Jump to search
(updating page)
(highlight)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Icon|trilogy}}
+
{{OpCode
<hr />
+
| games      = {{Icon|t}}
'''Description'''
+
| command    = CREATE_CAR
: Creates a vehicle at a point
+
| description = Creates a vehicle at the coordinates point
'''Syntax'''
+
| syntax1    = 00A5: [''var''] = create_car [''int''] at [''flt1''] [''flt2''] [''flt3'']
: 00A5: [''var''] = create_car [''int''] at [''flt1''] [''flt2''] [''flt3'']
+
| syntax2    = Car.Create( [''var''], [''int''], [''flt1''], [''flt2''], [''flt3''] )
: Car.Create( [''var''], [''int''], [''flt1''], [''flt2''], [''flt3''] )
+
| p1t        = [''int'']
'''Parameter'''
+
| p1d        = Valid model index as defined in the [[CARS (IDE Section)|CARS section]] of the [[IDE]] file; also acceptable is model's [[DFF]] name with a hash character
: [''var'']
+
| p2t        = [''flt1'']
:: Variable to store the handle of the vehicle
+
| p2d        = X-coordinate
: [''int'']
+
| p3t        = [''flt2'']
:: Valid vehicle model ID number as defined in the [[CARS (IDE Section)|CARS section]] of the [[IDE]] file; also acceptable is model's [[DFF]] name with a hash character
+
| p3d        = Y-coordinate
: [''flt1'']
+
| p4t        = [''flt3'']
:: X-coordinate
+
| p4d        = Z-coordinate (or &le;''-100.0'' for [[02CE|ground z]])
: [''flt2'']
+
| p5t        = [''var'']
:: Y-coordinate
+
| p5d        = Variable to store the handle of the vehicle
: [''flt3'']
+
| native      = [[CREATE_CAR]]
:: Z-coordinate
+
}}
'''Native analog'''
 
: [[CREATE_CAR]]
 
  
This creates a vehicle at a point. Using this opcode requires models loaded through opcode [[0247]] or else the game might crash. The major script editors like [[Sanny Builder]] support using the vehicle's DFF model name and automatically converts those values into integers upon compilation. Some cars are locked by default when spawned, including Enforcer, Police, and Rhino. Those can be unlocked using opcode [[020A]]. All vehicles created by this opcode will become near-permanent in the game until opcode [[01C3]] is used to release them from memory.
+
This opcode creates a vehicle at the coordinates point. Using this opcode requires the model to be already loaded, usually through opcode [[0247]], or else the game might crash. The major script editors like [[Sanny Builder]] support using the vehicle's DFF model name and automatically converts those values into integers upon compilation. The Enforcer, Police, and Rhino are locked initially (lock state 5) when spawned; they can be unlocked using opcode [[020A]] or if any driver exits the vehicle. All vehicles created by this opcode outside a [[Create a mission|mission]] will become near-permanent in the game until opcode [[01C3]] is used to mark it as no longer needed.
  
==Example==
+
== Example ==
 
:''See also: [[Spawn a vehicle]]''
 
:''See also: [[Spawn a vehicle]]''
 
The following example, using Sanny Builder, will spawn a Pony close to the player character.
 
The following example, using Sanny Builder, will spawn a Pony close to the player character.
<source lang="scm">
+
{{Pre|class=sb-code|1=
// set constants
+
<span class="k">const</span>
const
+
SPAWNED_CAR = <span class="nv">0@</span>
SPAWNED_CAR = 0@
+
X_POS = <span class="nv">1@</span>
X_POS = 1@
+
Y_POS = <span class="nv">2@</span>
Y_POS = 2@
+
Z_POS = <span class="nv">3@</span>
Z_POS = 3@
+
CAR_MODEL = <span class="nt">#PONY</span>  <span class="c1">// set your vehicle model</span>
CAR_MODEL = #PONY
+
<span class="k">end</span>
end
 
  
// spawn pony
+
[[0247]]: request_model CAR_MODEL
0247: request_model CAR_MODEL
+
[[038B]]: load_requested_models
repeat
+
[[00A0]]: store_actor <span class="nv">$PLAYER_ACTOR</span> position_to X_POS Y_POS Z_POS
    wait 0
+
X_POS += <span class="m">4.0</span>
    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
 
00A5: SPAWNED_CAR = create_car CAR_MODEL at X_POS Y_POS Z_POS
0249: release_model CAR_MODEL
+
[[0249]]: release_model CAR_MODEL
01C3: remove_references_to_car SPAWNED_CAR
+
[[01C3]]: remove_references_to_car SPAWNED_CAR
</source>
+
}}
  
==Keywords==
+
== Keywords ==
 
create, spawn, car, vehicle, model
 
create, spawn, car, vehicle, model
 
[[Category:OpCodes]]
 

Latest revision as of 01:47, 4 December 2016

GTA III Vice City San Andreas CREATE_CAR


Description
Creates a vehicle at the coordinates point
Syntax
00A5: [var] = create_car [int] at [flt1] [flt2] [flt3]
Car.Create( [var], [int], [flt1], [flt2], [flt3] )
Parameter
[int]
Valid model index as defined in the CARS section of the IDE file; also acceptable is model's DFF name with a hash character
[flt1]
X-coordinate
[flt2]
Y-coordinate
[flt3]
Z-coordinate (or ≤-100.0 for ground z)
[var]
Variable to store the handle of the vehicle
Native analog
CREATE_CAR

This opcode creates a vehicle at the coordinates point. Using this opcode requires the model to be already loaded, usually through opcode 0247, or else the game might crash. The major script editors like Sanny Builder support using the vehicle's DFF model name and automatically converts those values into integers upon compilation. The Enforcer, Police, and Rhino are locked initially (lock state 5) when spawned; they can be unlocked using opcode 020A or if any driver exits the vehicle. All vehicles created by this opcode outside a mission will become near-permanent in the game until opcode 01C3 is used to mark it as no longer needed.

Example

See also: Spawn a vehicle

The following example, using Sanny Builder, will spawn a Pony close to the player character.

const
SPAWNED_CAR = 0@
X_POS = 1@
Y_POS = 2@
Z_POS = 3@
CAR_MODEL = #PONY  // set your vehicle model
end

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
01C3: remove_references_to_car SPAWNED_CAR

Keywords

create, spawn, car, vehicle, model