Difference between revisions of "0129"

From GTAMods Wiki
Jump to navigation Jump to search
(New page: {{OpCode | ini = 0129=4,%4d% %2d% %3o% %1d% | description = Creates a character in the driver seat of a vehicle | p1 = Existing vehicle handle | p2 = Ped type...)
 
Line 1: Line 1:
{{OpCode
+
{{Icon|trilogy}}
| ini        = 0129=4,%4d% %2d% %3o% %1d%
+
<hr />
| description = Creates a character in the driver seat of a vehicle
+
'''Description'''
| p1          = Existing vehicle handle
+
: Spawns a character in the driver seat of a vehicle
| p2          = [[Ped type]]
+
'''Syntax'''
| p3          = Valid ped [[DFF]] model name or ID number as defined in the [[IDE#PEDS|IDE]] file
+
: 0129: [''var''] = create_actor_pedtype [''int1''] model [''int2''] in_car [''car handle''] driverseat
| p4          = Actor handle
+
'''Parameter'''
| game        = GTA3, Vice City, San Andreas
+
: [''var'']
| native      = [[CREATE_CHAR_INSIDE_CAR]]
+
:: Variable to store the handle of the character
}}
+
: [''int1'']
This creates a character in the driver seat of a vehicle. Using this opcode requires an existing vehicle and [[0247]] to load the character model or else the game could crash. Note that the parameters are mixed around.
+
:: [[Ped type]]
[[Sanny Builder]] example:<source lang="scm">0129: 1@ = create_actor_pedtype 5 model #BFORI in_car 0@ driverseat</source>
+
: [''int2'']
 +
:: 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
 +
: [''car handle'']
 +
:: The handle of the vehicle
 +
'''Native analog'''
 +
: [[CREATE_CHAR_INSIDE_CAR]]
  
==Note==
+
This opcode spawns a character in the driver seat of a vehicle. Using this opcode requires an existing vehicle and opcode [[0247]] to load the character model or else the game could crash.
The above format is more commonly used. The actual format of this opcode is in order:<br>
 
<code>0129=4,%1d% %2d% %3o% %4d%</code><br>
 
The format to use depends on which INI file you use.
 
  
==Keywords==
+
== Example ==
create, actor, character, pedtype, model, vehicle, car, driver
+
:''See also: [[Spawn a ped]]''
 +
The following example, using Sanny Builder, will spawn a ped in a car close to the player character.
 +
<source lang="scm">
 +
// set constants
 +
const
 +
CHAR_MODEL = #BFORI
 +
CAR_MODEL = #PONY
 +
CHAR_HANDLE = 0@
 +
CAR_HANDLE = 1@
 +
X_POS = 2@
 +
Y_POS = 3@
 +
Z_POS = 4@
 +
end
 +
 
 +
// load model, required to prevent unnecessary crash!
 +
0247: request_model CHAR_MODEL
 +
0247: request_model CAR_MODEL
 +
// check if model is loaded
 +
repeat
 +
    wait 0
 +
    if and
 +
        0248:  model CHAR_MODEL available
 +
        0248:  model CAR_MODEL available
 +
    then
 +
        break
 +
    end
 +
until false
 +
// spawn car
 +
00A0: store_actor $PLAYER_ACTOR position_to X_POS Y_POS Z_POS
 +
X_POS += 4.0
 +
00A5: CAR_HANDLE = create_car CAR_MODEL at X_POS Y_POS Z_POS
 +
// spawn character
 +
0129: CHAR_HANDLE = create_actor_pedtype 4 model CHAR_MODEL in_car CAR_HANDLE driverseat
 +
// cleanup
 +
0249: release_model CHAR_MODEL
 +
0249: release_model CAR_MODEL
 +
01C2: remove_references_to_actor CHAR_HANDLE
 +
01C3: remove_references_to_car CAR_HANDLE
 +
</source>
 +
 
 +
== Keywords ==
 +
create, spawn, actor, ped, pedestrian, character, pedtype, model, vehicle, car, driver
 +
 
 +
[[Category:OpCodes]]

Revision as of 00:06, 24 December 2011

GTA III Vice City San Andreas


Description

Spawns a character in the driver seat of a vehicle

Syntax

0129: [var] = create_actor_pedtype [int1] model [int2] in_car [car handle] driverseat

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
[car handle]
The handle of the vehicle

Native analog

CREATE_CHAR_INSIDE_CAR

This opcode spawns a character in the driver seat of a vehicle. Using this opcode requires an existing vehicle and opcode 0247 to load the character model or else the game could crash.

Example

See also: Spawn a ped

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

// set constants
const
CHAR_MODEL = #BFORI
CAR_MODEL = #PONY
CHAR_HANDLE = 0@
CAR_HANDLE = 1@
X_POS = 2@
Y_POS = 3@
Z_POS = 4@
end

// load model, required to prevent unnecessary crash!
0247: request_model CHAR_MODEL
0247: request_model CAR_MODEL
// check if model is loaded
repeat
    wait 0
    if and
        0248:   model CHAR_MODEL available
        0248:   model CAR_MODEL available
    then
        break
    end
until false
// spawn car
00A0: store_actor $PLAYER_ACTOR position_to X_POS Y_POS Z_POS
X_POS += 4.0
00A5: CAR_HANDLE = create_car CAR_MODEL at X_POS Y_POS Z_POS
// spawn character
0129: CHAR_HANDLE = create_actor_pedtype 4 model CHAR_MODEL in_car CAR_HANDLE driverseat
// cleanup
0249: release_model CHAR_MODEL
0249: release_model CAR_MODEL
01C2: remove_references_to_actor CHAR_HANDLE
01C3: remove_references_to_car CAR_HANDLE

Keywords

create, spawn, actor, ped, pedestrian, character, pedtype, model, vehicle, car, driver