Difference between revisions of "049F"

From GTAMods Wiki
Jump to navigation Jump to search
(Created page with "{{Icon|VC}} '''SET_OBJECT_PATH_POSITION''' <hr /> '''Description''' : Sets the distance along the script path '''Syntax''' : 049F: set_scripted_file [''path ha...")
 
(highlight)
 
Line 1: Line 1:
{{Icon|VC}} '''SET_OBJECT_PATH_POSITION'''
+
{{OpCode
<hr />
+
| games      = {{Icon|VC}}
'''Description'''
+
| command    = SET_OBJECT_PATH_POSITION
: Sets the distance along the [[Script Path|script path]]
+
| description = Sets the distance along the [[Script Path|script path]]
'''Syntax'''
+
| syntax1    = 049F: set_scripted_file [''path handle''] distance_along_path_to [''flt'']
: 049F: set_scripted_file [''path handle''] distance_along_path_to [''flt'']
+
| p1t        = [''path handle'']
'''Parameter'''
+
| p1d        = The handle of the script path
: [''path handle'']
+
| p2t        = [''flt'']
:: The handle of the script path
+
| p2d        = Distance along the path in units
: [''flt'']
+
}}
:: Distance along the path in units
 
  
This opcode sets the distance in units to put attached objects along the script path. ''0.0'' is the beginning of the path and the distance will never exceed the total distance of the path.
+
This opcode sets the distance in units to put attached objects along the script path. ''0.0'' is the beginning of the path and the distance will never exceed the total length of the path.
  
 
== Getting the distance ==
 
== Getting the distance ==
 
There is an [[List of unsupported opcodes|unsupported opcode]] 04A0 with the command "GET_<wbr>OBJECT_<wbr>DISTANCE_<wbr>ALONG_<wbr>PATH" with two parameters. The first parameter is the handle of the script path and the second one is the variable to store a floating-point value. The command and parameters imply that it was possible to get the distance of attached objects along the path through the script. 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, makes it possible to recreate the effect of the opcode.
 
There is an [[List of unsupported opcodes|unsupported opcode]] 04A0 with the command "GET_<wbr>OBJECT_<wbr>DISTANCE_<wbr>ALONG_<wbr>PATH" with two parameters. The first parameter is the handle of the script path and the second one is the variable to store a floating-point value. The command and parameters imply that it was possible to get the distance of attached objects along the path through the script. 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, makes it possible to recreate the effect of the opcode.
<syntaxhighlight lang="scm">:opcode_04A0
+
{{Pre|class=sb-code|1=
// 0@ - input param (path handle)
+
<span class="nl">:opcode_04A0</span>
0@ *= 0x34  // size of script path struct
+
<span class="c1">// 0@ - input param (path handle)</span>
0@ += 0x9B69AC  // base address for script paths
+
<span class="nv">0@</span> *= <span class="m">0x34</span> <span class="c1">// size of script path struct</span>
0@ += 0x10  // distance along path
+
<span class="nv">0@</span> += <span class="m">0x9B69AC</span> <span class="c1">// base address for script paths</span>
05E0: 0@ = read_memory 0@ size 4 virtual_protect 0  // read value
+
<span class="nv">0@</span> += <span class="m">0x10</span> <span class="c1">// distance along path</span>
05F6: ret 1 0@</syntaxhighlight>
+
05E0: <span class="nv">0@</span> = read_memory <span class="nv">0@</span> size <span class="m">4</span> virtual_protect <span class="m">0</span> <span class="c1">// read value</span>
 +
05F6: ret <span class="m">1</span> <span class="nv">0@</span>
 +
}}
 +
 
 
Use this line as a recreation for opcode 04A0. This can be placed anywhere within the external script.
 
Use this line as a recreation for opcode 04A0. This can be placed anywhere within the external script.
<syntaxhighlight lang="scm">05F5: call_scm_func @opcode_04A0 inputs 1 path_handle [path handle] store_to [var]</syntaxhighlight>
+
{{Pre|class=sb-code|1=
 +
05F5: call_scm_func <span class="nl">@opcode_04A0</span> inputs <span class="m">1</span> path_handle [path handle] store_to [<span class="k">var</span>]
 +
}}
  
 
== Keywords ==
 
== Keywords ==
 
set, object, script, scripted, path, file, distance, position
 
set, object, script, scripted, path, file, distance, position
 
[[Category:OpCodes]]
 
[[Category:Code Snippets]]
 

Latest revision as of 06:46, 20 December 2016

Vice City SET_OBJECT_PATH_POSITION


Description
Sets the distance along the script path
Syntax
049F: set_scripted_file [path handle] distance_along_path_to [flt]
Parameter
[path handle]
The handle of the script path
[flt]
Distance along the path in units

This opcode sets the distance in units to put attached objects along the script path. 0.0 is the beginning of the path and the distance will never exceed the total length of the path.

Getting the distance

There is an unsupported opcode 04A0 with the command "GET_OBJECT_DISTANCE_ALONG_PATH" with two parameters. The first parameter is the handle of the script path and the second one is the variable to store a floating-point value. The command and parameters imply that it was possible to get the distance of attached objects along the path through the script. 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, makes it possible to recreate the effect of the opcode.

:opcode_04A0
// 0@ - input param (path handle)
0@ *= 0x34  // size of script path struct
0@ += 0x9B69AC  // base address for script paths
0@ += 0x10  // distance along path
05E0: 0@ = read_memory 0@ size 4 virtual_protect 0  // read value
05F6: ret 1 0@

Use this line as a recreation for opcode 04A0. This can be placed anywhere within the external script.

05F5: call_scm_func @opcode_04A0 inputs 1 path_handle [path handle] store_to [var]

Keywords

set, object, script, scripted, path, file, distance, position