Difference between revisions of "0400"

From GTAMods Wiki
Jump to navigation Jump to search
(updates)
m
 
(3 intermediate revisions by 2 users not shown)
Line 2: Line 2:
 
| games      = {{Icon|3}}
 
| games      = {{Icon|3}}
 
| command    = REGISTER_4X4_MAYHEM_TIME
 
| command    = REGISTER_4X4_MAYHEM_TIME
| description = Saves the fastest time to the Multistorey Mayhem stat
+
| description = Saves the fastest time to the Multistorey Mayhem [[List of statistics (III)|stat]]
 
| syntax1    = 0400: save_mayhem_time [''int'']
 
| syntax1    = 0400: save_mayhem_time [''int'']
 
| p1t        = [''int'']
 
| p1t        = [''int'']
Line 8: Line 8:
 
}}
 
}}
  
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]].
+
This opcode saves the lowest value to the "Multistorey Mayhem in secs" stat ([[GXT]] key <code>FEST_RM</code>). The stat initially starts with a value of 0 and does not appear in the stats menu until its value is greater than 0. Any value can overwrite a value of 0. For every other values, only those lower than the saved value will update the stat with the new value; higher values have no effect on the stat. The value set with this opcode is saved in [[Saves (GTA 3)#Block 17: Stats|block 17 of the save file]].
  
  
Line 16: Line 16:
 
| description = Stores a point offset from the object's position
 
| description = Stores a point offset from the object's position
 
| syntax1    = 0400: create_coordinate [''var1''] [''var2''] [''var3''] from_object [''object handle''] offset [''flt1''] [''flt2''] [''flt3'']
 
| syntax1    = 0400: create_coordinate [''var1''] [''var2''] [''var3''] from_object [''object handle''] offset [''flt1''] [''flt2''] [''flt3'']
| p1t        = [''var1'']
+
| p1t        = [''object handle'']
| p1d        = Variable to store the offset x-coordinate
+
| p1d        = The handle of the object
| p2t        = [''var2'']
+
| p2t        = [''flt1'']
| p2d        = Variable to store the offset y-coordinate
+
| p2d        = Distance to offset from the object's right side
| p3t        = [''var3'']
+
| p3t        = [''flt2'']
| p3d        = Variable to store the offset z-coordinate
+
| p3d        = Distance to offset from the object's front side
| p4t        = [''object handle'']
+
| p4t        = [''flt3'']
| p4d        = The handle of the object
+
| p4d        = Distance to offset from the object's top side
| p5t        = [''flt1'']
+
| p5t        = [''var1'']
| p5d        = Distance to offset from the object's right side
+
| p5d        = Variable to store the offset x-coordinate
| p6t        = [''flt2'']
+
| p6t        = [''var2'']
| p6d        = Distance to offset from the object's front side
+
| p6d        = Variable to store the offset y-coordinate
| p7t        = [''flt3'']
+
| p7t        = [''var3'']
| p7d        = Distance to offset from the object's top side
+
| p7d        = Variable to store the offset z-coordinate
 
| native      = [[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 stores are 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.
  
 
== Example ==
 
== 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.
+
The following example, using Sanny Builder, will spawn a pistol object at the player character. Pressing [[00E1|button 4]] (ACTION key on foot) will spawn an adrenaline pickup rotating around the pistol object.
  
<syntaxhighlight lang="scm">
+
{{Pre|class=sb-code|1=
// set constants
+
<span class="c1">// set constants</span>
const
+
<span class="k">const</span>
X_POS = 0@
+
X_POS = <span class="nv">0@</span>
Y_POS = 1@
+
Y_POS = <span class="nv">1@</span>
Z_POS = 2@
+
Z_POS = <span class="nv">2@</span>
ANGLE = 3@
+
ANGLE = <span class="nv">3@</span>
SPAWNED_OBJECT = 4@
+
SPAWNED_OBJECT = <span class="nv">4@</span>
SPAWNED_PICKUP = 5@
+
SPAWNED_PICKUP = <span class="nv">5@</span>
end
+
<span class="k">end</span>
  
// spawn object
+
<span class="c1">// spawn object</span>
00A0: store_actor $PLAYER_ACTOR position_to X_POS Y_POS Z_POS
+
00A0: store_actor <span class="nv">$PLAYER_ACTOR</span> position_to X_POS Y_POS Z_POS
0107: SPAWNED_OBJECT = create_object #COLT45 at X_POS Y_POS Z_POS
+
0107: SPAWNED_OBJECT = create_object <span class="nt">#COLT45</span> at X_POS Y_POS Z_POS
  
// spawn pickup and rotate object
+
<span class="c1">// spawn pickup and rotate object</span>
while true
+
<span class="k">while</span> <span class="k">true</span>
     wait 10
+
     <span class="k">wait</span> <span class="m">10</span>
     if  
+
     <span class="k">if</span>
         00E1:  key_pressed 0 4  // action key
+
         00E1:  key_pressed <span class="m">0</span> <span class="m">4</span> <span class="c1">// action key</span>
     then
+
     <span class="k">then</span>
 
         0176: ANGLE = object SPAWNED_OBJECT z_angle  
 
         0176: ANGLE = object SPAWNED_OBJECT z_angle  
         ANGLE += 5.0
+
         ANGLE += <span class="m">5.0</span>
         if
+
         <span class="k">if</span>
             ANGLE > 360.0
+
             ANGLE &gt; <span class="m">360.0</span>
         then
+
         <span class="k">then</span>
             ANGLE = 0.0
+
             ANGLE = <span class="m">0.0</span>
         end
+
         <span class="k">end</span>
 
         0177: set_object SPAWNED_OBJECT z_angle_to ANGLE
 
         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
+
         0400: create_coordinate X_POS Y_POS Z_POS from_object SPAWNED_OBJECT offset <span class="m">3.0</span> <span class="m">0.0</span> <span class="m">0.0</span>
 
         0215: destroy_pickup SPAWNED_PICKUP
 
         0215: destroy_pickup SPAWNED_PICKUP
         0213: SPAWNED_PICKUP = create_pickup #ADRENALINE type 3 at X_POS Y_POS Z_POS
+
         0213: SPAWNED_PICKUP = create_pickup <span class="nt">#ADRENALINE</span> type <span class="m">3</span> at X_POS Y_POS Z_POS
     end
+
     <span class="k">end</span>
end
+
<span class="k">end</span>
</syntaxhighlight>
+
}}
  
 
== Keywords ==
 
== Keywords ==
 
get, store, object, position, coordinates, location, offset
 
get, store, object, position, coordinates, location, offset
 +
 +
== See also ==
 +
* {{Icon|VC}} {{Icon|SA}} [[0407]], for vehicles
 +
* {{Icon|VC}} {{Icon|SA}} [[04C4]], for characters
  
 
[[Category:Code Snippets]]
 
[[Category:Code Snippets]]

Latest revision as of 01:47, 28 November 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 initially starts with a value of 0 and does not appear in the stats menu until its value is greater than 0. Any value can overwrite a value of 0. For every other values, only those lower than the saved value will update the stat with the new value; higher values have no effect on the stat. 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
[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
[var1]
Variable to store the offset x-coordinate
[var2]
Variable to store the offset y-coordinate
[var3]
Variable to store the offset z-coordinate
Native analog
GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS

This opcode stores a point offset from the object's position. The coordinates it stores are 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 button 4 (ACTION key on foot) 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

See also

  • Vice City San Andreas 0407, for vehicles
  • Vice City San Andreas 04C4, for characters