RE: Script Help
It took some time, but this script makes it look like when you go near the bed and collide with an area, the player will fall as sleep and wakes up again several second later.
I now have 3 PlayerStartPositions.
And a area close to the bed, to call all the action.
PlayerStaartPosition_3 as you can be set a random place, so that the player dosen't spawn in the bed, and then make him go to area besides the bed.
In OnStart(); you put this
AddEntityCollideCallback("Player", "SleepArea", "Sleeping", true,1);
And timers will take care of the rest.
The final sricpt looks like this:
void OnStart();
{
AddEntityCollideCallback("Player", "SleepArea", "Sleeping", true,1);
}
void Sleeping(string &in asParent, string &in asChild, int alState)
{
FadePlayerFOVMulTo(1.5, 1);
FadeOut(2);
SetPlayerActive(false);
AddTimer("sleep", 4, "MoveToBed");
SetLightVisible("BoxLight_1", false);
}
void MoveToBed(string &in timer_name)
{
TeleportPlayer("PlayerStartArea_1");
FadePlayerRollTo(65, 20, 20);
MovePlayerHeadPos(-1, -0.45, -1.1, 20, 1);
FadeImageTrailTo(3, 1);
FadeRadialBlurTo(0.4, 1);
AddTimer("sleep2", 2, "teleport");
}
void teleport(string &in timer_name)
{
AddTimer("wakingup", 2, "FadeIn");
}
void FadeIn(string &in timer_name)
{
FadeIn(2);
AddTimer("Start", 2, "WakeUp");
}
void WakeUp(string &in timer_name)
{
if (timer_name == "Start")
{
TeleportPlayer("PlayerStartArea_1");
SetLightVisible("BoxLight_1", true);
AddTimer("MoveHead", 1, "WakeUp");
}
else if (timer_name == "MoveHead")
{
FadeImageTrailTo(0, 1);
FadeRadialBlurTo(0, 1);
MovePlayerHeadPos(-0.5, -0.2, -1.1, 2, 2);
FadePlayerRollTo(0, 1.7, 500);
AddTimer("ActivatePlayer", 2, "WakeUp");
}
else if (timer_name == "ActivatePlayer")
{
MovePlayerHeadPos(0, 0, 0, 2, 2);
SetPlayerActive(true);
}
}
CURRENT PROJECT:
A Fathers Secret == Just started
|