Difference between revisions of "Script Path"

From GTAMods Wiki
Jump to navigation Jump to search
Line 1: Line 1:
'''Spath'''*.dat files are plain text '''script path''' files used only in [[Vice City]] to attach and move map objects along a path. These files are located in the <code>..\data\paths</code> folder in the Vice City directory. These files, which mainly contain coordinates, can be controlled by the <code>[[main.scm]]</code> script file. By default, Vice City has only one script path file, <code>spath0.dat</code>, which controls Cortez's yacht in the mission "All Hands On Deck!" Additional script path files can be created by incrementing the number at the end of the file name by one, i.e. <code>spath1.dat</code>, <code>spath2.dat</code>, etc.
+
'''Spath'''*.dat files are plain text '''script path''' files used only in [[Vice City]] to attach and move map objects along a path. These files are located in the <code>{{dir|vc}}\data\paths</code> folder in the Vice City directory. These files, which mainly contain coordinates, can be controlled by the <code>[[main.scm]]</code> script file. By default, Vice City has only one script path file, <code>spath0.dat</code>, which controls Cortez's yacht in the mission "All Hands On Deck!" Additional script path files can be created by incrementing the number at the end of the file name by one, i.e., <code>spath1.dat</code>, <code>spath2.dat</code>, etc.
  
The concept of script paths were preceded by binary <code>[[chase.dat|chase*.dat]]</code> files from [[GTA 3]] and are succeeded by the binary [[Carrec|R3]] file format in [[San Andreas]] and [[GTA IV]].
+
The concept of script paths were preceded by binary <code>[[chase.dat|chase*.dat]]</code> files from [[GTA III]] and are succeeded by the binary [[Carrec|R3]] file format in [[San Andreas]] and [[GTA IV]].
  
 
== Format ==
 
== Format ==
The file starts with the number of lines coordinates that are to be read in the file. The rest of the file contains X, Y, and Z coordinates linked as a path in the game. Undefined lines of coordinates will use the center of the game (0, 0, 0) for the path.
+
{|{{Prettytable}}
 +
! width="36px"| {{Icon|VC}}
 +
! width="100px"| Type
 +
! Description
 +
|-
 +
! colspan="3" | Section 1
 +
|-
 +
| <center>A</center> || integer || The number of lines that are to be read from the file.
 +
|-
 +
! colspan="3" | Section 2
 +
|-
 +
| <center>A,B,C</center> || float[3] || X, Y, Z coordinates, each line linked to create a path
 +
|}
 +
Undefined lines of coordinates will use the center of the game (0, 0, 0) for the path.
  
 
== Scripting ==
 
== Scripting ==
Line 19: Line 32:
 
* [[Carrec|Carrec.img]]
 
* [[Carrec|Carrec.img]]
  
[[Category:Map Formats]][[Category:Mission_Script]][[Category:GTA VC]]
+
{{VC-navi}}
 +
 
 +
[[Category:Map Formats]][[Category:Mission_Script]]

Revision as of 11:59, 13 January 2012

Spath*.dat files are plain text script path files used only in Vice City to attach and move map objects along a path. These files are located in the .\data\paths folder in the Vice City directory. These files, which mainly contain coordinates, can be controlled by the main.scm script file. By default, Vice City has only one script path file, spath0.dat, which controls Cortez's yacht in the mission "All Hands On Deck!" Additional script path files can be created by incrementing the number at the end of the file name by one, i.e., spath1.dat, spath2.dat, etc.

The concept of script paths were preceded by binary chase*.dat files from GTA III and are succeeded by the binary R3 file format in San Andreas and GTA IV.

Format

Vice City Type Description
Section 1
A
integer The number of lines that are to be read from the file.
Section 2
A,B,C
float[3] X, Y, Z coordinates, each line linked to create a path

Undefined lines of coordinates will use the center of the game (0, 0, 0) for the path.

Scripting

The following information uses Sanny Builder to explain how to use these files through the main.scm file. First, the script path files needs to be defined in the script file using opcode 049C.

049C: 0@ = scripted_path_file 0 width 5.0

Next, objects need to be created either by opcode 0107 or 029B. These objects need to be attached to the path using opcode 049D.

049D: attach_scripted_file 0@ with_object 1@

Lastly, the attached objects can start moving along the path using opcode 049E.

049E: set_scripted_file 0@ speed_to 5.0

Note that if a script path is actively moving objects, replays will be disabled. Additional opcodes related to script paths include 049F, which warps the objects along the path instead of moving it, and opcode 04A1, which removes all references of the specified script path from the game. All of these attributes are saved in the block 17 of the save file so that you don't have to reapply the attributes again.

See also