Frictional Games Forum (read-only)
Frustrating scripting - 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: Frustrating scripting (/thread-14140.html)



Frustrating scripting - 7thProductions - 03-21-2012

this is the current script I have for my map...but every time I try to launch it I keep getting errors...can someone please tell me what the problem is... :/

////////////////////////////
// Run first time starting map
void OnStart()
{
SetPlayerCrouching(true);
SetPlayerActive(false);
ShowPlayerCrossHairIcons(false);
GiveSanityDamage(100.0, false);
SetSanityDrainDisabled(true);
FadeOut(0);
FadeIn(3);
AddTimer("T1", 3, "Intro");
AddTimer("T2", 6, "Intro");
AddTimer("T3", 8, "Intro");
AddTimer("T4", 10, "Intro");
AddTimer("T5", 12, "Intro");
}
void Intro(string &in asTimer)
{
string x = asTimer;
if (x == "T1")
{
PlaySoundAtEntity("", "react_sigh.snt", "Player", 0, false);
AddEntityCollideCallback("Player", "violetedwards_message1", "violetedwardsmessage1", true, 1);
FadeOut(3);

}



violetedwardsmessage1(string &in asChild, string &in asParent, int alState)
{
SetMessage("Messages", "violetedwards_message1", 0);
}

{
else if (x == "T2")
}
{
FadeIn(3);
PlaySoundAtEntity("", "react_breath.snt", "Player", 0, false);
StartPlayerLookAt("ScriptArea_1", 2, 2, "");
}
else if (x == "T3")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_2", 2, 2, "");
}
else if (x == "T4")
{
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
StopPlayerLookAt();
}
else if (x == "T5")
{
SetPlayerCrouching(false);
SetPlayerActive(true);
ShowPlayerCrossHairIcons(true);
SetPlayerMoveSpeedMul(0.3);
SetPlayerJumpDisabled(true);
SetPlayerCrouchDisabled(true);
SetPlayerRunSpeedMul(0.0);
}
}
////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}




RE: Frustrating scripting - Strembitsky - 03-21-2012

It always helps to know what your error says.


RE: Frustrating scripting - MrErkky - 03-21-2012

Quote:void OnStart()
{
SetPlayerCrouching(true);
SetPlayerActive(false);
ShowPlayerCrossHairIcons(false);
GiveSanityDamage(100.0, false);
SetSanityDrainDisabled(true);
FadeOut(0);
FadeIn(3);
AddTimer("T1", 3, "Intro");
AddTimer("T2", 6, "Intro");
AddTimer("T3", 8, "Intro");
AddTimer("T4", 10, "Intro");
AddTimer("T5", 12, "Intro");
}
void Intro(string &in asTimer)
{
string x = asTimer;
if (x == "T1")
{
PlaySoundAtEntity("", "react_sigh.snt", "Player", 0, false);
AddEntityCollideCallback("Player", "violetedwards_message1", "violetedwardsmessage1", true, 1);
FadeOut(3);
}
else if (x == "T2")
{
FadeIn(3);
PlaySoundAtEntity("", "react_breath.snt", "Player", 0, false);
StartPlayerLookAt("ScriptArea_1", 2, 2, "");
}
else if (x == "T3")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_2", 2, 2, "");
}
else if (x == "T4")
{
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
StopPlayerLookAt();
}
else if (x == "T5")
{
SetPlayerCrouching(false);
SetPlayerActive(true);
ShowPlayerCrossHairIcons(true);
SetPlayerMoveSpeedMul(0.3);
SetPlayerJumpDisabled(true);
SetPlayerCrouchDisabled(true);
SetPlayerRunSpeedMul(0.0);
}
} // I have moved this syntax and put a void in front off it
void violetedwardsmessage1(string &in asChild, string &in asParent, int alState)
{
SetMessage("Messages", "violetedwards_message1", 0);
}
////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}
From what I can see (without any further information), the line under the green text is the one that caused the problem (I have correct it in this one). There might be something I'd missed but I think this script will work. (Of course you need to have the right name for the area in AddEntityCollideCalllback and your extra_english.lang file needs to be correct)