(07-30-2012, 10:17 PM)ZereboO Wrote: Since you have done this before, i guess that i can just post this example, in belive, that you will work out from it
void OnStart();
{
SetPlayerActive(false);
FadeOut(0);
FadePlayerRollTo(65, 20, 20);
MovePlayerHeadPos(-1, -0.45, -1.1, 20, 1);
AddTimer("activate_player", 3, "FadeIn");
SetLightVisible("BoxLight_1", false);
FadeImageTrailTo(3, 1);
FadeRadialBlurTo(0.4, 1);
}
void FadeIn(string &in timer_name)
{
FadeIn(2);
AddTimer("Start", 2, "WakeUp");
}
void WakeUp(string &in timer_name)
{
if (timer_name == "Start")
{
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);
}
}
PS. This example runs with two PlayerStartPositions
Yes, but where am I supposed to put this script?
This is my script as it is
void OnStart(){SetEntityPlayerInteractCallback("TouchArea_1", "Grunt_Gone", true);AddEntityCollideCallback("Player", "Door_Close", "CloseDoor", true, 1);AddEntityCollideCallback("Player", "Walk", "WalkArea", true, 1);AddEntityCollideCallback("Player", "ScriptArea_1", "bedtime", true, 1);SetPlayerActive(false);FadeOut(0);FadePlayerRollTo(65, 20, 20);MovePlayerHeadPos(-1, -0.45, -1.1, 20, 1);AddTimer("activate_player", 3, "FadeIn");FadeImageTrailTo(3, 1);FadeRadialBlurTo(0.4, 1);}
void WalkArea(string &in asParent, string &in asChild, int alState){MovePlayerForward(50.0f);AddTimer("walktime", 0.1f, "timerdone");PlaySoundAtEntity("", "react_sigh.snt", "Player", 0, false);SetPlayerActive(false);}
void timerdone(string &in asTimer){AddTimer("restarter", 0, "atwalkto");}
void CloseDoor(string &in asParent, string &in asChild, int alState){SetSwingDoorClosed("mansion_1", true, true);}
void bedtime(string &in asParent, string &in asChild, int alState){FadeOut(1.2f);StartPlayerLookAt("bed_nice_1", 1.0f, 1.0f, "");AddTimer("WakeUp", 5.0f, "itstime");}
void itstime(string &in asTimer){RemoveTimer("WakeUp");TeleportPlayer("PlayerStartArea_2");StopPlayerLookAt();}void FadeIn(string &in timer_name){FadeIn(2);AddTimer("Start", 2, "WakeUp"); }
void WakeUp(string &in timer_name){if (timer_name == "Start"){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);}}
I want the player to be moved to the bed and when you get close to it you fall asleep and wake up in that state, how am I supposed to set it up then?
Please respond
void OnStart()
{
SetEntityPlayerInteractCallback("TouchArea_1", "Grunt_Gone", true);
AddEntityCollideCallback("Player", "Door_Close", "CloseDoor", true, 1);
AddEntityCollideCallback("Player", "Walk", "WalkArea", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_1", "bedtime", true, 1);
SetPlayerActive(false);
FadeOut(0);
FadePlayerRollTo(65, 20, 20);
MovePlayerHeadPos(-1, -0.45, -1.1, 20, 1);
AddTimer("activate_player", 3, "FadeIn");
FadeImageTrailTo(3, 1);
FadeRadialBlurTo(0.4, 1);
}
void WalkArea(string &in asParent, string &in asChild, int alState)
{
MovePlayerForward(50.0f);
AddTimer("walktime", 0.1f, "timerdone");
PlaySoundAtEntity("", "react_sigh.snt", "Player", 0, false);
SetPlayerActive(false);
}
void timerdone(string &in asTimer)
{
AddTimer("restarter", 0, "atwalkto");
}
void CloseDoor(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_1", true, true);
}
void bedtime(string &in asParent, string &in asChild, int alState)
{
FadeOut(1.2f);
StartPlayerLookAt("bed_nice_1", 1.0f, 1.0f, "");
AddTimer("WakeUp", 5.0f, "itstime");
}
void itstime(string &in asTimer)
{
RemoveTimer("WakeUp");
TeleportPlayer("PlayerStartArea_2");
StopPlayerLookAt();
}
void FadeIn(string &in timer_name)
{
FadeIn(2);
AddTimer("Start", 2, "WakeUp");
}
void WakeUp(string &in timer_name)
{
if (timer_name == "Start")
{
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);
}
}