Difference between revisions of "009A"

From GTAMods Wiki
Jump to navigation Jump to search
m
(highlight)
 
(22 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<code>009A=6,%1d% %2o% %3d% %4d% %5d% %6d%</code><br>
+
__NOTOC__
'''Description''': Creates a ped at a coordinate<br>
+
{{OpCode
'''Parameter 1''': [[Ped type]]<br>
+
| games      = {{Icon|t}}
'''Parameter 2''': Valid ped [[DFF]] model name or ID number as defined in the [[IDE#PEDS|IDE]] file<br>
+
| command    = CREATE_CHAR
'''Parameter 3''': X-coordinate<br>
+
| description = Creates a character at the coordinates point
'''Parameter 4''': Y-coordinate<br>
+
| syntax1    = 009A: [''var''] = create_actor [''int1''] [''int2''] at [''flt1''] [''flt2''] [''flt3'']
'''Parameter 5''': Z-coordinate<br>
+
| syntax2    = Actor.Create( [''var''], [''int1''], [''int2''], [''flt1''], [''flt2''], [''flt3''] )
'''Parameter 6''': Actor handle<br>
+
| p1t        = [''int1'']
'''Supports''': GTA3, Vice City, San Andreas<br>
+
| p1d        = [[Ped type]]
 +
| p2t        = [''int2'']
 +
| p2d        = Valid model index number as defined in the [[PEDS|PEDS section]] of the [[IDE]] file; also acceptable is model's [[DFF]] name with a hash character
 +
| p3t        = [''flt1'']
 +
| p3d        = X-coordinate
 +
| p4t        = [''flt2'']
 +
| p4d        = Y-coordinate
 +
| p5t        = [''flt3'']
 +
| p5d        = Z-coordinate
 +
| p6t        = [''var'']
 +
| p6d        = Variable to store the handle of the character
 +
| native      = [[CREATE_CHAR]]
 +
}}
  
This creates a ped at a coordinate. Using this opcode requires [[0247]] or else the game would crash.
+
This opcode creates a character at the coordinates point. Using this opcode requires the model to be already loaded, usually through opcode [[0247]], or else the game can crash. The major script editors like [[Sanny Builder]] support using the character's DFF model name and automatically converts it to the corresponding model ID number upon compilation. All characters created by this opcode outside the [[Create a mission|standard mission structure]] will become near-permanent in the game until opcode [[01C2]] is used to mark it as no longer needed or removed from the world through other means like [[009B]] or [[034F]].
  
==Note==
+
== Example ==
Sometimes this opcode is written as this:<br>
+
:''See also: [[Spawn a ped]]''
<code>009A=6,%6d% %1d% %2o% %3d% %4d% %5d%</code><br>
+
The following example, using Sanny Builder, will spawn a ped close to the player character.
The sixth parameter is placed in the beginning instead of at the end. This depends on which INI file you use.<br>
+
{{Pre|class=sb-code|1=
[[Sanny_Builder|Sanny Builder]] by default:
+
<span class="k">const</span>
<code>009A: 0@ = create_actor_pedtype 5 model #BFORI at 0.0 0.0 0.0</code>
+
CHAR_MODEL = <span class="nt">#BFORI</span>
 +
CHAR_HANDLE = <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>
 +
<span class="k">end</span>
  
==Example==
+
[[0247]]: request_model CHAR_MODEL
Beginners have a hard time creating actors because it is tough to learn how to make a code that would create an actor successfully. These will be only shown as examples and should not be copied verbatim. There are several ways of doing this. The following codes 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>
 +
009A: CHAR_HANDLE = create_actor <span class="m">4</span> CHAR_MODEL at X_POS Y_POS Z_POS
 +
[[0249]]: release_model CHAR_MODEL
 +
[[01C2]]: remove_references_to_actor CHAR_HANDLE
 +
}}
  
<b>Recommended format:</b><br>
+
== Special Peds ==
<code>:LoadModel<br></code>
+
Special peds use models <code>SPECIAL##.dff</code>, where <i>##</i> is a number from <i>01</i> to <i>04</i> in GTA III, <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 character 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 character number 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 number.
<code>[[0247]]: load_model #BFORI</code><br>
 
<code></code><br>
 
<code>:CheckModel</code><br>
 
<code>[[0001]]: wait 0 ms</code><br>
 
<code>[[00D6]]: if 0</code><br>
 
<code>[[0248]]: model #BFORI available</code><br>
 
<code>[[004D]]: jump_if_false @CheckModel</code><br>
 
<code>009A: 0@ = create_actor_pedtype 5 model #BFORI at 0.0 0.0 0.0</code><br>
 
<code>[[0249]]: release_model #BFORI</code><br>
 
<code>[[004E]]: end_thread</code><br>
 
<br>
 
<b>Rockstar's common format:</b><br>
 
<code>:LoadModel<br></code>
 
<code>0247: load_model #BFORI</code><br>
 
<code></code><br>
 
<code>:CheckModel</code><br>
 
<code>00D6: if 0</code><br>
 
<code>[[Conditional_opcode|8248]]:  not model #BFORI available</code><br>
 
<code>004D: jump_if_false @CreateModel</code><br>
 
<code>0001: wait 0 ms</code><br>
 
<code>[[0002]]: jump @CheckModel</code><br>
 
<code></code><br>
 
<code>:CreateModel</code><br>
 
<code>009A: 0@ = create_actor_pedtype 5 model #BFORI at 0.0 0.0 0.0</code><br>
 
<code>0249: release_model #BFORI</code><br>
 
<code>004E: end_thread</code><br>
 
<br>
 
<b>Rockstar's less common format:</b><br>
 
<code>:LoadModel</code><br>
 
<code>00D6: if 0</code><br>
 
<code>8248:  not model #BFORI available</code><br>
 
<code>004D: jump_if_false @CreateModel</code><br>
 
<code>0247: load_model #BFORI</code><br>
 
<code>0001: wait 0 ms</code><br>
 
<code>0002: jump @LoadModel</code><br>
 
<code></code><br>
 
<code>:CreateModel</code><br>
 
<code>009A: 0@ = create_actor_pedtype 5 model #BFORI at 0.0 0.0 0.0</code><br>
 
<code>0249: release_model #BFORI</code><br>
 
<code>004E: end_thread</code>
 
  
==Special Peds==
+
In the original scripts of GTA III and Vice City, every special character number is used at least once. In San Andreas, the game actively uses special character numbers 1 to 5 while the rest are not actively used in the game.
Special peds uses models <code>SPECIAL#.dff</code>, where <i>#</i> is a number from <i>01</i> to <i>10</i>. 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 San Andreas, the game actively uses special actor numbers 1 to 5. The rest is not actively used in the game but it is still useable.
+
=== Example ===
 +
Loading special peds is similar to loading regular peds. The following example, using Sanny Builder, will spawn a special ped close to the player character.
 +
{{Pre|class=sb-code|1=
 +
<span class="k">const</span>
 +
CHAR_HANDLE = <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>
 +
<span class="k">end</span>
  
===Example===
+
[[023C]]: load_special_actor <span class="m">1</span> <span class="s1">'PLAYER'</span>  <span class="c1">// for GTA III and Vice City</span>
Loading special peds is similar to loading regular peds. The following code uses Sanny Builder.
+
<span class="c1">// 023C: load_special_actor 'ANDRE' as 1  // for San Andreas</span>
 +
[[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>
 +
009A: CHAR_HANDLE = create_actor_pedtype <span class="m">21</span> model <span class="nt">#SPECIAL01</span> at X_POS Y_POS Z_POS  <span class="c1">// for GTA III and Vice City</span>
 +
<span class="c1">// 009A: CHAR_HANDLE = create_actor_pedtype 23 model #SPECIAL01 at X_POS Y_POS Z_POS  // for San Andreas</span>
 +
[[0296]]: unload_special_actor <span class="m">1</span>
 +
[[01C2]]: remove_references_to_actor CHAR_HANDLE
 +
}}
  
<code>:LoadModel<br></code>
+
== Keywords ==
<code>[[023C]]: load_special_actor 'ANDRE' as 1</code><br>
+
create, spawn, actor, ped, pedestrian, pedtype, model, character
<code></code><br>
 
<code>:CheckModel</code><br>
 
<code>0001: wait 0 ms</code><br>
 
<code>00D6: if 0</code><br>
 
<code>[[023D]]:  special_actor 1 loaded</code><br>
 
<code>004D: jump_if_false @CheckModel</code><br>
 
<code>009A: 0@ = create_actor_pedtype 23 model #SPECIAL01 at 0.0 0.0 0.0</code><br>
 
<code>[[0296]]: unload_special_actor 1</code><br>
 
<code>004E: end_thread</code><br>
 
 
 
==Keywords==
 
create, spawn, actor, ped, , pedestrian, pedtype, model
 
 
 
[[Category:OpCodes]]
 

Latest revision as of 03:33, 6 December 2016

GTA III Vice City San Andreas CREATE_CHAR


Description
Creates a character at the coordinates point
Syntax
009A: [var] = create_actor [int1] [int2] at [flt1] [flt2] [flt3]
Actor.Create( [var], [int1], [int2], [flt1], [flt2], [flt3] )
Parameter
[int1]
Ped type
[int2]
Valid model index 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
[var]
Variable to store the handle of the character
Native analog
CREATE_CHAR

This opcode creates a character at the coordinates point. Using this opcode requires the model to be already loaded, usually through opcode 0247, or else the game can crash. The major script editors like Sanny Builder support using the character's DFF model name and automatically converts it to the corresponding model ID number upon compilation. All characters created by this opcode outside the standard mission structure will become near-permanent in the game until opcode 01C2 is used to mark it as no longer needed or removed from the world through other means like 009B or 034F.

Example

See also: Spawn a ped

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

const
CHAR_MODEL = #BFORI
CHAR_HANDLE = 0@
X_POS = 1@
Y_POS = 2@
Z_POS = 3@
end

0247: request_model CHAR_MODEL
038B: load_requested_models
00A0: store_actor $PLAYER_ACTOR position_to X_POS Y_POS Z_POS
X_POS += 4.0
009A: CHAR_HANDLE = create_actor 4 CHAR_MODEL at X_POS Y_POS Z_POS
0249: release_model CHAR_MODEL
01C2: remove_references_to_actor CHAR_HANDLE

Special Peds

Special peds use models SPECIAL##.dff, where ## is a number from 01 to 04 in GTA III, 01 to 21 in Vice City, and 01 to 10 in San Andreas. It is used in conjunction with 023C. The special character 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 character number 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 number.

In the original scripts of GTA III and Vice City, every special character number is used at least once. In San Andreas, the game actively uses special character numbers 1 to 5 while the rest are not actively used in the game.

Example

Loading special peds is similar to loading regular peds. The following example, using Sanny Builder, will spawn a special ped close to the player character.

const
CHAR_HANDLE = 0@
X_POS = 1@
Y_POS = 2@
Z_POS = 3@
end

023C: load_special_actor 1 'PLAYER'  // for GTA III and Vice City
// 023C: load_special_actor 'ANDRE' as 1  // for San Andreas
038B: load_requested_models
00A0: store_actor $PLAYER_ACTOR position_to X_POS Y_POS Z_POS
X_POS += 4.0
009A: CHAR_HANDLE = create_actor_pedtype 21 model #SPECIAL01 at X_POS Y_POS Z_POS  // for GTA III and Vice City
// 009A: CHAR_HANDLE = create_actor_pedtype 23 model #SPECIAL01 at X_POS Y_POS Z_POS  // for San Andreas
0296: unload_special_actor 1
01C2: remove_references_to_actor CHAR_HANDLE

Keywords

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