local main_loop = loadfile("squirrelscripts/main_ai_loop.nut");

function init() {
	timer <- 0;
	rem_cut_scene_on <- false;
	rem_attack <- false;
}

function run_ai() {
	if (is_cut_scene_on() || world_frame_counter() <= timer || rem_attack)
		return;
		
	//3 second delay
	if (!rem_cut_scene_on) {
		my_squads[17].select();
		order_move(17087, 7535);
		
		my_squads[16].select();
		order_move(17247, 6815);
		
		rem_cut_scene_on = true;
		timer = world_frame_counter() + 90;
		return;
	}
	
	if (!rem_attack) {
		foreach(squad in my_squads) {
			type = squad.get_type();
			if (type == 0 || type == 1)
				squad.highlight();
		}
		local pos = side_1_squads[0].get_pos();
		add_waypoint(pos[0], pos[1]);
		launch_mission("attack");
		
		rem_attack = true;
	}
}

main_loop();