0242

From GTAMods Wiki
Revision as of 01:48, 5 January 2016 by Spaceeinstein (talk | contribs)
Jump to navigation Jump to search

GTA III ARM_CAR_WITH_BOMB


Description
Arms the car with a bomb
Syntax
0242: set_car [car handle] bomb_status_to [int]
Parameter
[car handle]
The handle of the vehicle
[int]
Bomb type

This opcode arms the car with a car bomb. It has no effect on boats or trains.

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 type)
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

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