Difference between revisions of "02BC"

From GTAMods Wiki
Jump to navigation Jump to search
(Created page with "{{OpCode | games = {{Icon|3}} | command = SET_SWAT_REQUIRED | description = Sets patrol cars to Police cars and Enforcers | syntax1 = 02BC: set_swat_required [''...")
 
 
Line 8: Line 8:
 
}}
 
}}
  
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. The effect is reset when the player dies or is arrested. Legacy documentations described this opcode as setting the cop behavior.
+
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 [[0247|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 [[List of unsupported opcodes|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.
 +
<syntaxhighlight lang="scm">
 +
: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
 +
</syntaxhighlight>
 +
 
 +
Use these lines as a recreation for opcodes 02BD and 02BE. These can be placed anywhere within the external script.
 +
<syntaxhighlight lang="scm">
 +
05F5: call_scm_func @opcode_02BD inputs 1 set [int]
 +
05F5: call_scm_func @opcode_02BE inputs 1 set [int]
 +
</syntaxhighlight>
  
 
== Keywords ==
 
== Keywords ==
 
set, switch, swat, required, cop, behavior, behaviour
 
set, switch, swat, required, cop, behavior, behaviour

Latest revision as of 02:36, 16 January 2016

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