void OnStart()
{
	//Add the Lantern and 10 Tinderboxes when in Debug mode, always good to have light!
    if(ScriptDebugOn())
    {
        GiveItemFromFile("lantern", "lantern.ent");
		SetPlayerLampOil(100.0f);
        for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
	}
	SetPlayerHealth(100);
	SetPlayerSanity(0.7f);
	SetPlayerMoveSpeedMul(1.2f);
	SetPlayerRunSpeedMul(1.1f);
	SetPlayerLookSpeedMul(0.6f);
	StartPlayerLookAt("LookAt", 1.5f, 1.0f, "");
	FadeImageTrailTo(2, 1);
	
	PlayMusic("08_amb.ogg", true, 1.0f, 2.0f, 10, false);
	PlaySoundAtEntity("Ringing", "insanity_ear_ring.snt", "Player", 2, true);
	
	CheckPoint("", "PlayerStartArea_1", "MapFunc", "", "");
	SetLanternDisabled(true);
	SetInventoryDisabled(true);
	SetGlobalVarInt("DreamChange", 5);
	AddTimer("Loop1", 14, "LoopTimer");
	
	SetupLoadScreen("LoadingText", "LoadScreenFromDream", 0, "game_loading_hand.jpg");
	
	SetDeathHint("Hints", "DreamDeath");
	AddTimer("", 8, "StopRing");
	
}
void StopRing(string &in asTimer)
{
	StopSound("Ringing", 2);
}
void LoopTimer(string &in asTimer)
{
	for (int x = 0; x < 22; x += 1)
	{
		SetEntityActive("servant_brute_" + x, true);
		SetPropHealth("mansion_" + x, 0);
	}
	AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 0, "");
	AddEnemyPatrolNode("servant_brute_4", "PathNodeArea_1", 0, "");
	AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_4", 0, "");
	AddEnemyPatrolNode("servant_brute_3", "PathNodeArea_3", 0, "");
	AddEnemyPatrolNode("servant_brute_7", "PathNodeArea_6", 0, "");
	AddEnemyPatrolNode("servant_brute_5", "PathNodeArea_5", 0, "");
	AddEnemyPatrolNode("servant_brute_6", "PathNodeArea_8", 0, "");
	AddEnemyPatrolNode("servant_brute_8", "PathNodeArea_7", 0, "");
	AddEnemyPatrolNode("servant_brute_11", "PathNodeArea_10", 0, "");
	AddEnemyPatrolNode("servant_brute_9", "PathNodeArea_9", 0, "");
	AddEnemyPatrolNode("servant_brute_10", "PathNodeArea_12", 0, "");
	AddEnemyPatrolNode("servant_brute_12", "PathNodeArea_11", 0, "");
	AddEnemyPatrolNode("servant_brute_15", "PathNodeArea_14", 0, "");
	AddEnemyPatrolNode("servant_brute_13", "PathNodeArea_13", 0, "");
	AddEnemyPatrolNode("servant_brute_14", "PathNodeArea_16", 0, "");
	AddEnemyPatrolNode("servant_brute_16", "PathNodeArea_15", 0, "");
	AddEnemyPatrolNode("servant_brute_19", "PathNodeArea_18", 0, "");
	AddEnemyPatrolNode("servant_brute_17", "PathNodeArea_17", 0, "");
	AddEnemyPatrolNode("servant_brute_22", "PathNodeArea_22", 0, "");
	AddEnemyPatrolNode("servant_brute_18", "PathNodeArea_20", 0, "");
	AddEnemyPatrolNode("servant_brute_20", "PathNodeArea_19", 0, "");
	AddEnemyPatrolNode("servant_brute_21", "PathNodeArea_21", 0, "");
}
void MapFunc(string &in asName, int alCount) 
{
	StopMusic(2.0f, 10);
	ChangeMap("SecondFloor.map", "FromDream", "", "");
}
void OnEnter()
{
}
void OnLeave()
{
	
	SetInventoryDisabled(false);
	FadeImageTrailTo(0, 2);
	StopPlayerLookAt();
	SetPlayerMoveSpeedMul(1.0f);
	SetPlayerRunSpeedMul(1.0f);
	SetPlayerLookSpeedMul(1.0f);
	SetLanternDisabled(false);
}