From GTAModding
Jump to: navigation, search


Sets the distance along the script path
049F: set_scripted_file [path handle] distance_along_path_to [flt]
[path handle]
The handle of the script path
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.

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

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]


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