; SS 6.2 Early Era Campaign Script
; by gracul 17-01-09
;===================== CONTENTS =========================
;---- 1)AI PART
;---- Setup AI
;---- AI Reinforcements
;---- AI Economy Script
;---- Is the AI?
;---- 2)PLAYER PART
;---- Setup Events
;---- City Reveal
;---- Major Events
;---- Player Notification
;---- Interactive Events
;---- 3)EMERGENT FACTIONS/NATIONAL UPRISINGS
;---- William Wallace Uprising
;---- Teutonic Order Emergent
;---- Golden Horde Emergent
;========================================================
;Last Edited by Byg 08-08-09 BGRIV
;
; Campaign script
;
;Modders Notes
;"script" and "end_script" are already in this code, don't add them twice.
;add your own mod's script at the end of the bgr section & before "end_script"
;If your settlements and/or units are different to the ones that ss6.2 uses (see BGR settlement section)
;then you must remove the BGR settlement section and generate your own using the BGRIII installer
;and copy/paste into the same place below.


script
        ; ---------------------
        ; counters

        restrict_strat_radar false

        declare_counter Opened_Faction_Overview_Scroll
		declare_counter Opened_Settlement_Scroll
		declare_counter mongols_urgench
		declare_counter mongols_konjikala
		declare_counter mongols_mashhad

	set_event_counter notre_dame 1

;=========================== DIFFICULTY LEVEL ==================================

	monitor_event FactionTurnStart FactionIsLocal
		and I_TurnNumber = 0
		and CampaignDifficulty = easy

		set_event_counter DifficultyLevel 1

		add_events
		event historic difficulty_easy 
		date 0
		end_add_events



		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionIsLocal
		and I_TurnNumber = 0
		and CampaignDifficulty = medium

		set_event_counter DifficultyLevel 2

		add_events
		event historic difficulty_medium
		date 0
		end_add_events

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionIsLocal
		and I_TurnNumber = 0
		and CampaignDifficulty = hard

		set_event_counter DifficultyLevel 3

		add_events
		event historic difficulty_hard 
		date 0
		end_add_events

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionIsLocal
		and I_TurnNumber = 0
		and CampaignDifficulty = very_hard

		set_event_counter DifficultyLevel 4

		add_events
		event historic difficulty_very_hard 
		date 0
		end_add_events

		terminate_monitor
	end_monitor


;********************************************************
     set_event_counter is_the_ai 0  

    monitor_event PreFactionTurnStart FactionIsLocal

        set_event_counter is_the_ai 0

    end_monitor

    monitor_event PreFactionTurnStart not FactionIsLocal

        set_event_counter is_the_ai 1

    end_monitor
;********************************************************

        ;----------------------
        ; monitors

        ;-- player built first huge cathedral --
	monitor_event EventCounter EventCounterType building_completed_player_huge_cathedral
	              and EventCounter = 1
                historic_event player_first_huge_cathedral event/huge_cathedral_built.bik
              	terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionIsLocal
		and CampaignDifficulty = hard

		set_event_counter c_difficulty 1
		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionIsLocal
		and CampaignDifficulty = very_hard

		set_event_counter c_difficulty 2
		terminate_monitor
	end_monitor

	monitor_event SettlementTurnStart FactionType england
		and not FactionIsLocal
		and I_EventCounter c_difficulty = 1
		console_command add_money england, 300
	end_monitor

	monitor_event SettlementTurnStart FactionType england
		and not FactionIsLocal
		and I_EventCounter c_difficulty = 2
		console_command add_money england, 700
	end_monitor

	monitor_event SettlementTurnStart FactionType france
		and not FactionIsLocal
		and I_EventCounter c_difficulty = 1
		console_command add_money france, 250
	end_monitor

	monitor_event SettlementTurnStart FactionType france
		and not FactionIsLocal
		and I_EventCounter c_difficulty = 2
		console_command add_money france, 500
	end_monitor

	monitor_event SettlementTurnStart FactionType scotland
		and not FactionIsLocal
		and I_EventCounter c_difficulty = 1
		console_command add_money scotland, 350
	end_monitor

	monitor_event SettlementTurnStart FactionType scotland
		and not FactionIsLocal
		and I_EventCounter c_difficulty = 2
		console_command add_money scotland, 700
	end_monitor

	monitor_event BecomesFactionLeader FactionType england
		and not FactionIsLocal
			historic_event new_king_of_england
	end_monitor

	monitor_event BecomesFactionLeader FactionType france
		and not FactionIsLocal
			historic_event new_king_of_france
	end_monitor

	monitor_event BecomesFactionLeader FactionType scotland
		and not FactionIsLocal
			historic_event new_king_of_scotland
	end_monitor

;##########ReallyBadAI BAttle System launching code ########

set_event_counter show_me_how 1

monitor_event GameReloaded TrueCondition

set_event_counter show_me_how 1
end_monitor

monitor_event PreBattlePanelOpen TrueCondition
and I_EventCounter show_me_how = 1

console_command clear_messages
advance_advice_thread G5Script_Thread
wait 1
select_ui_element advisor_portrait_button
simulate_mouse_click lclick_down
simulate_mouse_click lclick_up

wait 2
select_ui_element advisor_show_me_button
simulate_mouse_click lclick_down
simulate_mouse_click lclick_up

select_ui_element advisor_dismiss_button

simulate_mouse_click lclick_down
simulate_mouse_click lclick_up

set_event_counter show_me_how 2
end_monitor

        ; keep script unfinised until last monitor termination
;-------------------------------------------------------------
wait_monitors

end_script

