Script is broken
I tried doing a timer that would do a introduction of a guy fading in and out on the way to the castle. for some reason though the script starts of at the start and immediately teleports the player to the end leaving out the areas in between.
void OnStart()
{
FadeOut(0);
FadeIn(1);
SetPlayerMoveSpeedMul(0.25f);
SetPlayerRunSpeedMul(0);
AddTimer("S1", 6, "Start");
AddTimer("S2", 6, "Start");
AddTimer("S3", 6, "Start");
AddTimer("S4", 6, "Start");
AddTimer("S5", 6, "Start");
AddTimer("S6", 6, "Start");
AddTimer("S7", 6, "Start");
}
void Start(string &in asTimer)
{
string x = asTimer;
if (x == "S1")
{
StartPlayerLookAt("ScriptArea_1", 2, 2, "");
FadeOut(2);
}
else if (x == "S2")
{
FadeIn(1);
TeleportPlayer("PlayerStartArea_2");
FadeOut(2);
}
else if (x == "S3")
{
FadeIn(1);
TeleportPlayer("PlayerStartArea_3");
FadeOut(2);
}
else if (x == "S4")
{
StopPlayerLookAt();
TeleportPlayer("PlayerStartArea_4");
StartPlayerLookAt("ScriptArea_2", 2, 2, "");
FadeIn(1);
FadeOut(2);
}
else if (x == "S5")
{
FadeIn(1);
TeleportPlayer("PlayerStartArea_4");
StopPlayerLookAt();
}
else if( x == "S6")
{
StartPlayerLookAt("sewer_grate_rusty_1", 4, 4, "");
FadeOut(2);
}
else if (x == "S7")
{
PlaySoundAtEntity("", "joint_metal_gate.snt", "Player", 0, false);
}
}
What is wrong with the script. I may be blind or just plain stupid but I don't see a problem with it.
Thanks
|