12,236
edits
mNo edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
A '''Script Path''' (also named '''Object Path''') lets the [[main.scm|script]] in [[Grand Theft Auto: Vice City]] attach objects to a path and control their movement along it. The coordinates for the path are stored in a plain text file located in <code>\data\paths\spath0.dat</code>, which is used by Cortez's yacht in the mission "All Hands On Deck!" The game can read any number of script path files in the same directory (<code>spath1.dat</code>, <code>spath2.dat</code>, <code>spath3.dat</code>, etc.) but it can only have up to three script paths loaded at a time. Up to six objects can be attached to a script path at a time. Data on the state and properties of a loaded script path are saved in block 17 of the save file. The concept for script paths closely resembles [[flight.dat|flight]] paths used for airborne NPC vehicles. | A '''Script Path''' (also named '''Object Path''') lets the [[main.scm|script]] in [[Grand Theft Auto: Vice City]] attach objects to a path and control their movement along it. The coordinates for the path are stored in a plain text file located in <code>\data\paths\spath0.dat</code>, which is used by [[Cortez' Yacht|Cortez's yacht]] in the mission "[[All Hands on Deck!|All Hands On Deck!]]" The game can read any number of script path files in the same directory (<code>spath1.dat</code>, <code>spath2.dat</code>, <code>spath3.dat</code>, etc.) but it can only have up to three script paths loaded at a time. Up to six objects can be attached to a script path at a time. Data on the state and properties of a loaded script path are saved in block 17 of the save file. The concept for script paths closely resembles [[flight.dat|flight]] paths used for airborne NPC vehicles. | ||
== Format for spath*.dat == | == Format for spath*.dat == | ||
{{Pre| | |||
NumNodes | NumNodes | ||
X Y Z | X Y Z | ||
}} | |||
{|class="wikitable center-col-1 center-col-2" | {|class="wikitable center-col-1 center-col-2" | ||
Line 27: | Line 27: | ||
== Mission script == | == Mission script == | ||
The following example explains how <code>spath0.dat</code> is used in the original script in [[Sanny Builder]]'s format to move Cortez's yacht. First, the script path is initialized using opcode 049C. | The following example explains how <code>spath0.dat</code> is used in the original script in [[Sanny Builder]]'s format to move Cortez's yacht. First, the script path is initialized using opcode 049C. | ||
{{Pre|1= | |||
049C: $722 = scripted_path_file 0 width 90.0 | 049C: $722 = scripted_path_file 0 width 90.0 | ||
}} | |||
Next, objects need to be created using opcode 029B (opcode 0107 can also be used to create them). | Next, objects need to be created using opcode 029B (opcode 0107 can also be used to create them). | ||
{{Pre|1= | |||
029B: $714 = init_object #YT_MAIN_BODY at -375.499 -1322.31 9.81124 | 029B: $714 = init_object #YT_MAIN_BODY at -375.499 -1322.31 9.81124 | ||
029B: $715 = init_object #YT_MAIN_BODY2 at -375.499 -1322.31 9.81124 | 029B: $715 = init_object #YT_MAIN_BODY2 at -375.499 -1322.31 9.81124 | ||
Line 38: | Line 38: | ||
029B: $718 = init_object #YT_TMP_BOAT at -375.499 -1322.31 9.81124 | 029B: $718 = init_object #YT_TMP_BOAT at -375.499 -1322.31 9.81124 | ||
029B: $719 = init_object #LODMAIN_BODY at -375.499 -1322.31 9.81124 | 029B: $719 = init_object #LODMAIN_BODY at -375.499 -1322.31 9.81124 | ||
}} | |||
These objects are attached to the path using opcode 049D. | These objects are attached to the path using opcode 049D. | ||
{{Pre| | |||
049D: attach_scripted_file $722 with_object $714 | 049D: attach_scripted_file $722 with_object $714 | ||
049D: attach_scripted_file $722 with_object $715 | 049D: attach_scripted_file $722 with_object $715 | ||
Line 47: | Line 47: | ||
049D: attach_scripted_file $722 with_object $718 | 049D: attach_scripted_file $722 with_object $718 | ||
049D: attach_scripted_file $722 with_object $719 | 049D: attach_scripted_file $722 with_object $719 | ||
}} | |||
Lastly, opcode 049E is used to prevent the yacht from moving along the path. | Lastly, opcode 049E is used to prevent the yacht from moving along the path. | ||
{{Pre| | |||
049E: set_scripted_file $722 speed_to 0.0 | 049E: set_scripted_file $722 speed_to 0.0 | ||
}} | |||
During the mission, the yacht's speed varies and is warped along the path in two occasions using opcode 049F. | During the mission, the yacht's speed varies and is warped along the path in two occasions using opcode 049F. | ||
{{Pre| | |||
049E: set_scripted_file $722 speed_to 5.0 | 049E: set_scripted_file $722 speed_to 5.0 | ||
// ... | // ... | ||
049F: set_scripted_file $722 distance_along_path_to 2700.0 | 049F: set_scripted_file $722 distance_along_path_to 2700.0 | ||
}} | |||
When you fail the mission, the yacht is reset back to the beginning. | When you fail the mission, the yacht is reset back to the beginning. | ||
{{Pre| | |||
049F: set_scripted_file $722 distance_along_path_to 0.0 | 049F: set_scripted_file $722 distance_along_path_to 0.0 | ||
049E: set_scripted_file $722 speed_to 0.0 | 049E: set_scripted_file $722 speed_to 0.0 | ||
}} | |||
When you pass the mission, the objects and path are no longer needed so they are removed from the game using opcodes 0108 and 04A1 respectively. | When you pass the mission, the objects and path are no longer needed so they are removed from the game using opcodes 0108 and 04A1 respectively. | ||
{{Pre| | |||
0108: destroy_object $714 | 0108: destroy_object $714 | ||
0108: destroy_object $715 | 0108: destroy_object $715 | ||
Line 75: | Line 75: | ||
0108: destroy_object $719 | 0108: destroy_object $719 | ||
04A1: release_scripted_file $722 | 04A1: release_scripted_file $722 | ||
}} | |||
Note that if a script path is actively moving objects, replays will be disabled. | Note that if a script path is actively moving objects, replays will be disabled. | ||
Line 83: | Line 83: | ||
{{fdl}} | {{fdl}} | ||
{{VC-navi}} | |||
[[Category:Map Formats]] | [[Category:Map Formats]] | ||
[[Category:Mission Script]] | [[Category:Mission Script]] | ||