0242

From GTAMods Wiki
Jump to navigation Jump to search

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
// [email protected] - input param (car handle)
// [email protected] - input param (bomb stage)
05E7: [email protected] = car [email protected] struct
[email protected] += 0x1FE  // car bomb offset
05E0: [email protected] = read_memory [email protected] size 1 virtual_protect 0  // store previous value
05F9: [email protected] = [email protected] AND 7  // keep only the first three bits from input param
05F9: [email protected] = [email protected] AND 0xF8  // exclude the first three bits in stored value
05FA: [email protected] = [email protected] OR [email protected]  // replace the first three bits of stored value with input param
05DF: write_memory [email protected] size 1 value [email protected] 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