Frictional Games Forum (read-only)

Full Version: Amnesia stopped working when loading map
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey guys, I'm working on a custom story, and added an effect where the player is simulated as being dragged. You are dragged through three maps, and i use "ChangeMap" to transfer the player to the next map. The first map is working fine, and so is the second. But when the third map starts loading, I get the message "Amnesia.exe stopped working" (actually it says that on swedish, I just translated, so those might not be the exact words).
Well, since the third map actually starts loading (you can see the "loading" text), i figured that the problem is most likely located in the third map's .hps file. Usually I get an error message, but this crash gives me no hint what the problem might be. So maybe someone can help me find it?

Here's the LAST script entry from the second map, since everything else works fine in that map:

AddTimer("W11", 23.0f, "Action");



else if(asTimer == "W11")
{
ChangeMap("04_Dream_3.map", "PlayerStartArea_8", "", "");
}

(these are located in the right place, i just cut them out. I have the "void OnStart()" and "void Action" in my file.)

Here's the third maps whole .hps file:


void OnStart()
{
SetLanternDisabled(true);
SetPlayerActive(false);
ShowPlayerCrossHairIcons(false);
SetPlayerCrouching(true);
FadePlayerRollTo(50, 150, 150);
FadeRadialBlurTo(0.1, 0.4);
FadeImageTrailTo(2.0, 0.4);
FadeSepiaColorTo(100.0, 4.0);
PlaySoundAtEntity("", "react_pant.snt", "Player", 0, false);
PlaySoundAtEntity("one", "15_drag_body.snt", "Player", 0, false);

AddTimer("", 0.1, "Drag");
AddTimer("", 2, "DragSounds");

StartPlayerLookAt("LookAt_8", 1.0f, 1.0f, "");

AddTimer("W1", 2.0f, "Action");
AddTimer("W2", 4.0f, "Action");
AddTimer("W3", 6.0f, "Action");
AddTimer("W4", 10.0f, "Action");
AddTimer("W5", 12.0f, "Action");
AddTimer("W6", 14.0f, "Action");
AddTimer("W7", 15.0f, "Action");
AddTimer("W8", 16.0f, "Action");
AddTimer("W9", 18.0f, "Action");
AddTimer("W10", 20.0f, "Action");
AddTimer("W11", 26.0f, "Action");
AddTimer("W12", 27.5f, "Action");
}

void Drag(string &in asTimer)
{
AddPlayerBodyForce(3000, 0, 0, false);
AddTimer("drag", 0.1, "Drag");
}

void Drag2(string &in asTimer)
{
AddPlayerBodyForce(0, 0, -3000, false);
AddTimer("drag", 0.1, "Drag");
}

void DragSounds(string &in asTimer)
{
StopSound("one", 0);
PlaySoundAtEntity("one", "15_drag_body.snt", "Player", 0, false);
AddTimer("", 2, "DragSounds");
}

void Action(string &in asTimer)
{
if(asTimer == "W1")
{
PlaySoundAtEntity("", "player_cough.snt", "Player", 0, false);
}
else if(asTimer == "W2")
{
FadeOut(2);
}
else if(asTimer == "W3")
{
RemoveTimer("drag");
TeleportPlayer("PlayerStartArea_9");
AddTimer("", 0.1, "Drag2");
}
else if(asTimer == "W4")
{
FadeIn(1);
StartPlayerLookAt("LookAt_9", 1.0f, 1.0f, "");
PlaySoundAtEntity("", "player_cough.snt", "Player", 0, false);
}
else if(asTimer == "W5")
{

}
else if(asTimer == "W6")
{
FadeOut(0.5f);
StartPlayerLookAt("LookAt_6", 1.0f, 1.0f, "");
}
else if(asTimer == "W7")
{
FadeIn(0.5);
}
else if(asTimer == "W8")
{
PlaySoundAtEntity("", "player_cough.snt", "Player", 0, false);
}
else if(asTimer == "W9")
{
PlaySoundAtEntity("", "insanity whisper.snt", "Player", 0, false);
FadeOut(3.0f);
}
else if(asTimer == "W10")
{
TeleportPlayer("PlayerStartArea_10");
SetPlayerCrouching(false);
FadePlayerRollTo(0, 33, 33);
FadeRadialBlurTo(0.0, 1.0);
FadeSepiaColorTo(0.0, 25.0);
FadeImageTrailTo(0.0, 0.1);
StartPlayerLookAt("LookAt_10", 6.0f, 6.0f, "");
}
else if(asTimer == "W11")
{
SetLightVisible("lighty", true);
PlaySoundAtEntity("", "24_iron_maiden.snt", "scare4", 0.0f, false)
PlaySoundAtEntity("", "amb_alert.snt", "Player", 0, false);
StartScreenShake(0.1f, 0.1f, 0.0f, 0.1f);
GiveSanityDamage(10.0f, true);
}
else if(asTimer == "W12")
{
FadeOut(0);
}
}

void OnEnter()
{

}

void OnLeave()
{

}

These commands have been called in all three maps, located under "void OnStart()". Is that wrong?:



SetLanternDisabled(true);
SetPlayerActive(false);
ShowPlayerCrossHairIcons(false);
SetPlayerCrouching(true);
FadePlayerRollTo(50, 150, 150);
FadeRadialBlurTo(0.1, 0.4);
FadeImageTrailTo(2.0, 0.4);
FadeSepiaColorTo(100.0, 4.0);

Thank you for your help.
If you get Geany you can easly detect errors Wink
It's rare for a script to crash the game without displaying the AngelScript output. I don't see any infinite loops in your script or any functions being called that could crash the game. Check the hpl.log in Documents/Amnesia/Main for any insight.
(07-07-2012, 04:57 PM)Your Computer Wrote: [ -> ]It's rare for a script to crash the game without displaying the AngelScript output. I don't see any infinite loops in your script or any functions being called that could crash the game. Check the hpl.log in Documents/Amnesia/Main for any insight.
I found the problem. I forgot a semicolon (Wink after a script. But thank you anyway Smile