void OnStart()
{
AddTimer("timer_wakeup", 30.0f, "timer_wakeup");
AddTimer("timer_enddream", 25.0f, "timer_enddream");
StartPlayerLookAt("area_entitylook", 1.0f, 2.0f, "");
SetPlayerMoveSpeedMul(0.5f);
SetPlayerRunSpeedMul(0.5f);
PlayMusic("lucid_dream", false, 1, 0, 1, false);
SetGlobalVarInt("NightTriggered", 0);
}
void Intro()
{
}
void OnEnter()
{
}
////////////////////////////////////
//////////////SCRIPTS///////////////
////////////////////////////////////
void script_standup(string &in asParent, string &in asChild, int alState)
{
SetLocalVarInt("var_walking", 1);
SetPlayerCrouching(false);
AddTimer("timer_setplayeractive", 0.5f, "timer_setplayeractive");
}
////////////////////////////////////
///////////////TIMERS///////////////
////////////////////////////////////
void timer_setplayeractive(string &in asTimer)
{
SetPlayerActive(true);
StopPlayerLookAt();
FadeImageTrailTo(0.5f, 0.4f);
FadeRadialBlurTo(0.0f, 0.02f);
}
void timer_enddream(string &in asTimer)
{
FadeOut(1.0f);
StopPlayerLookAt();
SetPlayerActive(false);
SetPlayerMoveSpeedMul(1.0f);
SetPlayerRunSpeedMul(1.0f);
PlayMusic("lucid_phone_1", false, 1, 0, 2, false);
StopMusic(0,1);
}
void timer_wakeup(string &in asTimer)
{
AddTimer("timer_phone2", 20.0f, "timer_phone2"); //start next phone message
AddLocalVarInt("var_wakup", 1);
float SectionSpeed = 0.0f; //define SectionSpeed
switch (GetLocalVarInt("var_wakeup"))
{
case 1: //Teleporting player and setting up sequence
TeleportPlayer("PlayerStartArea_2"); //Moves player from castle to bed
SetPlayerCrouching(true); //places the player on the bed sheeds
AddEntityCollideCallback("Player", "area_standup", "script_standup", true, 1); //makes player stand up
MovePlayerHeadPos(0.8f, -0.8f, 0.0f, 20.0f, 1.0f); //player's head is on the bed
FadePlayerRollTo(-90.0f, 150.0f, 200.0f); //player is looking at ceiling
SectionSpeed = 4.0f;
break;
case 2: //I don't remember why I needed this since the same thing is in the last case, but I'm leaving it in to be safe
FadePlayerRollTo(-90.0f, 1.0f, 1.0f);
SectionSpeed = 0.5f;
break;
case 3: //fade in, blurry eyes
FadeIn(1.3f);
StartScreenShake(0.02f ,0.0f, 0.3f, 1.0f);
FadeRadialBlurTo(0.03f, 1.5f);
FadePlayerFOVMulTo(1.3f, 1.7f);
SectionSpeed = 1.5f;
break;
case 4: //fade out again
FadeOut(2.3f);
FadeRadialBlurTo(0.01f, 0.01f);
SectionSpeed = 2.75f;
break;
case 5: //fade in, still blurry
FadeIn(2.5f);
FadeRadialBlurTo(0.03f, 0.02f);
FadePlayerFOVMulTo(0.75f, 0.2f);
SectionSpeed = 2.75f;
break;
case 6: //blinking - kind of
FadeOut(2.0f);
FadeRadialBlurTo(0.01f, 0.01f);
SectionSpeed = 2.5f;
break;
case 7: //opening eyes, a little blurry still
FadeIn(2.0f);
FadeRadialBlurTo(0.03f, 0.03f);
SectionSpeed = 2.5f;
break;
case 8: //Roll over and sit
FadePlayerFOVMulTo(1.0f, 3.4f);
MovePlayerHeadPos(0.0f, 0.0f, 0.0f, 0.4f, 0.1f);
FadePlayerRollTo(0, 5.0f, 23.0f);
StartPlayerLookAt("area_look1", 2.0f, 4.0f, ""); //Floor
FadeRadialBlurTo(0.01f, 0.01f);
PlaySoundAtEntity("sound_rustle", "player_climb.snt", "Player", 0.0f, false);
SectionSpeed = 3.25f;
break;
case 9: //stand up
MovePlayerForward(0.075f);
AddTimer("timer_standup", 0.5f, "timer_standup");
PlaySoundAtEntity("sound_standing", "player_stand.snt", "Player", 0.0f, false);
StartPlayerLookAt("area_look2", 1.25f, 3.75f, ""); //Wall
AddTimer("timer_setplayeractive", 0.25, "timer_setplayeractive");
SectionSpeed = 0.0f;
break;
}
if (GetLocalVarInt("var_wakeup") <9)
{
AddTimer("timer_wakeup", SectionSpeed, "timer_wakeup");
}
}
void timer_standup(string &in asTimer) //causes player to take a step
{
MovePlayerForward(0.075f);
}
void timer_phone2(string &in asTimer)
{
StopMusic(0,2);
PlayMusic("lucid_phone_2", false, 1, 0, 3, false);
AddTimer("timer_phone3", 23.0f, "timer_phone3");
}
void timer_phone3(string &in asTimer)
{
StopMusic(0,3);
PlayMusic("lucid_phone_3", false, 1, 0, 4, false);
}
void timer_stoplook(string &in asTimer)
{
StopPlayerLookAt();
}