Difference between revisions of "0542"

From GTAMods Wiki
Jump to navigation Jump to search
m (fixed property ids)
(highlight)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{OpCode
 
{{OpCode
| ini        = 0542=1,%1h%
+
| games      = {{Icon|VC}}
| description = Adds a property to the property owned stat
+
| command    = SET_PROPERTY_AS_OWNED
| p1          = Integer value
+
| description = Adds a property to the property owned [[List of statistics (VC)|stat]]
| game        = [[Vice City]]
+
| syntax1    = 0542: add_property [''int''] to_property_own_stats
 +
| p1t        = [''int'']
 +
| p1d        = Property index ([[#Properties|see below]])
 
}}
 
}}
This opcode adds a property to the "Property Owned" stat. The number of property is incremented by one and the name is added to the list of properties. Values higher than the ones in the game can be used but only the number of properties will be incremented; the property name will not show up.
 
  
{| {{Prettytable}}
+
This opcode adds a property to the "Property Owned" stat ([[GXT]] key <code>PROPOWN</code>). The number of property is incremented by one and the name is added to the list of properties. Values higher than the ones in the game can be used but only the number of properties will be incremented; the property name will not show up.
! Value
+
 
! Property
+
== Properties ==
 +
{|class="wikitable sortable center-col-1"
 +
!Id
 +
![[SCM language III/VC definitions#PROP|Enum]]
 +
![[GXT]] key
 +
!Property
 
|-
 
|-
| 0
+
|0 ||PROP_MALIBU ||STPR_1 ||The Malibu
| The Malibu
 
 
|-
 
|-
| 1
+
|1 ||PROP_PRINTWORKS ||STPR_2 ||Print Works
| Print Works
 
 
|-
 
|-
| 2
+
|2 ||PROP_FILMSTUDIO ||STPR_3 ||Film Studio
| Film Studio
 
 
|-
 
|-
| 3
+
|3 ||PROP_ICECREAM ||STPR_4 ||Ice Cream Factory
| Ice Cream Factory
 
 
|-
 
|-
| 4
+
|4 ||PROP_CARSHOWROOM ||STPR_5 ||Car Showroom
| Car Showroom
 
 
|-
 
|-
| 5
+
|5 ||PROP_TAXICO ||STPR_6 ||Taxi Company
| Taxi Company
 
 
|-
 
|-
| 6
+
|6 ||PROP_BOATYARD ||STPR_7 ||Boatyard
| Boatyard
 
 
|-
 
|-
| 7
+
|7 ||PROP_STRIPCLUB ||STPR_8 ||Pole Position Club
| Pole Position Club
 
 
|-
 
|-
| 8
+
|8 ||PROP_VICEPOINT ||STPR_9 ||3321 Vice Point
| 3321 Vice Point
 
 
|-
 
|-
| 9
+
|9 ||PROP_LINKSVIEW ||STPR_10 ||Links View Apartment
| Links View Apartment
 
 
|-
 
|-
| 10
+
|10 ||PROP_EL_SWANKO ||STPR_11 ||El Swanko Casa
| El Swanko Casa
 
 
|-
 
|-
| 11
+
|11 ||PROP_WASHINGTON_STREET ||STPR_12 ||1102 Washington Street
| 1102 Washington Street
 
 
|-
 
|-
| 12
+
|12 ||PROP_OCEANHEIGHTS ||STPR_13 ||Ocean Heights Apartment
| Ocean Heights Apartment
 
 
|-
 
|-
| 13
+
|13 ||PROP_SKUMOLESHACK ||STPR_14 ||Skumole Shack
| Skumole Shack
 
 
|-
 
|-
| 14
+
|14 ||PROP_HYMAN_CONDO ||STPR_15 ||Hyman Condo
| Hyman Condo
 
 
|}
 
|}
  
==Keywords==
+
== Removing an owned property ==
add, increment, property, properties, owned, stat, statistics
+
This supplemental code allows you to remove a property from the property owned stat. It uses Sanny Builder with [[CLEO]] for Vice City in an external script (not the main one) and tested on US v1.0.
 +
{{Pre|class=sb-code|1=
 +
<span class="nl">:opcode_0542_supplement</span>
 +
<span class="c1">// 0@ - input param (property index)</span>
 +
<span class="nv">0@</span> += <span class="m">0xA10AFD</span>  <span class="c1">// base address for property owned</span>
 +
05E0: <span class="nv">1@</span> = read_memory <span class="nv">0@</span> size <span class="m">1</span> virtual_protect <span class="m">0</span>  <span class="c1">// get status of property</span>
 +
<span class="k">if</span>
 +
    <span class="nv">1@</span> == <span class="m">1</span>  <span class="c1">// if it is owned</span>
 +
<span class="k">then</span>
 +
    05DF: write_memory <span class="nv">0@</span> size <span class="m">1</span> value <span class="m">0</span> virtual_protect <span class="m">0</span>  <span class="c1">// set to not owned</span>
 +
    05E0: <span class="nv">0@</span> = read_memory <span class="m">0x978E08</span> size <span class="m">4</span> virtual_protect <span class="m">0</span>  <span class="c1">// get total owned</span>
 +
    <span class="nv">0@</span> -= <span class="m">1</span>  <span class="c1">// decrement by 1</span>
 +
    05DF: write_memory <span class="m">0x978E08</span> size <span class="m">4</span> value <span class="nv">0@</span> virtual_protect <span class="m">0</span>  <span class="c1">// set total to new value</span>
 +
<span class="k">end</span>
 +
05F6: ret <span class="m">0</span>
 +
}}
 +
 
 +
Place this line anywhere within the external script:
 +
{{Pre|class=sb-code|1=
 +
05F5: call_scm_func <span class="nl">@opcode_0542_supplement</span> inputs <span class="m">1</span> property_index [int]
 +
}}
 +
 
 +
== Keywords ==
 +
set, add, increment, property, properties, owned, stat, statistics
 +
 
 +
[[Category:Code Snippets]]

Latest revision as of 00:14, 28 November 2016

Vice City SET_PROPERTY_AS_OWNED


Description
Adds a property to the property owned stat
Syntax
0542: add_property [int] to_property_own_stats
Parameter
[int]
Property index (see below)

This opcode adds a property to the "Property Owned" stat (GXT key PROPOWN). The number of property is incremented by one and the name is added to the list of properties. Values higher than the ones in the game can be used but only the number of properties will be incremented; the property name will not show up.

Properties

Id Enum GXT key Property
0 PROP_MALIBU STPR_1 The Malibu
1 PROP_PRINTWORKS STPR_2 Print Works
2 PROP_FILMSTUDIO STPR_3 Film Studio
3 PROP_ICECREAM STPR_4 Ice Cream Factory
4 PROP_CARSHOWROOM STPR_5 Car Showroom
5 PROP_TAXICO STPR_6 Taxi Company
6 PROP_BOATYARD STPR_7 Boatyard
7 PROP_STRIPCLUB STPR_8 Pole Position Club
8 PROP_VICEPOINT STPR_9 3321 Vice Point
9 PROP_LINKSVIEW STPR_10 Links View Apartment
10 PROP_EL_SWANKO STPR_11 El Swanko Casa
11 PROP_WASHINGTON_STREET STPR_12 1102 Washington Street
12 PROP_OCEANHEIGHTS STPR_13 Ocean Heights Apartment
13 PROP_SKUMOLESHACK STPR_14 Skumole Shack
14 PROP_HYMAN_CONDO STPR_15 Hyman Condo

Removing an owned property

This supplemental code allows you to remove a property from the property owned stat. It uses Sanny Builder with CLEO for Vice City in an external script (not the main one) and tested on US v1.0.

:opcode_0542_supplement
// 0@ - input param (property index)
0@ += 0xA10AFD  // base address for property owned
05E0: 1@ = read_memory 0@ size 1 virtual_protect 0  // get status of property
if
    1@ == 1  // if it is owned
then
    05DF: write_memory 0@ size 1 value 0 virtual_protect 0  // set to not owned
    05E0: 0@ = read_memory 0x978E08 size 4 virtual_protect 0  // get total owned
    0@ -= 1  // decrement by 1
    05DF: write_memory 0x978E08 size 4 value 0@ virtual_protect 0  // set total to new value
end
05F6: ret 0

Place this line anywhere within the external script:

05F5: call_scm_func @opcode_0542_supplement inputs 1 property_index [int]

Keywords

set, add, increment, property, properties, owned, stat, statistics