void OnStart()
{




//GLOBAL INTS FOR KNIFE AND SAW
SetGlobalVarInt("Saw", 1);
SetGlobalVarInt("Knife", 1);
SetGlobalVarInt("Boxes", 1);

SetEntityPlayerInteractCallback("cermony_knife", "Set_Knife_int", true);
SetEntityPlayerInteractCallback("BoneSaw", "Set_Saw_int", true);

//BRUTES
AddEntityCollideCallback("Player", "spawn_monster1_area", "spawn_monster_1", true, 1);
AddEntityCollideCallback("Player", "spawn_monster2_area", "spawn_monster_2", true, 1);
AddEntityCollideCallback("Player", "break_shelf", "no_shelf", true, 1);


//PATH FOR 1
AddEnemyPatrolNode("servant_brute_1", "path_1_1", 0, "");
AddEnemyPatrolNode("servant_brute_1", "path_1_2", 0, "");
AddEnemyPatrolNode("servant_brute_1", "path_1_3", 0, "");
AddEnemyPatrolNode("servant_brute_1", "path_1_4", 0, "");
AddEnemyPatrolNode("servant_brute_1", "path_1_5", 4.0, "");
AddEnemyPatrolNode("servant_brute_1", "path_1_4", 0, "");
AddEnemyPatrolNode("servant_brute_1", "path_1_3", 0, "");
AddEnemyPatrolNode("servant_brute_1", "path_1_2", 0, "");
AddEnemyPatrolNode("servant_brute_1", "path_1_1", 0, "");
AddEntityCollideCallback("servant_brute_1", "despawn_monster1_area", "despawn_monster_1", true, 1);


//PATH FOR 2
AddEnemyPatrolNode("servant_brute_2", "path_2_1", 0, "");
AddEnemyPatrolNode("servant_brute_2", "path_2_2", 0, "");
AddEnemyPatrolNode("servant_brute_2", "path_2_3", 0, "");
AddEnemyPatrolNode("servant_brute_2", "path_2_4", 0, "");
AddEnemyPatrolNode("servant_brute_2", "path_2_5", 0, "");
AddEnemyPatrolNode("servant_brute_2", "path_2_6", 0, "");
AddEnemyPatrolNode("servant_brute_2", "path_2_7", 0, "");
AddEnemyPatrolNode("servant_brute_2", "path_2_8", 0, "");
AddEnemyPatrolNode("servant_brute_2", "path_2_7", 0, "");
AddEnemyPatrolNode("servant_brute_2", "path_2_6", 0, "");
AddEnemyPatrolNode("servant_brute_2", "path_2_5", 0, "");
AddEnemyPatrolNode("servant_brute_2", "path_2_4", 0, "");
AddEnemyPatrolNode("servant_brute_2", "path_2_3", 0, "");
AddEnemyPatrolNode("servant_brute_2", "path_2_2", 0, "");
AddEnemyPatrolNode("servant_brute_2", "path_2_1", 0, "");


//REVISIT
AddEntityCollideCallback("Player", "area_2", "set_up_spawns", true, 1);
}

//MUSIC
void OnEnter()
{
PlayMusic("search_suitor.ogg", true, 1.0, 2.0, 0, true);

if (GetGlobalVarInt("Boxes")==2)
	{
		SetEntityActive("wood_box01_breakable_1", false);
		SetEntityActive("wood_box01_breakable_2", false);
		SetEntityActive("wood_box01_breakable_3", false);
	}
}

//GLOBAL INT CHANGE BEFORE REVIST
void Set_Saw_int(string &in entity)
{
SetGlobalVarInt("Saw", 2);
}

void Set_Knife_int(string &in entity)
{
SetGlobalVarInt("Knife", 2);
}


//REVISIT
void set_up_spawns(string &in asParent, string &in asChild, int alState)
{
SetEntityPlayerInteractCallback("cermony_knife", "loud_roar", true);
SetEntityPlayerInteractCallback("BoneSaw", "spawn_3", true);
}

void spawn_3(string &in entity)
{
SetGlobalVarInt("Saw", 2);
SetEntityActive("servant_brute_3", true);
AddEnemyPatrolNode("servant_brute_3", "path_2_5", 0, "");
AddEnemyPatrolNode("servant_brute_3", "path_2_6", 0, "");
AddEnemyPatrolNode("servant_brute_3", "path_2_7", 0, "");
AddEnemyPatrolNode("servant_brute_3", "path_2_8", 0, "");
AddEnemyPatrolNode("servant_brute_3", "path_2_7", 0, "");
AddEnemyPatrolNode("servant_brute_3", "path_2_6", 0, "");
AddEnemyPatrolNode("servant_brute_3", "path_2_5", 0, "");
}

void loud_roar(string &in entity)
{
AddTimer("roaring", 2.5, "start_roar");
SetGlobalVarInt("Knife", 2);
}

void start_roar(string &in asTimer)
{
StopMusic(1.0, 0);
PlaySoundAtEntity("", "roar2.snt", "spawn_monster2_area", 1.0, false);
}

//BRUTE 1
void spawn_monster_1(string &in asParent, string &in asChild, int alState)
{
StopMusic(1.0, 0);
AddTimer("spawning1", 4.0, "spawning_1");
AddTimer("creeking", 2.5, "creek_1");
PlaySoundAtEntity("", "door_level_wood_close.snt", "sound_area_1", 1.0, false);
}

void creek_1(string &in asTimer)
{
PlaySoundAtEntity("", "metal_walk.snt", "Player", 0, false);
}

void spawning_1(string &in asTimer)
{
SetEntityActive("servant_brute_1", true);
}

void despawn_monster_1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_1", false);
}

//BRUTE 2
void spawn_monster_2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("storage_box_wood02_moveable_1", false);
SetEntityActive("servant_brute_1", false);
SetEntityActive("servant_brute_2", true);
}

void no_shelf(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_2", false);
SetEntityActive("servant_brute_3", true);
AddEnemyPatrolNode("servant_brute_3", "path_2_8", 0, "");
AddEnemyPatrolNode("servant_brute_3", "path_2_7", 0, "");
AddEnemyPatrolNode("servant_brute_3", "path_2_6", 0, "");
AddEnemyPatrolNode("servant_brute_3", "path_2_5", 0, "");
SetPropHealth("wood_box01_breakable_1", 0);
SetPropHealth("wood_box01_breakable_2", 0);
SetPropHealth("wood_box01_breakable_3", 0);
SetGlobalVarInt("Boxes", 2);
CreateParticleSystemAtEntity("", "ps_break_mansionbase_wall.ps", "break_area", false);
PlaySoundAtEntity("", "break_wood.snt", "break_area", 0, false);
}
