#include maps\_utility;

#include maps\_anim;

#using_animtree("generic_human");

main()
{
maps\_load::main();
//precachemodel ("xmodel/vehicle_stuka_flying");

flag_init("disable_fail"); // initialize the flag after load main and before the main mission functions start

thread german_init();
thread obj1();
}




german_init()
{

german = getent ("german", "script_noteworthy");;


for(;;) // infinite loop
{

if(isAlive(german))
{
german.maxsightdistsqrd = (5*5);
german.health = 10;
german waittill("death");
thread mission_failure();
}

else if(flag("disable_fail")) //else if flag is set, disable the fail via flag
break; //stop loop so fail wont work if german dies.

wait 0.05;	 // when you use infinite loop put that wait here so you wont get infinite loop error

}

wait(.05);	
}





obj1()
{
obj1 = getent("obj1", "targetname"); 
objective_add(1, "active", &"OASIS_OBJECTIVE_FOLLOW",getent("obj1marker", "targetname").origin);
objective_current(1); 

obj1 waittill("trigger");

objective_state(1, "done"); 
obj1 delete();

thread obj2();	
}


obj2()
{
flag_set("disable_fail");

thread germansuccess();

obj2 = getent("obj2", "targetname"); 
objective_add(2, "active", &"OASIS_OBJECTIVE_KILL_SNIPER",getent("obj2", "targetname").origin);
objective_current(2); 

obj2 waittill("death");
objective_state(2, "done");
}

germansuccess()
{
german = getent ("german", "script_noteworthy");;

if(isAlive(german))
{
german.maxsightdistsqrd = (5*5);
german.health = 10;
german waittill("death");
}
wait(.05);	

//thread continue_mission();

}



mission_failure()	
{
setCvar("ui_deadquote", "@SCRIPT_MISSION_FAILURE_ALERTED_ENEMY");
maps\_utility::missionFailedWrapper();
}