Difference between revisions of "0242"

From GTAMods Wiki
Jump to navigation Jump to search
m
 
Line 2: Line 2:
 
| games      = {{Icon|3}}
 
| games      = {{Icon|3}}
 
| command    = ARM_CAR_WITH_BOMB
 
| command    = ARM_CAR_WITH_BOMB
| description = Arms the car with a bomb
+
| description = Arms the car with the bomb
 
| syntax1    = 0242: set_car [''car handle''] bomb_status_to [''int'']
 
| syntax1    = 0242: set_car [''car handle''] bomb_status_to [''int'']
 
| p1t        = [''car handle'']
 
| p1t        = [''car handle'']
 
| p1d        = The handle of the vehicle
 
| p1d        = The handle of the vehicle
 
| p2t        = [''int'']
 
| p2t        = [''int'']
| p2d        = [[0228#Bomb types|Bomb type]]
+
| p2d        = [[0228#Car bomb stages|Car bomb stage]]
 
}}
 
}}
  
This opcode arms the car with a [[0228#Bomb types|car bomb]]. It has no effect on boats or trains. Arming car bomb type 4 (active timed bomb) will not work as expected; entering the car will produce a secondary soft ticking noise and will not blow up the car.
+
This opcode arms the car with the car bomb. It has no effect on boats or trains. Arming car bomb stage 4 (active timed bomb) will not work as expected; entering the car will produce a secondary soft ticking noise and will not blow up the car.
  
 
== For Vice City ==
 
== For Vice City ==
 
This opcode does not exist in Vice City but vehicles can still be armed with a car bomb. The following example, using Sanny Builder with [[CLEO]] for Vice City in an external script (not the main one) and tested on US v1.0, should work similarly to this opcode. Place this at the end of the file:
 
This opcode does not exist in Vice City but vehicles can still be armed with a car bomb. The following example, using Sanny Builder with [[CLEO]] for Vice City in an external script (not the main one) and tested on US v1.0, should work similarly to this opcode. Place this at the end of the file:
<syntaxhighlight lang="scm">
+
{{Pre|class=sb-code|1=
:opcode_0242
+
<span class="nl">:opcode_0242</span>
// 0@ - input param (car handle)
+
<span class="c1">// 0@ - input param (car handle)</span>
// 1@ - input param (bomb type)
+
<span class="c1">// 1@ - input param (bomb stage)</span>
05E7: 0@ = car 0@ struct
+
05E7: <span class="nv">0@</span> = car <span class="nv">0@</span> struct
0@ += 0x1FE  // car bomb offset
+
<span class="nv">0@</span> += <span class="m">0x1FE</span> <span class="c1">// car bomb offset</span>
05E0: 2@ = read_memory 0@ size 1 virtual_protect 0  // store previous value
+
05E0: <span class="nv">2@</span> = read_memory <span class="nv">0@</span> size <span class="m">1</span> virtual_protect <span class="m">0</span> <span class="c1">// store previous value</span>
05F9: 1@ = 1@ AND 7  // keep only the first three bits from input param
+
05F9: <span class="nv">1@</span> = <span class="nv">1@</span> <span class="k">AND</span> <span class="m">7</span> <span class="c1">// keep only the first three bits from input param</span>
05F9: 2@ = 2@ AND 0xF8  // exclude the first three bits in stored value
+
05F9: <span class="nv">2@</span> = <span class="nv">2@</span> <span class="k">AND</span> <span class="m">0xF8</span> <span class="c1">// exclude the first three bits in stored value</span>
05FA: 2@ = 2@ OR 1@  // replace the first three bits of stored value with input param
+
05FA: <span class="nv">2@</span> = <span class="nv">2@</span> <span class="k">OR</span> <span class="nv">1@</span> <span class="c1">// replace the first three bits of stored value with input param</span>
05DF: write_memory 0@ size 1 value 2@ virtual_protect 0  // set to new value
+
05DF: write_memory <span class="nv">0@</span> size <span class="m">1</span> value <span class="nv">2@</span> virtual_protect <span class="m">0</span> <span class="c1">// set to new value</span>
05F6: ret 0
+
05F6: ret <span class="m">0</span>
</syntaxhighlight>
+
}}
  
 
Use this line as a substitute for opcode 0242. This can be placed anywhere within the external script:
 
Use this line as a substitute for opcode 0242. This can be placed anywhere within the external script:
<syntaxhighlight lang="scm">
+
{{Pre|class=sb-code|1=
05F5: call_scm_func @opcode_0242 inputs 2 car_handle [car_handle] bomb_type [int]
+
05F5: call_scm_func <span class="nl">@opcode_0242</span> inputs <span class="m">2</span> car_handle [car_handle] bomb_type [int]
</syntaxhighlight>
+
}}
  
 
== Keywords ==
 
== Keywords ==
set, arm, car, vehicle, bomb, status
+
set, arm, car, vehicle, bomb, status, stage
  
 
== See also ==
 
== See also ==
 
* {{Icon|3}} [[0220]], checks if the vehicle is armed with any bomb
 
* {{Icon|3}} [[0220]], checks if the vehicle is armed with any bomb
 
* {{Icon|3}} [[0228]], checks if the vehicle is armed with a specific bomb
 
* {{Icon|3}} [[0228]], checks if the vehicle is armed with a specific bomb

Latest revision as of 14:00, 8 December 2016

GTA III ARM_CAR_WITH_BOMB


Description
Arms the car with the bomb
Syntax
0242: set_car [car handle] bomb_status_to [int]
Parameter
[car handle]
The handle of the vehicle
[int]
Car bomb stage

This opcode arms the car with the car bomb. It has no effect on boats or trains. Arming car bomb stage 4 (active timed bomb) will not work as expected; entering the car will produce a secondary soft ticking noise and will not blow up the car.

For Vice City

This opcode does not exist in Vice City but vehicles can still be armed with a car bomb. The following example, using Sanny Builder with CLEO for Vice City in an external script (not the main one) and tested on US v1.0, should work similarly to this opcode. Place this at the end of the file:

:opcode_0242
// 0@ - input param (car handle)
// 1@ - input param (bomb stage)
05E7: 0@ = car 0@ struct
0@ += 0x1FE  // car bomb offset
05E0: 2@ = read_memory 0@ size 1 virtual_protect 0  // store previous value
05F9: 1@ = 1@ AND 7  // keep only the first three bits from input param
05F9: 2@ = 2@ AND 0xF8  // exclude the first three bits in stored value
05FA: 2@ = 2@ OR 1@  // replace the first three bits of stored value with input param
05DF: write_memory 0@ size 1 value 2@ virtual_protect 0  // set to new value
05F6: ret 0

Use this line as a substitute for opcode 0242. This can be placed anywhere within the external script:

05F5: call_scm_func @opcode_0242 inputs 2 car_handle [car_handle] bomb_type [int]

Keywords

set, arm, car, vehicle, bomb, status, stage

See also

  • GTA III 0220, checks if the vehicle is armed with any bomb
  • GTA III 0228, checks if the vehicle is armed with a specific bomb