script

; init
	prepare_for_battle

;label_unit  ALLIANCE  ARMY  UNIT


label_unit 0 0 0 	rgeneral
label_unit 0 0 1	rb
label_unit 0 0 2 	rc
label_unit 0 0 3 	rd
label_unit 0 0 4 	re
label_unit 0 0 5 	rf
label_unit 0 0 6	rg
label_unit 0 0 7	rh
label_unit 0 0 8	ri
label_unit 0 0 9	rj
label_unit 0 0 10	rk
label_unit 0 0 11	rl
label_unit 0 0 12	rm
label_unit 0 0 13	rn
label_unit 0 0 14	ro
label_unit 0 0 15	rp
label_unit 0 0 16	rq
label_unit 0 0 17	rr
label_unit 0 0 18	rs
label_unit 0 0 19	rt




label_unit 1 0 0	cgeneral
label_unit 1 0 1	cb
label_unit 1 0 2	cc
label_unit 1 0 3	cd
label_unit 1 0 4	ce
label_unit 1 0 5	cf
label_unit 1 0 6	cg
label_unit 1 0 7	ch
label_unit 1 0 8	ci
label_unit 1 0 9	cj
label_unit 1 0 10	ck
label_unit 1 0 11	cl
label_unit 1 0 12	cm
label_unit 1 0 13	cn
label_unit 1 0 14	co
label_unit 1 0 15	cp
label_unit 1 0 16	cq
label_unit 1 0 17	cr
label_unit 1 0 18	cs
label_unit 1 0 19	ct


	declare_counter battle_start
	declare_counter intro_sequence
	declare_counter player_control

	disable_cursor						;prevent the player clicking
	suspend_unscripted_advice true
	disable_shortcuts true		
	disable_entire_ui
	inhibit_camera_input true



;BATTLE SCRIPT

	while ! I_BattleStarted					; WAIT FOR DEPLOYMENT
	end_while

	ai_active_set off

	camera_default_mode_set tw

	battle_default_camera

;-----------------------------------------------------------------------------------------------------------
	steal_esc_key

	monitor_event EscPressed TrueCondition

		unit_group_immediate_place escipion -30 130 180
		unit_group_immediate_place numidas -280 140 180
		unit_group_immediate_place cartagineses -95 -95 0


		if I_PlayerInRangeOfUnitGroup escipion
			camera_position_at_bookmark 14
		end_if

		if I_PlayerInRangeOfUnitGroup cartagineses
			camera_position_at_bookmark 15
		end_if

set_counter battle_start 1

	terminate_monitor
	end_monitor
;-----------------------------------------------------------------------------------------------------------

	set_counter intro_sequence 1	;	kicks off intro sequence


; *********************************************************************************************
; ***************************************INTRO*************************************************
; *********************************************************************************************


monitor_conditions I_CompareCounter intro_sequence = 1

unit_order_move rq -200 120 run
unit_order_move rr -260 120 run			


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   groups



			set_camera_bookmark 0, -607.5, 229.5, 97.95  -614.29, 235, 91.735
			set_camera_bookmark 1, -116, 192.7, -207.1 -115.9, 187.73, -215.576
			set_camera_bookmark 2, -127.6, 191.7, -229.9 -119.577, 190.131, -235.1
			set_camera_bookmark 3, -160.7, 192.1, 251.0, -165.415, 188.792, 258.617
			set_camera_bookmark 4, -115.422, 214.6, 296.447 -115.224, 208.726, 287.787
			set_camera_bookmark 5, -103.652, 192.321, 260.35 -104.582, 188.933, 269.8
			set_camera_bookmark 6, -86.31, 199.633, 255.866 -91.7, 196.314, 247.831
			set_camera_bookmark 7, -116.262, 193.113, -152.645 -116.586, 189.86, -161.896
			set_camera_bookmark 8, -165.33, 202, -153.164 -160.1, 199.63, -145.135
			set_camera_bookmark 9, -607.73, 229.9, 96.27 -598.05, 227.4, 94.7537
			set_camera_bookmark 10, -300, 280, 47.2725 -291.924, 276.8, 46.912
			set_camera_bookmark 11, -115.852, 204.736, 149.153 -115.697, 198.708, 157.55
			set_camera_bookmark 12, -110.9, 198.327, -37.4515 -110.55, 194, -46.7494
			set_camera_bookmark 13, -275.74, 192, 166.5 -270.62, 189.611, 158.373
			set_camera_bookmark 14, -110, 204, 208.816 -110.346, 199.7, 199.5
			set_camera_bookmark 15, -117.46, 201.444, -148.975 -117.276, 197.434, -140.365



	define_unit_group escipion rgeneral rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rs rt
	define_unit_group numidas rq rr

	define_unit_group cartagineses cgeneral cb cc cd ce cf cg ch ci cj ck cl cm cn co cp cq cr cs ct

	
			camera_restrictions_set off
			unit_set_fire_at_will_mode cb off
			unit_set_fire_at_will_mode rq off
			unit_set_fire_at_will_mode rr off
			unit_set_skirmish_mode rq off
			unit_set_skirmish_mode rr off
			hide_ui

; *********************************************************************************************


			camera_position_at_bookmark 0
set_music_state tension

			battle_wait 3
	while I_CompareCounter battle_start = 1		; ESC DUMP
			terminate_monitor
	end_while					; ESC DUMP
			camera_zoom_to_bookmark 9 1
			play_sound_event ZAMA_SPEECH_00 tag = ZAMA_SPEECH_00
