Difference between revisions of "00A5"

From GTAMods Wiki
Jump to navigation Jump to search
(Example)
(updating page)
Line 1: Line 1:
{{OpCode
+
{{Icon|trilogy}}
| ini        = 00A5=5,%5d% %1o% %2d% %3d% %4d%
+
<hr />
| description = Creates a vehicle at a coordinate
+
'''Description'''
| p1          = Valid vehicle model ID number as defined in the [[CARS (IDE Section)|CARS section]] of the [[IDE]] file
+
: Creates a vehicle at a point
| p2          = X-coordinate
+
'''Syntax'''
| p3          = Y-coordinate
+
: 00A5: [''var''] = create_car [''int''] at [''flt1''] [''flt2''] [''flt3'']
| p4          = Z-coordinate
+
: Car.Create( [''var''], [''int''], [''flt1''], [''flt2''], [''flt3''] )
| p5          = Vehicle handle
+
'''Parameter'''
| game        = [[GTA 3]], [[Vice City]], [[San Andreas]], [[Liberty City Stories]], [[Vice City Stories]] (0048)
+
: [''var'']
| native      = [[CREATE_CAR]]
+
:: Variable to store the handle of the vehicle
}}
+
: [''int'']
This creates a vehicle at a coordinate. 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 in the first parameter. Some cars are locked by default when created, including Enforcer, Police, and Rhino. Those can be unlocked using [[020A]]. All vehicles created by this opcode will become near-permanent in the game until opcode [[01C3]] is used to release them from memory. Note that the fifth parameter is placed in the beginning instead of at the end.
+
:: 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
[[Sanny Builder]] example:<source lang="scm">00A5: 0@ = create_car #PONY at 0.0 0.0 0.0</source>
+
: [''flt1'']
 +
:: X-coordinate
 +
: [''flt2'']
 +
:: Y-coordinate
 +
: [''flt3'']
 +
:: Z-coordinate
 +
'''Native analog'''
 +
: [[CREATE_CAR]]
  
==Notes==
+
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.
The above format is more commonly used. The actual format of this opcode is in order:<br>
 
<code>00A5=5,%1o% %2d% %3d% %4d% %5d%</code><br>
 
The format to use depends on which INI file you use.
 
 
 
In Sanny Builder, this opcode is equivalent to the command '''Car.Create'''.
 
Example: <source lang="scm">Car.Create(0@, #PONY, 0.0, 0.0, 0.0)</source>
 
  
 
==Example==
 
==Example==
Beginners have a hard time creating vehicles because it is tough to learn how to make a code that would create a vehicle successfully. This will be only shown as an example and shouldn't be copied verbatim. There are other ways of doing this. The following code uses the Sanny Builder.
+
:''See also: [[Spawn a vehicle]]''
 +
The following example, using Sanny Builder, will spawn a Pony close to the player character.
 +
<source lang="scm">
 +
// set constants
 +
const
 +
SPAWNED_CAR = 0@
 +
X_POS = 1@
 +
Y_POS = 2@
 +
Z_POS = 3@
 +
CAR_MODEL = #PONY
 +
end
  
<source lang="scm">
+
// spawn pony
:LoadModel
+
0247: request_model CAR_MODEL
0247: load_model #PONY
+
repeat
+
    wait 0
:CheckModel
+
    if
0001: wait 0 ms
+
        0248:  model CAR_MODEL available
00D6: if 0
+
    then
0248:  model #PONY available
+
        break
004D: jump_if_false @CheckModel
+
    end
00A5: 0@ = create_car #PONY at 0.0 0.0 0.0
+
until false
0249: release_model #PONY
+
00A0: store_actor $PLAYER_ACTOR position_to X_POS Y_POS Z_POS
004E: end_thread
+
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
 
</source>
 
</source>
''See also: [[Spawn a vehicle]]''
 
  
 
==Keywords==
 
==Keywords==

Revision as of 06:29, 19 August 2011

GTA III Vice City San Andreas


Description

Creates a vehicle at a point

Syntax

00A5: [var] = create_car [int] at [flt1] [flt2] [flt3]
Car.Create( [var], [int], [flt1], [flt2], [flt3] )

Parameter

[var]
Variable to store the handle of the vehicle
[int]
Valid vehicle model ID number 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

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.

Example

See also: Spawn a vehicle

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

// set constants
const
SPAWNED_CAR = 0@
X_POS = 1@
Y_POS = 2@
Z_POS = 3@
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
01C3: remove_references_to_car SPAWNED_CAR

Keywords

create, spawn, car, vehicle, model