049F

From GTAMods Wiki
Revision as of 06:41, 25 July 2015 by Spaceeinstein (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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 distance 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