Difference between revisions of "0400"

From GTAMods Wiki
Jump to navigation Jump to search
(updates)
Line 1: Line 1:
{{Icon|3}} '''REGISTER_4X4_MAYHEM_TIME'''
+
{{OpCode
<hr />
+
| games      = {{Icon|3}}
'''Description'''
+
| command    = REGISTER_4X4_MAYHEM_TIME
: Saves the fastest time to the Multistorey Mayhem stat
+
| description = Saves the fastest time to the Multistorey Mayhem stat
'''Syntax'''
+
| syntax1    = 0400: save_mayhem_time [''int'']
: 0400: save_mayhem_time [''int'']
+
| p1t        = [''int'']
'''Parameter'''
+
| p1d        = Integer value
: [''int'']
+
}}
:: Integer value
 
This opcode saves the lowest value to the "Multistorey Mayhem in secs" [[List of statistics (III)|stat]] ([[GXT]] string <code>FEST_RM</code>). The stat can only be overwritten by a value smaller than the previously saved value. The value set with this opcode is saved in [[Saves (GTA 3)#Block 17: Stats|block 17 of the save file]].
 
  
{{Icon|VC}} {{Icon|SA}} '''GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS'''
+
This opcode saves the lowest value to the "Multistorey Mayhem in secs" [[List of statistics (III)|stat]] ([[GXT]] key <code>FEST_RM</code>). The stat can only be overwritten by a value smaller than the previously saved value. The value set with this opcode is saved in [[Saves (GTA 3)#Block 17: Stats|block 17 of the save file]].
<hr />
+
 
'''Description'''
+
 
: Stores a point offset from the object's position
+
{{OpCode
'''Syntax'''
+
| games      = {{Icon|VC}} {{Icon|SA}}
: 0400: create_coordinate [''var1''] [''var2''] [''var3''] from_object [''object handle''] offset [''flt1''] [''flt2''] [''flt3'']
+
| command    = GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS
'''Parameter'''
+
| description = Stores a point offset from the object's position
: [''var1'']
+
| syntax1    = 0400: create_coordinate [''var1''] [''var2''] [''var3''] from_object [''object handle''] offset [''flt1''] [''flt2''] [''flt3'']
:: Variable to store the offset x-coordinate
+
| p1t        = [''var1'']
: [''var2'']
+
| p1d        = Variable to store the offset x-coordinate
:: Variable to store the offset y-coordinate
+
| p2t        = [''var2'']
: [''var3'']
+
| p2d        = Variable to store the offset y-coordinate
:: Variable to store the offset z-coordinate
+
| p3t        = [''var3'']
: [''object handle'']
+
| p3d        = Variable to store the offset z-coordinate
:: The handle of the object
+
| p4t        = [''object handle'']
: [''flt1'']
+
| p4d        = The handle of the object
:: Distance to offset from the object's right side
+
| p5t        = [''flt1'']
: [''flt1'']
+
| p5d        = Distance to offset from the object's right side
:: Distance to offset from the object's front side
+
| p6t        = [''flt2'']
: [''flt1'']
+
| p6d        = Distance to offset from the object's front side
:: Distance to offset from the object's top side
+
| p7t        = [''flt3'']
'''Native analog'''
+
| p7d        = Distance to offset from the object's top side
: [[GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS]]
+
| native      = [[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 [[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.
 
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.
Line 39: Line 38:
 
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.
 
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">
+
<syntaxhighlight lang="scm">
 
// set constants
 
// set constants
 
const
 
const
Line 73: Line 72:
 
     end
 
     end
 
end
 
end
</source>
+
</syntaxhighlight>
  
 
== Keywords ==
 
== Keywords ==
 
get, store, object, position, coordinates, location, offset
 
get, store, object, position, coordinates, location, offset
  
[[Category:OpCodes]]
+
[[Category:Code Snippets]]

Revision as of 05:47, 19 June 2016

GTA III REGISTER_4X4_MAYHEM_TIME


Description
Saves the fastest time to the Multistorey Mayhem stat
Syntax
0400: save_mayhem_time [int]
Parameter
[int]
Integer value

This opcode saves the lowest value to the "Multistorey Mayhem in secs" stat (GXT key FEST_RM). The stat can only be overwritten by a value smaller than the previously saved value. The value set with this opcode is saved in block 17 of the save file.


Vice City San Andreas GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS


Description
Stores a point offset from the object's position
Syntax
0400: create_coordinate [var1] [var2] [var3] from_object [object handle] offset [flt1] [flt2] [flt3]
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
[flt1]
Distance to offset from the object's right side
[flt2]
Distance to offset from the object's front side
[flt3]
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