Difference between revisions of "0299"

From GTAMods Wiki
Jump to navigation Jump to search
(code for vc)
m
Line 1: Line 1:
{{Icon|3}} {{Icon|SA}}
+
{{Icon|3}} {{Icon|SA}} '''ACTIVATE_GARAGE'''
 
<hr />
 
<hr />
 
<onlyinclude>{{#ifeq:{{{transcludesection|opcode}}}|opcode|
 
<onlyinclude>{{#ifeq:{{{transcludesection|opcode}}}|opcode|
Line 28: Line 28:
 
     1@ == 11  // is garage type 11
 
     1@ == 11  // is garage type 11
 
then
 
then
     0@ += 0x1 // door state offset
+
     0@ += 1 // door state offset
 
     05E0: 1@ = read_memory 0@ size 1 virtual_protect 0  // read garage door state
 
     05E0: 1@ = read_memory 0@ size 1 virtual_protect 0  // read garage door state
 
     if
 
     if
Line 35: Line 35:
 
         05DF: write_memory 0@ size 1 value 3 virtual_protect 0  // open garage door
 
         05DF: write_memory 0@ size 1 value 3 virtual_protect 0  // open garage door
 
     end
 
     end
     0@ -= 0x1
+
     0@ -= 1
 
end
 
end
0@ += 0x5 // activation offset
+
0@ += 5 // activation offset
 
05DF: write_memory 0@ size 1 value 0 virtual_protect 0  // activate garage
 
05DF: write_memory 0@ size 1 value 0 virtual_protect 0  // activate garage
 
05F6: ret 0
 
05F6: ret 0
Line 43: Line 43:
 
Use this line as a substitute for opcode 0299. This can be placed anywhere within the external script:
 
Use this line as a substitute for opcode 0299. This can be placed anywhere within the external script:
 
<source lang="scm">
 
<source lang="scm">
05F5: call_scm_func @opcode_0299 inputs 1 garage_handle [garage handle// change [garage handle] to the actual handle of the garage, i.e. $655 for the Links View Apartment garage
+
05F5: call_scm_func @opcode_0299 inputs 1 garage_handle {garage handle}
 +
// change {garage handle} to the actual handle of the garage, e.g., $655 for the Links View Apartment garage
 
</source>
 
</source>
  
 
== Keywords ==
 
== Keywords ==
garage, activate, enable
+
set, garage, activate, enable
  
 
== External link ==
 
== External link ==

Revision as of 12:04, 13 January 2012

GTA III San Andreas ACTIVATE_GARAGE


Description

Activates a garage

Syntax

GTA III 0299: activate_garage [garage handle]
San Andreas 0299: activate_garage [string]
San Andreas Garage.Activate( [string] )

Parameter

[garage handle]
The handle of the garage, for GTA III
[string]
The name of the garage, for San Andreas (max size 8 characters)

This opcode activates a garage that is deactivated through opcode 02B9. In GTA III for garage type 11, this opcode has an additional function of allowing the door of the garage to open.

For Vice City

This opcode does not exist in Vice City, but garages do not ever deactivate in the game without using the code snippet for simulating opcode 02B9. 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_0299
// 0@ - input param (garage handle)
0@ *= 0xA8  // size of each garage block
0@ += 0x812668  // add to beginning of garage block
05E0: 1@ = read_memory 0@ size 1 virtual_protect 0  // read garage type
if
    1@ == 11  // is garage type 11
then
    0@ += 1  // door state offset
    05E0: 1@ = read_memory 0@ size 1 virtual_protect 0  // read garage door state
    if
        1@ == 0  // is door closed
    then
        05DF: write_memory 0@ size 1 value 3 virtual_protect 0  // open garage door
    end
    0@ -= 1
end
0@ += 5  // activation offset
05DF: write_memory 0@ size 1 value 0 virtual_protect 0  // activate garage
05F6: ret 0

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

05F5: call_scm_func @opcode_0299 inputs 1 garage_handle {garage handle}
// change {garage handle} to the actual handle of the garage, e.g., $655 for the Links View Apartment garage

Keywords

set, garage, activate, enable

External link