unit_group_order_relative_move_formed escipion 0 80
unit_group_order_relative_move_formed cartagineses 0 120

			battle_wait 3.5
	while I_CompareCounter battle_start = 1		; ESC DUMP
			terminate_monitor
	end_while					; ESC DUMP


			camera_position_at_bookmark 1
			play_sound_event ZAMA_SPEECH_01 tag = ZAMA_SPEECH_01
			battle_wait 4
	while I_CompareCounter battle_start = 1		; ESC DUMP
			terminate_monitor
	end_while					; ESC DUMP


			camera_position_at_bookmark 2
			camera_track_unit cgeneral left 1.5 1
			battle_wait 0.1
			play_sound_event ZAMA_SPEECH_03 tag = ZAMA_SPEECH_03
			battle_wait 5
	while I_CompareCounter battle_start = 1		; ESC DUMP
			terminate_monitor
	end_while					; ESC DUMP

			camera_position_at_bookmark 3

			play_sound_event ZAMA_SPEECH_02 tag = ZAMA_SPEECH_02
			battle_wait 5
	while I_CompareCounter battle_start = 1		; ESC DUMP
			terminate_monitor
	end_while					; ESC DUMP

			camera_position_at_bookmark 4

			play_sound_event ZAMA_SPEECH_04 tag = ZAMA_SPEECH_04
			battle_wait 5
	while I_CompareCounter battle_start = 1		; ESC DUMP
			terminate_monitor
	end_while					; ESC DUMP

			camera_position_at_bookmark 5
			camera_track_unit rgeneral front 14 3
			play_sound_event ZAMA_SPEECH_05 tag = ZAMA_SPEECH_05
			battle_wait 4
	while I_CompareCounter battle_start = 1		; ESC DUMP
			terminate_monitor
	end_while					; ESC DUMP

			camera_track_unit rgeneral left 1.5 1
			battle_wait 0.1
			play_sound_event ZAMA_SPEECH_06 tag = ZAMA_SPEECH_06
			battle_wait 4
	while I_CompareCounter battle_start = 1		 ; ESC DUMP
			terminate_monitor
	end_while					 ; ESC DUMP

			camera_position_at_bookmark 6

			play_sound_event ZAMA_SPEECH_07 tag = ZAMA_SPEECH_07
			battle_wait 5
	while I_CompareCounter battle_start = 1		 ; ESC DUMP
			terminate_monitor
	end_while					 ; ESC DUMP

			camera_position_at_bookmark 7
			play_sound_event ZAMA_SPEECH_08 tag = ZAMA_SPEECH_08
			battle_wait 4
	while I_CompareCounter battle_start = 1		 ; ESC DUMP
			terminate_monitor
	end_while					 ; ESC DUMP

			camera_position_at_bookmark 8

			play_sound_event ZAMA_SPEECH_09 tag = ZAMA_SPEECH_09
			battle_wait 4
	while I_CompareCounter battle_start = 1		 ; ESC DUMP
			terminate_monitor
	end_while					 ; ESC DUMP

			camera_position_at_bookmark 9

			play_sound_event ZAMA_SPEECH_10 tag = ZAMA_SPEECH_10
			battle_wait 4
	while I_CompareCounter battle_start = 1		 ; ESC DUMP
			terminate_monitor
	end_while					 ; ESC DUMP

			camera_position_at_bookmark 10

			play_sound_event ZAMA_SPEECH_11 tag = ZAMA_SPEECH_11
			battle_wait 4
	while I_CompareCounter battle_start = 1		 ; ESC DUMP
			terminate_monitor
	end_while					 ; ESC DUMP

			camera_position_at_bookmark 11

			play_sound_event ZAMA_SPEECH_12 tag = ZAMA_SPEECH_12
			battle_wait 4
	while I_CompareCounter battle_start = 1		 ; ESC DUMP
			terminate_monitor
	end_while					 ; ESC DUMP

			camera_position_at_bookmark 12

			play_sound_event ZAMA_SPEECH_13 tag = ZAMA_SPEECH_13
			battle_wait 4
	while I_CompareCounter battle_start = 1		 ; ESC DUMP
			terminate_monitor
	end_while					 ; ESC DUMP

			camera_position_at_bookmark 13
			camera_track_unit rr back 10 1
			play_sound_event ZAMA_SPEECH_14 tag = ZAMA_SPEECH_14
			battle_wait 4
			unit_order_turn rq 180
			unit_order_turn rr 180
			battle_wait 4

		set_counter battle_start 1

			
		terminate_monitor
	end_monitor


; *************************************** FIN INTRO *******************************************

;	COMIENZO DE BATALLA
; *********************************************************************************************

	monitor_conditions I_CompareCounter battle_start = 1

			undefine_unit_group escipion
			undefine_unit_group cartagineses

		if I_PlayerInRangeOfUnitGroup escipion
			camera_position_at_bookmark 14
		end_if

		if I_PlayerInRangeOfUnitGroup cartagineses
			camera_position_at_bookmark 15
		end_if
			set_counter player_control 1

		terminate_monitor
	end_monitor



; *********************************************************************************************
;	devuelve la interfaz y el control de juego
; *********************************************************************************************

	monitor_conditions I_CompareCounter player_control = 1


			;camera_restrictions_set on

			show_ui

			enable_cursor						;prevent the player clicking
			disable_shortcuts false		
			enable_entire_ui
			inhibit_camera_input false


			steal_esc_key off

			camera_default_mode_set user_pref

			pause_battle

			suspend_unscripted_advice false


	ai_active_set on
		terminate_monitor
	end_monitor



	while I_InBattle
	end_while

	end_script