02BC

From GTAMods Wiki
Revision as of 02:36, 16 January 2016 by Spaceeinstein (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

GTA III SET_SWAT_REQUIRED


Description
Sets patrol cars to Police cars and Enforcers
Syntax
02BC: set_swat_required [int]
Parameter
[int]
0 = off, 1 = on

This opcode sets patrol cars regardless of the wanted level to Police cars and Enforcers, which normally happens when a four-star wanted level is achieved. Everything else behaves normally according to the wanted level like police helicopters, aggression, spawn rate, etc. Roadblocks at wanted levels 5 and 6 retain the usual Fbi Cars and Barracks OL, although this seems to be bugged. It is recommended that the models for the Enforcer and the SWAT be loaded beforehand in order to increase the chance of them spawning in the streets. The effect is reset when the player dies or is arrested. Legacy documentations described this opcode as setting the cop behavior.

Setting FBI and army to be required

There are unsupported opcodes 02BD and 02BE with the commands "SET_FBI_REQUIRED" and "SET_ARMY_REQUIRED", each with one parameter. The command names imply that it was possible to set FBI and army to be required through the script. This functionality still exists in the game. The following example, using Sanny Builder with CLEO for GTA III in an external script (not the main one) and tested on US v1.0, makes it possible to recreate the effect of the opcodes.

:opcode_02BD
// 0@ - input param
05E0: 1@ = read_memory 0x9412F0 size 4 virtual_protect 0  // get player pointer
1@ += 0x53C  // offset to wanted level pointer
05E0: 1@ = read_memory 1@ size 4 virtual_protect 0  // get wanted pointer
1@ += 0x16  // offset to state
05E0: 2@ = read_memory 1@ size 1 virtual_protect 0  // get state
05F9: 2@ = 2@ AND 0xF7
if
    not 0@ == 0
then
    05FA: 2@ = 2@ OR 8
end
05DF: write_memory 1@ size 1 value 2@ virtual_protect 1  // set to fbi required
05F6: ret 0

:opcode_02BE
// 0@ - input param
05E0: 1@ = read_memory 0x9412F0 size 4 virtual_protect 0  // get player pointer
1@ += 0x53C  // offset to wanted level pointer
05E0: 1@ = read_memory 1@ size 4 virtual_protect 0  // get wanted pointer
1@ += 0x16  // offset to state
05E0: 2@ = read_memory 1@ size 1 virtual_protect 0  // get state
05F9: 2@ = 2@ AND 0xEF
if
    not 0@ == 0
then
    05FA: 2@ = 2@ OR 16
end
05DF: write_memory 1@ size 1 value 2@ virtual_protect 1  // set to army required
05F6: ret 0

Use these lines as a recreation for opcodes 02BD and 02BE. These can be placed anywhere within the external script.

05F5: call_scm_func @opcode_02BD inputs 1 set [int]
05F5: call_scm_func @opcode_02BE inputs 1 set [int]

Keywords

set, switch, swat, required, cop, behavior, behaviour