Difference between revisions of "009A"

From GTAMods Wiki
Jump to navigation Jump to search
(updating page)
Line 1: Line 1:
{{OpCode
+
{{Icon|trilogy}}
| ini        = 009A=6,{{hint|%6d%|parameter 6: handle}} {{hint|%1d%|parameter 1: integer}} {{hint|%2o%|parameter 2: integer}} {{hint|%3d%|parameter 3: float}} {{hint|%4d%|parameter 4: float}} {{hint|%5d%|parameter 5: float}}
+
<hr />
| description = Creates a ped at a coordinate
+
'''Description'''
| p1          = [[Ped type]]
+
: Spawns a character at a point
| p2          = Valid character model ID number as defined in the [[PEDS|PEDS section]] of the [[IDE]] file
+
'''Syntax'''
| p3          = X-coordinate
+
: 009A: [''var''] = create_actor [''int1''] [''int2''] at [''flt1''] [''flt2''] [''flt3'']
| p4          = Y-coordinate
+
: Actor.Create( [''var''], [''int1''], [''int2''], [''flt1''], [''flt2''], [''flt3''] )
| p5          = Z-coordinate
+
'''Parameter'''
| p6          = Character handle
+
: [''var'']
| game        = [[GTA 3]], [[Vice City]], [[San Andreas]], [[Liberty City Stories]], [[Vice City Stories]] (003E)
+
:: Variable to store the handle of the character
| native      = [[CREATE_CHAR]]
+
: [''int1'']
}}
+
:: [[Ped type]]
This creates a character at a coordinate. Using this opcode requires the model to be loaded through opcode [[0247]] or else the game might crash. Most script editors like [[Sanny Builder]] support using the character's [[DFF]] model name in the second parameter. Once spawned, the character will be permanent in the game even after it dies or after you die or get busted. If you no longer need your character anymore, you could turn it into a random ped using opcode [[01C2]] or destroy it instantly using opcodes [[009B]] or [[034F]]. Note that the sixth parameter is placed in the beginning instead of at the end.
+
: [''int2'']
[[Sanny Builder]] example:<source lang="scm">009A: 0@ = create_actor_pedtype 4 model #BFORI at 0.0 0.0 0.0</source>
+
:: Valid character model ID number as defined in the [[PEDS|PEDS 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_CHAR]]
  
==Notes==
+
This spawns a character at a point. Using this opcode requires the model to be loaded through opcode [[0247]] or else the game might crash. The major script editors like [[Sanny Builder]] support using the character's DFF model name and automatically converts those values into integers upon compilation. Once spawned, the character will be permanent in the game even after it dies or after you die or get busted. If you no longer need your character anymore, you could turn it into a random ped using opcode [[01C2]] or destroy it instantly using opcodes [[009B]] or [[034F]].
The above format is more commonly used. The actual format of this opcode is in order:<br>
 
<code>009A=6,%1d% %2o% %3d% %4d% %5d% %6d%</code><br>
 
