Frictional Games Forum (read-only)
Script is broken - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Script is broken (/thread-16647.html)



Script is broken - Bierton - 07-01-2012

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


RE: Script is broken - Adny - 07-01-2012

I feel I should point out that all of your timers are set to go off at the exact same time (after 6 seconds). If you set them to go off at different times (increasing values from top to bottom) you should be fine.