Difference between revisions of "Script Path"

From GTAMods Wiki
Jump to navigation Jump to search
(rewriting)
Line 1: Line 1:
'''Spath'''.dat files are '''scripted path''' files used only in [[Vice City]] to script an object onto a path that is too much to just shove into the <code>[[main.scm]]</code>. These files are located in the maps/data folder in the Vice City directory. This file contains coordinates for the <code>main.scm</code> to use. By default, Vice City has only one scripted path file, the <code>spath0.dat</code>, which controls Cortez's yacht in the mission "All Hands On Deck!"
+
'''Spath'''*.dat files are '''scripted path''' files used only in [[Vice City]] to attach and move objects along a path. These files are located in the maps/data 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 scripted path file, <code>spath0.dat</code>, which controls Cortez's yacht in the mission "All Hands On Deck!" Additional scripted 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.
  
Scripted paths are replaced by the binary [[Carrec|R3]] file format in [[San Andreas]] and [[GTA IV]].
+
Scripted paths was preceded by binary <code>[[chase.dat|chase*.dat]]</code> files from [[GTA 3]] and are replaced by the binary [[Carrec|R3]] file format in [[San Andreas]] and [[GTA IV]].
  
 
== Format ==
 
== Format ==
The file starts with the number of coordinates that will be used in the file. The rest of the file are X, Y, and Z coordinates linked as a path in the game.
+
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.
  
== How 2.0 ==
+
== Scripting ==
The scripted path file needs to be defined in the main.scm using opcode [[049C]] in order for it to work. To attach an object onto the path, first define the object. Create the object using the opcode [[029B]]. Attach the object onto the path using the opcode [[049D]]. You can attach as many object as you want onto the same path. Lastly, set the speed of the object on the path using opcode [[049E]]. To remove references to the scripted path file from the <code>main.scm</code>, use the opcode [[04A1]]. The opcode [[049F]] sets the distance you want the object to move on the path. In order to add more scripted path files, create a file named spath#, '#' being an integer in order after the last one.
+
The following information uses [[Sanny Builder]] to explain how to use these files through the <code>main.scm</code> file. First, the scripted path files needs to be defined in the script file using opcode [[049C]].
 +
049C: <span style="color:blue">0@</span> = 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 <span style="color:blue">0@</span> with_object <span style="color:blue">1@</span>
 +
Lastly, the attached objects can start moving along the path using opcode [[049E]].
 +
049E: set_scripted_file <span style="color:blue">0@</span> speed_to 5.0
 +
Additional opcodes related to scripted paths include [[049F]], which warps the objects along the path instead of moving it, and opcode [[04A1]], which removes all references of the specified scripted path from the game.
  
== Current Usage ==
+
== See also ==
Currently, the Liberty City and [[Myriad Islands]] modifications for Vice City uses this feature. In the Liberty City mod, this is used to move the train around the city. In Myriad Islands, it was briefly used in a user-made mission to move Cortez's yacht.
 
 
 
== See Also ==
 
 
* [[Carrec|Carrec.img]]
 
* [[Carrec|Carrec.img]]
  
 
[[Category:Map Formats]][[Category:Mission_Script]][[Category:GTA VC]]
 
[[Category:Map Formats]][[Category:Mission_Script]][[Category:GTA VC]]

Revision as of 10:34, 25 April 2010

Spath*.dat files are scripted path files used only in Vice City to attach and move objects along a path. These files are located in the maps/data 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 scripted path file, spath0.dat, which controls Cortez's yacht in the mission "All Hands On Deck!" Additional scripted 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.

Scripted paths was preceded by binary chase*.dat files from GTA 3 and are replaced by the binary R3 file format in San Andreas and GTA IV.

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.

Scripting

The following information uses Sanny Builder to explain how to use these files through the main.scm file. First, the scripted 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

Additional opcodes related to scripted paths include 049F, which warps the objects along the path instead of moving it, and opcode 04A1, which removes all references of the specified scripted path from the game.

See also