Difference between revisions of "00A5"
Line 2: | Line 2: | ||
| ini = 00A5=5,%5d% %1o% %2d% %3d% %4d% | | ini = 00A5=5,%5d% %1o% %2d% %3d% %4d% | ||
| description = Creates a vehicle at a coordinate | | description = Creates a vehicle at a coordinate | ||
− | | p1 = Valid vehicle | + | | p1 = Valid vehicle model ID number as defined in the [[CARS (IDE Section)|CARS section]] of the [[IDE]] file |
| p2 = X-coordinate | | p2 = X-coordinate | ||
| p3 = Y-coordinate | | p3 = Y-coordinate | ||
Line 10: | Line 10: | ||
| native = [[CREATE_CAR]] | | native = [[CREATE_CAR]] | ||
}} | }} | ||
− | This creates a vehicle at a coordinate. Using this opcode requires [[0247]] or else the game might crash. Some cars are locked by default when created, including Enforcer, Police, and Rhino. Those can be unlocked using [[020A]]. Note that the fifth parameter is placed in the beginning instead of at the end. | + | 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. |
[[Sanny Builder]] example:<source lang="scm">00A5: 0@ = create_car #PONY at 0.0 0.0 0.0</source> | [[Sanny Builder]] example:<source lang="scm">00A5: 0@ = create_car #PONY at 0.0 0.0 0.0</source> | ||
Line 24: | Line 24: | ||
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. | 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]]'' | ||
<source lang="scm"> | <source lang="scm"> | ||
:LoadModel | :LoadModel |
Revision as of 01:51, 12 September 2010
{{{games}}}
- Description
- Creates a vehicle at a coordinate
- Syntax
- {{{syntax1}}}
- Parameter
- Native analog
- CREATE_CAR
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.
Sanny Builder example:
00A5: 0@ = create_car #PONY at 0.0 0.0 0.0
Notes
The above format is more commonly used. The actual format of this opcode is in order:
00A5=5,%1o% %2d% %3d% %4d% %5d%
The format to use depends on which INI file you use.
In Sanny Builder, this opcode is equivalent to the command Car.Create.
Example:
Car.Create(0@, #PONY, 0.0, 0.0, 0.0)
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
:LoadModel
0247: load_model #PONY
:CheckModel
0001: wait 0 ms
00D6: if 0
0248: model #PONY available
004D: jump_if_false @CheckModel
00A5: 0@ = create_car #PONY at 0.0 0.0 0.0
0249: release_model #PONY
004E: end_thread
Keywords
create, spawn, car, vehicle, model