////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("ceremony_knife_1", "ceremony_knife_1", "orb_6_of_7", "Kugel", true);
AddEntityCollideCallback("Player", "Monsterevent", "Spawn", true, 1);
AddEntityCollideCallback("Player", "zuruck", "lampe", true, 1);
PlayMusic("29_amb.ogg", true, 1.0f, 0.0f, 5, true);
}

void Kugel(string &in asItem, string &in asEntity) 
{
StartScreenShake(0.50f, 1.4f, 0.70f, 0.70f);
SetEntityActive("orb_5_of_7", true);
SetEntityActive("orb_1_of_7", true);
SetEntityActive("ceremony_knife_2", true);
PlaySoundAtEntity("", "explosion_rock_large.snt", "Player", 0, false);
SetEntityActive("orb_6_of_7", false);
SetEntityActive("servant_grunt_1", false);
AddTimer("", 5.0f, "nice");
AddTimer("", 8.5f, "end");
RemoveItem("ceremony_knife_1");
ShowEnemyPlayerPosition("servant_grunt_1");
SetEntityInteractionDisabled("ceremony_knife_2", true);
CompleteQuest("hauptquest", "hauptquestlos");
PlaySoundAtEntity("", "ui_sanity_gain.snt", "Player", 0, false);
StartEffectFlash(1.0f, 1.0f, 1.0f);
}

void end(string &in asTimer)
{
ChangeMap("map6.map", "PlayerStartArea_1", "", "");
}
void Spawn(string &in asParent, string &in asChild, int alState)
{
SetMessage("FAST", "FASTER", 5.0f);
SetEntityActive("servant_grunt_1", true); 
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
SetPlayerMoveSpeedMul(0.0f);
StartPlayerLookAt("servant_grunt_1", 10.0f, 10.0f, "");
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
AddTimer("", 0.5f, "stoplook");
SetEntityActive("zuruck", true);
}
void stoplook(string &in asTimer)
{
StopPlayerLookAt();
}

void nice(string &in asTimer)
{
SetMessage("nice", "nicer", 5.0f);
}

void lampe(string &in asParent, string &in asChild, int alState)
{
SetPlayerRunSpeedMul(0.0f);
SetLanternDisabled(true);
SetPlayerJumpDisabled(true);
SetPlayerCrouchDisabled(true);
CheckPoint("", "PlayerStartArea_1", "down", "", "");
}

void down(string &in asName, int alCount) 
{
SetPlayerMoveSpeedMul(1.0f);

}
////////////////////////////
// Run when entering map
void OnEnter()
{ 

}
////////////////////////////
// Run when leaving map
void OnLeave()
{

}
