Difference between revisions of "0400"

From GTAMods Wiki
Jump to navigation Jump to search
(they should...)
(updating page)
Line 1: Line 1:
<code>0400=1,%1d%</code><br>
+
{{Icon|3}}
<code>0400=7,%5d% %6d% %7d% %1d% %2d% %3d% %4d%</code><br>
+
<hr />
'''Description''': Gets the offset of the object's position
+
'''Description'''
{| cellpadding="0" cellspacing="0"
+
: Saves a minimum record value to the stat <code>FEST_RM</code> (Multistorey Mayhem in secs)
!
+
'''Syntax'''
!{{Icon|3}}
+
: 0400: save_mayhem_time [''int'']
!{{Icon|VC}} {{Icon|SA}} {{Icon|LCS}} {{Icon|VCS}}
+
'''Parameter'''
|-
+
: [''int'']
| '''Parameter 1''':&nbsp; || Integer value&nbsp; || Existing object handle
+
:: Time in seconds
|-
+
This opcode saves the record time stat for Multistorey Mayhem.  
| '''Parameter 2''': || || Float (X-offset in units)
 
|-
 
| '''Parameter 3''': || || Float (Y-offset in units)
 
|-
 
| '''Parameter 4''': || || Float (Z-offset in units)
 
|-
 
| '''Parameter 5''': || || Variable to store the X-coordinate of the X-offset
 
|-
 
| '''Parameter 6''': || || Variable to store the Y-coordinate of the Y-offset
 
|-
 
| '''Parameter 7''': || || Variable to store the Z-coordinate of the Z-offset
 
|}'''Supports''': [[GTA 3]], [[Vice City]], [[San Andreas]], [[Liberty City Stories]] (0405), [[Vice City Stories]] (0279)<br>'''Analogous to GTA IV''': [[GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS]]<br>
 
In GTA III, this opcode saves the time stat for Multistorey Mayhem. In Vice City and San Andreas, this stores coordinates offset from the object's position. If you set the X, Y, and Z offsets to 0.0, it is better to use opcode [[01BB]] instead since you are getting the object's own position. Note that the parameters are mixed around.
 
[[Sanny Builder]] example:<source lang="scm">0400: store_coords_to 4@ 5@ 6@ from_object 0@ with_offset 1@ 2@ 3@</source>
 
  
==Note==
+
{{Icon|VC}} {{Icon|SA}}
The above format is more commonly used. The actual format of this opcode is in order:<br>
+
<hr />
<code>0400=7,%1d% %2d% %3d% %4d% %5d% %6d% %7d%</code><br>
+
'''Description'''
The format to use depends on which INI file you use.
+
: Stores a point offset from the object's position
 +
'''Syntax'''
 +
: 0400: create_coordinate [''var1''] [''var2''] [''var3''] from_object [''object handle''] offset [''float1''] [''float2''] [''float3'']
 +
'''Parameter'''
 +
: [''var1'']
 +
:: Variable to store the offset x-coordinate
 +
: [''var2'']
 +
:: Variable to store the offset y-coordinate
 +
: [''var3'']
 +
:: Variable to store the offset z-coordinate
 +
: [''object handle'']
 +
:: The handle of the object
 +
: [''float1'']
 +
:: Distance to offset from the object's right side
 +
: [''float1'']
 +
:: Distance to offset from the object's front side
 +
: [''float1'']
 +
:: Distance to offset from the object's top side
 +
'''Native analog'''
 +
: [[GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS]]
  
==Keywords==
+
This opcode stores a point offset from the object's position. The coordinates it store is dependent on the [[angle|direction]] the object is facing. If you set the offsets to 0.0, it is better to use opcode [[01BB]] instead since you are getting the object's own position.
get, store, object, position, location, offset
+
 
 +
== Example ==
 +
The following example, using Sanny Builder, will spawn a pistol object at the player character. Pressing the ACTION key will spawn an adrenaline pickup rotating around the pistol object.
 +
 
 +
<source lang="scm">
 +
