#Game: Vice City Stories
#Author: MicSuit
#Version: 1.0
#Category: Cars
#Date: 2022-06-17
#Description: Spawn a train with 5 baggage handlers. Press Up to disable

0004: 1@ = 216 // Linerunner ID
0004: 11@ = 174 // Baggage Handler ID
0004: 30@ = 4.1 // Offset
0004: 31@ = -4.1 // Negative Offset
0004: 32@ = -0.725 // Another Offset (lol)

02EE: get_offset_from_char_in_world_coords $PLAYER_CHAR offset 3.0 0.0 0.0 store_to 2@ 3@ 4@
02EE: get_offset_from_char_in_world_coords $PLAYER_CHAR offset -100.0 -200.0 -250.0 store_to 16@ 17@ 18@
02EE: get_offset_from_char_in_world_coords $PLAYER_CHAR offset 100.0 200.0 250.0 store_to 19@ 20@ 21@

0160: request_model 1@
0160: request_model 11@      // Request the models we need
0228: load_all_models_now

022C: clear_area 2@ 3@ 4@ radius 100.0 clear_particles 0
0246: clear_area_of_cars 16@ 17@ 18@ to 19@ 20@ 21@  // Clear area of cars



// Spawn Cars
0048: create_car 1@ at 2@ 3@ 4@ store_to 13@ // Linerunner
000A: 3@ -= 30@
0048: create_car 11@ at 2@ 3@ 4@ store_to 14@  // vvv Baggage Handlers
000A: 3@ -= 30@
0048: create_car 11@ at 2@ 3@ 4@ store_to 15@
000A: 3@ -= 30@
0048: create_car 11@ at 2@ 3@ 4@ store_to 16@
000A: 3@ -= 30@
0048: create_car 11@ at 2@ 3@ 4@ store_to 17@
000A: 3@ -= 30@
0048: create_car 11@ at 2@ 3@ 4@ store_to 18@  // ^^^ Baggage Handlers

0275: set_car_can_be_damaged 13@ to 0
0275: set_car_can_be_damaged 14@ to 0
0275: set_car_can_be_damaged 15@ to 0
0275: set_car_can_be_damaged 16@ to 0  // Disable Cars Damage
0275: set_car_can_be_damaged 17@ to 0  
0275: set_car_can_be_damaged 18@ to 0

:CAR_FOLLOW_OTHER
0001: wait 0

	/// Press UP twice to exit out ///////////
	007F: is_button_pressed 0 button 8
	0021: goto_if_true @BAILOUT_MAIN 
	:BAILOUT_CONTINUE
	//////////////////////////////////////////

027F: get_offset_from_car_in_world_coords 13@ offset 0.0 -7.0 -1.65 store_to 8@ 9@ 10@  // Follow the car in front
004E: set_car_coordinates 14@ to 8@ 9@ 10@
00D0: get_car_heading 13@ store_to 27@
00D1: set_car_heading 14@ to 27@

027F: get_offset_from_car_in_world_coords 14@ offset 0.0 31@ 32@ store_to 8@ 9@ 10@
004E: set_car_coordinates 15@ to 8@ 9@ 10@
00D1: set_car_heading 15@ to 27@

027F: get_offset_from_car_in_world_coords 15@ offset 0.0 31@ 32@ store_to 8@ 9@ 10@
004E: set_car_coordinates 16@ to 8@ 9@ 10@
00D1: set_car_heading 16@ to 27@

027F: get_offset_from_car_in_world_coords 16@ offset 0.0 31@ 32@ store_to 8@ 9@ 10@
004E: set_car_coordinates 17@ to 8@ 9@ 10@
00D1: set_car_heading 17@ to 27@

027F: get_offset_from_car_in_world_coords 17@ offset 0.0 31@ 32@ store_to 8@ 9@ 10@
004E: set_car_coordinates 18@ to 8@ 9@ 10@
00D1: set_car_heading 18@ to 27@
0002: goto @CAR_FOLLOW_OTHER

:BAILOUT_MAIN
010E: get_game_timer $1531
0035: $1448 = $1531
0017:   $1450 >= $1448 //do nothing for the first 1000
0021: goto_if_true @BAILOUT_CONTINUE 
0035: $1450 = $1531
0007: $1450 += 1000
0017:   $1449 >= $1448 //button still or pressed again between 1000 and 3500
0021: goto_if_true @BAILOUT_EXIT 
0267: print_help 'Use~h~ ~k~ ~TGSUB~ ~w~again to cancel the script.'  //like 'CAN_CON'
0035: $1449 = $1531 
0007: $1449 += 3500
0002: goto @BAILOUT_CONTINUE
:BAILOUT_EXIT
0268: clear_help

:TERMINATE_SCRIPT
0023: terminate_this_script