Difference between revisions of "00A5"

From GTAMods Wiki
Jump to navigation Jump to search
 
(highlight)
 
(16 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<code>00A5=5,%1o% %2d% %3d% %4d% %5d%</code><br>
+
{{OpCode
'''Description''': Creates a vehicle at a coordinate<br>
+
| games      = {{Icon|t}}
'''Parameter 1''': [[DFF]] model name or ID<br>
+
| command    = CREATE_CAR
'''Parameter 2''': X-coordinate<br>
+
| description = Creates a vehicle at the coordinates point
'''Parameter 3''': Y-coordinate<br>
+
| syntax1    = 00A5: [''var''] = create_car [''int''] at [''flt1''] [''flt2''] [''flt3'']
'''Parameter 4''': Z-coordinate<br>
+
| syntax2    = Car.Create( [''var''], [''int''], [''flt1''], [''flt2''], [''flt3''] )
'''Parameter 5''': Vehicle handle<br>
+
| p1t        = [''int'']
'''Supports''': GTA3, Vice City, San Andreas<br>
+
| 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
 +
| p2t        = [''flt1'']
 +
| p2d        = X-coordinate
 +
| p3t        = [''flt2'']
 +
| p3d        = Y-coordinate
 +
| p4t        = [''flt3'']
 +
| p4d        = Z-coordinate (or &le;''-100.0'' for [[02CE|ground z]])
 +
| p5t        = [''var'']
 +
| p5d        = Variable to store the handle of the vehicle
 +
| native      = [[CREATE_CAR]]
 +
}}
  
This creates a vehicle at a coordinate. Using this opcode requires [[0247]] or else the game would crash.
+
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.
  
==Note==
+
== Example ==
Sometimes this opcode is written as this:<br>
+
:''See also: [[Spawn a vehicle]]''
<code>00A5=5,%5d% %1o% %2d% %3d% %4d%</code><br>
+
The following example, using Sanny Builder, will spawn a Pony close to the player character.
The fifth parameter is placed in the beginning instead of at the end. This depends on which sascm.ini file you use.<br>
+
{{Pre|class=sb-code|1=
[[Mission_Scripting_%28Overview%29#Sanny_Builder|Sanny Builder]] by default:
+
<span class="k">const</span>
<code>00A5: 0@ = create_car #PONY at 0.0 0.0 0.0</code>
+
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>
 +
CAR_MODEL = <span class="nt">#PONY</span>  <span class="c1">// set your vehicle model</span>
 +
<span class="k">end</span>
  
==Example==
+
[[0247]]: request_model CAR_MODEL
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 word for word. There are other ways of doing this. The following code uses the Sanny Builder.
+
[[038B]]: load_requested_models
 +
[[00A0]]: store_actor <span class="nv">$PLAYER_ACTOR</span> position_to X_POS Y_POS Z_POS
 +
X_POS += <span class="m">4.0</span>
 +
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
 +
}}
  
<code>:LoadModel<br></code>
+
== Keywords ==
<code>[[0247]]: load_model #PONY</code><br>
+
create, spawn, car, vehicle, model
<code></code><br>
 
<code>:CheckModel</code><br>
 
<code>[[0001]]: wait 0 ms</code><br>
 
<code>[[00D6]]: if 0</code><br>
 
<code>[[0248]]: model #PONY available</code><br>
 
<code>[[004D]]: jump_if_false @CheckModel</code><br>
 
<code>00A5: 0@ = create_car #PONY at 0.0 0.0 0.0</code><br>
 
<code>[[0249]]: release_model #PONY</code><br>
 
<code>[[004E]]: end_thread</code>
 
 
 
==Keywords==
 
create, 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