// set constants
 +
const
 +
X_POS = 0@
 +
Y_POS = 1@
 +
Z_POS = 2@
 +
ANGLE = 3@
 +
SPAWNED_OBJECT = 4@
 +
SPAWNED_PICKUP = 5@
 +
end
 +
 
 +
// spawn object
 +
00A0: store_actor $PLAYER_ACTOR position_to X_POS Y_POS Z_POS
 +
0107: SPAWNED_OBJECT = create_object #COLT45 at X_POS Y_POS Z_POS
 +
 
 +
// spawn pickup and rotate object
 +
while true
 +
    wait 10
 +
    if
 +
        00E1:  key_pressed 0 4  // action key
 +
    then
 +
        0176: ANGLE = object SPAWNED_OBJECT z_angle
 +
        ANGLE += 5.0
 +
        if
 +
            ANGLE > 360.0
 +
        then
 +
            ANGLE = 0.0
 +
        end
 +
        0177: set_object SPAWNED_OBJECT z_angle_to ANGLE
 +
        0400: create_coordinate X_POS Y_POS Z_POS from_object SPAWNED_OBJECT offset 3.0 0.0 0.0
 +
        0215: destroy_pickup SPAWNED_PICKUP
 +
        0213: SPAWNED_PICKUP = create_pickup #ADRENALINE type 3 at X_POS Y_POS Z_POS
 +
    end
 +
end
 +
</source>
 +
 
 +
== Keywords ==
 +
get, store, object, position, coordinates, location, offset
  
 
[[Category:OpCodes]]
 
[[Category:OpCodes]]

Revision as of 02:31, 24 August 2011

GTA III


Description

Saves a minimum record value to the stat FEST_RM (Multistorey Mayhem in secs)

Syntax

0400: save_mayhem_time [int]

Parameter

[int]
Time in seconds

This opcode saves the record time stat for Multistorey Mayhem.

Vice City San Andreas


Description

Stores a point offset from the object's position

Syntax

0400: create_coordinate [var1] [var2] [var3] from_object [object handle] offset [float1] [float2] [float3]

Parameter

[var1]
Variable to store the offset x-coordinate
[var2]
Variable to store the offset y-coordinate
[var3]
Variable to store the offset z-coordinate
[object handle]
The handle of the object
[float1]
Distance to offset from the object's right side
[float1]
Distance to offset from the object's front side
[float1]
Distance to offset from the object's top side

Native analog

GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS

This opcode stores a point offset from the object's position. The coordinates it store is dependent on the direction the object is facing. If you set the offsets to 0.0, it is better to use opcode 01BB instead since you are getting the object's own position.

Example

The following example, using Sanny Builder, will spawn a pistol object at the player character. Pressing the ACTION key will spawn an adrenaline pickup rotating around the pistol object.

// set constants
const
X_POS = 0@
Y_POS = 1@
Z_POS = 2@
ANGLE = 3@
SPAWNED_OBJECT = 4@
SPAWNED_PICKUP = 5@
end

// spawn object
00A0: store_actor $PLAYER_ACTOR position_to X_POS Y_POS Z_POS
0107: SPAWNED_OBJECT = create_object #COLT45 at X_POS Y_POS Z_POS

// spawn pickup and rotate object
while true
    wait 10
    if 
        00E1:   key_pressed 0 4  // action key
    then
        0176: ANGLE = object SPAWNED_OBJECT z_angle 
        ANGLE += 5.0
        if
            ANGLE > 360.0
        then
            ANGLE = 0.0
        end
        0177: set_object SPAWNED_OBJECT z_angle_to ANGLE
        0400: create_coordinate X_POS Y_POS Z_POS from_object SPAWNED_OBJECT offset 3.0 0.0 0.0
        0215: destroy_pickup SPAWNED_PICKUP
        0213: SPAWNED_PICKUP = create_pickup #ADRENALINE type 3 at X_POS Y_POS Z_POS
    end
end

Keywords

get, store, object, position, coordinates, location, offset