The format to use depends on which INI file you use.
 
  
In Sanny Builder, this opcode is equivalent to the command '''Actor.Create'''.
+
== Example ==
Example: <source lang="scm">Actor.Create(0@, 4, #BFORI, 0.0, 0.0, 0.0)</source>
+
:''See also: [[Spawn a ped]]''
 +
The following example, using Sanny Builder, will spawn a ped close to the player character.
 +
<source lang="scm">
 +
// set constants
 +
const
 +
CHAR_MODEL = #BFORI
 +
SPAWNED_CHAR = 0@
 +
X_POS = 1@
 +
Y_POS = 2@
 +
Z_POS = 3@
 +
end
  
==Example==
+
// load model, required to prevent unnecessary crash!
:''Main article: [[Spawn a ped]]''
+
0247: request_model CHAR_MODEL
This is an example code and should not be copied verbatim. The following code is for San Andreas using Sanny Builder's format.
+
// check if model is loaded
<source lang="scm">
+
repeat
:LoadModel
+
    wait 0
0247: load_model #BFORI
+
    if
+
        0248:  model CHAR_MODEL available
:CheckModel
+
    then
0001: wait 0 ms
+
        break
00D6: if
+
    end
0248:  model #BFORI available
+
until false
004D: jump_if_false @CheckModel
+
// spawn character
009A: 0@ = create_actor_pedtype 4 model #BFORI at 0.0 0.0 0.0
+
00A0: store_actor $PLAYER_ACTOR position_to X_POS Y_POS Z_POS
0249: release_model #BFORI
+
X_POS += 4.0
004E: end_thread
+
009A: SPAWNED_CHAR = create_actor 4 CHAR_MODEL at X_POS Y_POS Z_POS
 +
// cleanup
 +
0249: release_model CHAR_MODEL
 +
01C2: remove_references_to_actor CHAR_MODEL
 
</source>
 
</source>
  
==Special Peds==
+
== Special Peds ==
 
Special peds uses models <code>SPECIAL#.dff</code>, where <i>#</i> is a number from <i>01</i> to <i>04</i> in GTA3, <i>01</i> to <i>21</i> in Vice City, and <i>01</i> to <i>10</i> in San Andreas. It is used in conjunction with [[023C]]. The special actor ID number corresponds to the number in <code>SPECIAL#.dff</code>. You do not have to load <code>SPECIAL#.dff</code> as it is always loaded into the game. Each special actor ID can accommodate only one special ped at a time and can be replaced by another special ped if the other special ped has the same ID.
 
Special peds uses models <code>SPECIAL#.dff</code>, where <i>#</i> is a number from <i>01</i> to <i>04</i> in GTA3, <i>01</i> to <i>21</i> in Vice City, and <i>01</i> to <i>10</i> in San Andreas. It is used in conjunction with [[023C]]. The special actor ID number corresponds to the number in <code>SPECIAL#.dff</code>. You do not have to load <code>SPECIAL#.dff</code> as it is always loaded into the game. Each special actor ID can accommodate only one special ped at a time and can be replaced by another special ped if the other special ped has the same ID.
  
 
In GTA 3 and Vice City, every special actor number is used at least once. In San Andreas, the game actively uses special actor numbers 1 to 5 while the rest is not actively used in the game.
 
In GTA 3 and Vice City, every special actor number is used at least once. In San Andreas, the game actively uses special actor numbers 1 to 5 while the rest is not actively used in the game.
  
===Example===
+
=== Example ===
 
Loading special peds is similar to loading regular peds. The following code is for San Andreas using Sanny Builder's format.
 
Loading special peds is similar to loading regular peds. The following code is for San Andreas using Sanny Builder's format.
 
<source lang="scm">
 
<source lang="scm">
Line 64: Line 82:
  
 
__NOTOC__
 
__NOTOC__
 +
 +
[[Category:OpCodes]]

Revision as of 09:40, 24 August 2011

GTA III Vice City San Andreas


Description

Spawns a character at a point

Syntax

009A: [var] = create_actor [int1] [int2] at [flt1] [flt2] [flt3]
Actor.Create( [var], [int1], [int2], [flt1], [flt2], [flt3] )

Parameter

[var]
Variable to store the handle of the character
[int1]
Ped type
[int2]
Valid character model ID number as defined in the PEDS 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_CHAR

This spawns a character at a point. Using this opcode requires the model to be loaded through opcode 0247 or else the game might crash. The major script editors like Sanny Builder support using the character's DFF model name and automatically converts those values into integers upon compilation. Once spawned, the character will be permanent in the game even after it dies or after you die or get busted. If you no longer need your character anymore, you could turn it into a random ped using opcode 01C2 or destroy it instantly using opcodes 009B or 034F.

Example

See also: Spawn a ped

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

// set constants
const
CHAR_MODEL = #BFORI
SPAWNED_CHAR = 0@
X_POS = 1@
Y_POS = 2@
Z_POS = 3@
end

// load model, required to prevent unnecessary crash!
0247: request_model CHAR_MODEL
// check if model is loaded
repeat
    wait 0
    if
        0248:   model CHAR_MODEL available
    then
        break
    end
until false
// spawn character
00A0: store_actor $PLAYER_ACTOR position_to X_POS Y_POS Z_POS
X_POS += 4.0
009A: SPAWNED_CHAR = create_actor 4 CHAR_MODEL at X_POS Y_POS Z_POS
// cleanup
0249: release_model CHAR_MODEL
01C2: remove_references_to_actor CHAR_MODEL

Special Peds

Special peds uses models SPECIAL#.dff, where # is a number from 01 to 04 in GTA3, 01 to 21 in Vice City, and 01 to 10 in San Andreas. It is used in conjunction with 023C. The special actor ID number corresponds to the number in SPECIAL#.dff. You do not have to load SPECIAL#.dff as it is always loaded into the game. Each special actor ID can accommodate only one special ped at a time and can be replaced by another special ped if the other special ped has the same ID.

In GTA 3 and Vice City, every special actor number is used at least once. In San Andreas, the game actively uses special actor numbers 1 to 5 while the rest is not actively used in the game.

Example

Loading special peds is similar to loading regular peds. The following code is for San Andreas using Sanny Builder's format.

 :LoadModel
 023C: load_special_actor 'ANDRE' as 1
 
 :CheckModel
 0001: wait 0 ms
 00D6: if
 023D:   special_actor 1 loaded
 004D: jump_if_false @CheckModel
 009A: 0@ = create_actor_pedtype 23 model #SPECIAL01 at 0.0 0.0 0.0
 0296: unload_special_actor 1
 004E: end_thread

Keywords

create, spawn, actor, ped, pedestrian, pedtype, model, character