Frictional Games Forum (read-only)
FATAL ERROR: Could not load script file. - 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: FATAL ERROR: Could not load script file. (/thread-24407.html)



FATAL ERROR: Could not load script file. - Zebahan - 01-19-2014

Hi! I've been working on a custom story for quite some time now.
Most problems that I've ran into I've been able to solve myself, however this one is a bit trickier.


The scenario is a timed event where the enemies are breaking down a door, and you must hide before they get you. 
The way I do this is I add a series of timers, with four seconds intervals inbetween. Each timer triggers a sound and a particle effect, as well as calling the next timer. Once the final timer is reached the door is broken down and the enemies are spawned on the other side. 
Simple enough, but to add more suspense I'd like to interrupt all the timers and break down the door instantaneously once your reach a safe place, creating the illusion of danger. This using trigger areas.


Once you reach a final destination all the monsters are supposed to despawn, which they do.


However this is where I ran into a bit of a problem since when I call for all the timers to be interrupted, none of it happens. It should be noted that when you reach the first area a function is called that is identical to the final timer.
Eventually I end up with having the enemies respawn if the player manages to reach the safe place before the intended time.


Any ideas? Here's the script:


Code:
void OnStart()


{





}





void OnEnter()


{





PlayMusic("/custom_mod/music/grandbedroom.ogg", false, 1, 3, 1, false);





AddUseItemCallback("", "key_grandbedroom", "bedroom_door", "Key1", true);


AddUseItemCallback("", "key_2", "bedroom_door", "Key2", false);


AddUseItemCallback("", "key_3", "bedroom_door", "Key3", false);


AddUseItemCallback("", "key_study1", "study_door1", "Key4", false);





AddUseItemCallback("", "hammer1", "padlock1", "BreakLock", false);


AddUseItemCallback("", "hammer1", "padlock2", "BreakLock2", false);


AddUseItemCallback("", "hammer1", "padlock3", "BreakLock3", false);





SetEntityPlayerInteractCallback("note_half2", "ReadNote", true);





SetEntityActive("big_box1", true);


SetEntityActive("big_box2", false);


SetEntityActive("big_box3", false);


SetEntityActive("big_box_fall", false);


SetEntityActive("box1", true);


SetEntityActive("box2", false);


SetEntityActive("hook1", true);


SetEntityActive("hook2", true);


SetEntityActive("lever1", true);





SetEntityInteractionDisabled("lantern_1", true);


SetEntityInteractionDisabled("lantern_2", true);


SetEntityInteractionDisabled("lantern_4", true);


SetEntityInteractionDisabled("lantern_5", true);


SetEntityInteractionDisabled("lantern_6", true);


SetEntityInteractionDisabled("lantern_7", true);





AddEntityCollideCallback("box1", "boxarea1", "BoxAreaLeave", false, -1);


AddEntityCollideCallback("box1", "boxarea1", "BoxAreaEnter", false, 1);


AddEntityCollideCallback("Player", "look1", "AreaLook", true, 1);


AddEntityCollideCallback("Player", "helmet_area", "AreaHelmet1", false, 1);


AddEntityCollideCallback("Player", "helmet_area2", "AreaHelmet3", true, 1);


AddEntityCollideCallback("big_box_fall", "sound_break1", "SoundBreak", true, 1);


AddEntityCollideCallback("Player", "CrouchArea1", "PlayerCrouch", false, 1);


AddEntityCollideCallback("Player", "CrouchArea2", "PlayerCrouch", false, 1);


AddEntityCollideCallback("Player", "CrouchArea3", "PlayerCrouch", false, 1);








AddEntityCollideCallback("Player", "trigger_area1", "TriggerArea", true, 1);


}





void OnLeave()


{





}





void Loading(string &in asParent, string &in asChild, int alState) 


{


SetupLoadScreen("LoadingScreen", "loadinggbedroom_2", 0, "");


}








void PlayerCrouch(string &in asParent, string &in asChild, int alState) 


{


SetEntityActive("lever1", false);


}








void BoxAreaLeave(string &in asParent, string &in asChild, int alState) 


{


SetEntityActive("lever1", false);


SetEntityActive("lever2", true);


}





void BoxAreaEnter(string &in asParent, string &in asChild, int alState) 


{


SetEntityActive("lever1", true);


SetEntityActive("lever2", false);


}





void TriggerArea(string &in asParent, string &in asChild, int alState) 


{


PlaySoundAtEntity("", "/custom_mod/sounds/event_study.snt", "Dust_1", 0, false);


AddTimer("", 70, "TimerEvent");


AddTimer("", 55, "TimerMusic");


StopMusic(5, 1);


SetEntityInteractionDisabled("door1", true);


}





void AreaLook(string &in asParent, string &in asChild, int alState) 


{


StartPlayerLookAt("grunt_3", 2, 2, "");


AddTimer("", 4, "SayGo");


AddTimer("", 3, "TimerLight");


AddEnemyPatrolNode("grunt_3", "Path1", 0.1, "");


AddEnemyPatrolNode("grunt_3", "Path2", 0.5, "");


AddEnemyPatrolNode("grunt_3", "Path3", 10, "");


SetEntityActive("hook1", false);


SetEntityActive("hook2", false);


SetSwingDoorLocked("hatch_metal01_1", true, false);


}





void SayGo(string &in asTimer)


{


PlaySoundAtEntity("", "/custom_mod/sounds/go.snt", "sound1", 0, false);


AddTimer("", 2, "TimerFall");


}





void TimerLight(string &in asTimer)


{


PlaySoundAtEntity("", "ui_lantern_on.snt", "sound1", 0, false);


FadeLightTo("light", 1, 0.9, 0.5, 1, 2, 0.5);


}





void TimerMusic(string &in asTimer)


{


PlaySoundAtEntity("", "white_yelling.snt", "Dust_1", 0, false);


PlayMusic("/custom_mod/music/run2.ogg", false, 2, 0, 2, false);


}





void SoundBreak(string &in asParent, string &in asChild, int alState) 


{


PlayGuiSound("/custom_mod/sounds/door_break1.snt", 2);


PlayGuiSound("/custom_mod/sounds/door_break2.snt", 2);


PlayGuiSound("enemy_hallucination_disappear.ogg", 2);


StopMusic(0, 2);


PlayMusic("/custom_mod/music/aftermath.ogg", false, 2, 1, 3, false);


SetEntityActive("grunt", false);


SetEntityActive("grunt_1", false);


SetEntityActive("grunt_2", false);


SetEntityActive("grunt_3", false);


StopPlayerLookAt();


StopMusic(0, 2);


}





void TimerFall(string &in asTimer)


{


PlayGuiSound("/custom_mod/sounds/chain_box.ogg", 2);


SetEntityActive("big_box_fall", true);


SetEntityActive("big_box3", false);


SetEntityActive("pulley_1", false);


SetEntityActive("pulley_2", false);


StopPlayerLookAt();


}





void TimerEvent(string &in asTimer)


{


PlaySoundAtEntity("", "/custom_mod/sounds/door_break1.snt", "Dust_1", 0, false);


PlaySoundAtEntity("", "/custom_mod/sounds/door_break2.snt", "Dust_1", 0, false);


AddTimer("", 4, "TimerEvent_2");


}





void Key1(string &in asItem, string &in asEntity)


{


SetSwingDoorLocked("bedroom_door", false, true);


PlayGuiSound("pick_key.ogg", 1);


PlayGuiSound("unlock_door.ogg", 1);


}





void Key2(string &in asItem, string &in asEntity)


{


PlayGuiSound("pick_key.ogg", 1);


}





void Key3(string &in asItem, string &in asEntity)


{


PlayGuiSound("pick_key.ogg", 1);


PlayGuiSound("impact_metal_low1.ogg", 1);


}





void Key4(string &in asItem, string &in asEntity)


{


SetSwingDoorLocked("study_door1", false, true);


PlayGuiSound("unlock_door.ogg", 1);


PlayGuiSound("pick_key.ogg", 1);


}





void ReadNote(string &in asEntity)


{


PlayMusic("17_paper_herbert02.ogg", false, 1, 3, 1, false);


AddEntityCollideCallback("Player", "loadingscreen1", "Loading", false, 1);


}





void Chain1(string &in asEntity, int LeverState)


{


        if(LeverState == -1) {





SetEntityActive("big_box1", false);


SetEntityActive("big_box2", true);


SetEntityActive("big_box3", false);


SetEntityActive("box1", false);


SetEntityActive("box2", true);


SetEntityActive("hook1", false);


SetEntityActive("hook2", false);


PlaySoundAtEntity("", "/custom_mod/sounds/elevate_fail1.snt", "SoundChain", 0, false);


        }


    if(LeverState == 1) {





SetEntityActive("big_box1", true);


SetEntityActive("big_box2", false);


SetEntityActive("big_box3", false);


SetEntityActive("box1", true);


SetEntityActive("box2", false);


SetEntityActive("hook1", true);


SetEntityActive("hook2", true);


PlaySoundAtEntity("", "/custom_mod/sounds/elevate_hook.snt", "SoundChain", 0, false);


        }


}





void Chain2(string &in asEntity, int LeverState)


{


    if(LeverState == -1) {





SetEntityActive("big_box1", false);


SetEntityActive("big_box2", false);


SetEntityActive("big_box3", true);


SetEntityActive("box1", true);


SetEntityActive("box2", false);


SetEntityActive("hook1", false);


SetEntityActive("hook2", false);





AddEntityCollideCallback("Player", "block_area1", "BlockArea1", true, 1);


AddEntityCollideCallback("Player", "block_area2", "BlockArea2", true, 1);





PlaySoundAtEntity("", "/custom_mod/sounds/elevate.snt", "SoundChain", 0, false);


        }


    if(LeverState == 1) {





SetEntityActive("big_box1", true);


SetEntityActive("big_box2", false);


SetEntityActive("big_box3", false);


SetEntityActive("box1", true);


SetEntityActive("box2", false);


SetEntityActive("hook1", true);


SetEntityActive("hook2", true);





PlaySoundAtEntity("", "/custom_mod/sounds/elevate_hook.snt", "SoundChain", 0, false);


        }


}





void BlockArea1(string &in asParent, string &in asChild, int alState) 


{


SetEntityActive("block1", true);


StopSound("/custom_mod/sounds/event_study.snt", 0);


SetEntityActive("grunt", true);


SetEntityActive("grunt_1", true);


SetEntityActive("grunt_2", true);


SetEntityActive("door1", false);


SetEntityActive("door1_effect", false);


PlaySoundAtEntity("", "/custom_mod/sounds/door_break1.snt", "Dust_1", 0, false);


PlaySoundAtEntity("", "/custom_mod/sounds/door_break2.snt", "Dust_1", 0, false);


RemoveTimer("TimerEvent_2");


RemoveTimer("TimerEvent_3");


RemoveTimer("TimerEvent_4");


RemoveTimer("TimerEvent_5");


RemoveTimer("TimerEvent_6");


RemoveTimer("TimerEvent_7");


RemoveTimer("TimerEvent_8");


RemoveTimer("TimerEvent_9");


RemoveTimer("TimerEvent_10");


RemoveTimer("TimerEvent_11");


RemoveTimer("TimerEvent_12");


RemoveTimer("TimerEvent_13");


RemoveTimer("TimerEvent_");


}





void BlockArea2(string &in asParent, string &in asChild, int alState) 


{


SetEntityActive("block2", true);


SetEnemyDisableTriggers("grunt_3", true);


SetEntityActive("grunt_3", true);


}





void BreakLock(string &in asItem, string &in asEntity)


{


SetEntityActive("padlock1", false);


SetEntityActive("padlock2", true);


    CreateParticleSystemAtEntity("", "ps_hit_metal.ps", "particlemetal", false);


PlaySoundAtEntity("", "impact_metal_high.snt", "particlemetal", 0, false);


}





void BreakLock2(string &in asItem, string &in asEntity)


{


SetEntityActive("padlock2", false);


SetEntityActive("padlock3", true);


    CreateParticleSystemAtEntity("", "ps_hit_metal.ps", "particlemetal", false);


PlaySoundAtEntity("", "impact_metal_high.snt", "particlemetal", 0, false);


}





void BreakLock3(string &in asItem, string &in asEntity)


{


SetEntityActive("padlock3", false);


SetEntityActive("padlock_broken", true);


SetSwingDoorLocked("obstacle_vent", false, true);


    CreateParticleSystemAtEntity("", "ps_hit_metal.ps", "particlemetal", false);


SetPropStaticPhysics("obstacle_vent", false);


AddEntityCollideCallback("obstacle_vent", "SoundHatch", "SoundHatch1", false, 1);


PlaySoundAtEntity("", "impact_metal_high.snt", "particlemetal", 0, false);


PlaySoundAtEntity("", "joint_hatch_max.snt", "particlemetal", 0, false);


}





void BreakLock1(string &in asParent, string &in asChild, int alState) 


{


PlaySoundAtEntity("", "impact_metal_high.snt", "particlemetal", 0, false);


PlaySoundAtEntity("", "impact_rock_high.snt", "particlemetal", 0, false);


}








void TimerEvent_2(string &in asTimer)


{


PlaySoundAtEntity("", "/custom_mod/sounds/door_break2.snt", "Dust_1", 0, false);


PlaySoundAtEntity("", "/custom_mod/sounds/door_break1.snt", "Dust_1", 0, false);


    CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "Dust_" + RandInt(1, 5), false);


    CreateParticleSystemAtEntity("", "ps_break_wood.ps", "Dust_" + RandInt(1, 5), false);


AddTimer("", 4, "TimerEvent_3");


}





void TimerEvent_3(string &in asTimer)


{


PlaySoundAtEntity("", "/custom_mod/sounds/door_break2.snt", "Dust_1", 0, false);


PlaySoundAtEntity("", "/custom_mod/sounds/door_break1.snt", "Dust_1", 0, false);


    CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "Dust_" + RandInt(1, 5), false);


CreateParticleSystemAtEntity("", "ps_break_wood.ps", "Dust_" + RandInt(1, 5), false);


AddTimer("", 4, "TimerEvent_4");


}





void TimerEvent_4(string &in asTimer)


{


PlaySoundAtEntity("", "/custom_mod/sounds/door_break2.snt", "Dust_1", 0, false);


PlaySoundAtEntity("", "/custom_mod/sounds/door_break1.snt", "Dust_1", 0, false);


    CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "Dust_" + RandInt(1, 5), false);


CreateParticleSystemAtEntity("", "ps_break_wood.ps", "Dust_" + RandInt(1, 5), false);


AddTimer("", 4, "TimerEvent_5");


}





void TimerEvent_5(string &in asTimer)


{


PlaySoundAtEntity("", "/custom_mod/sounds/door_break2.snt", "Dust_1", 0, false);


PlaySoundAtEntity("", "/custom_mod/sounds/door_break1.snt", "Dust_1", 0, false);


    CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "Dust_" + RandInt(1, 5), false);


CreateParticleSystemAtEntity("", "ps_break_wood.ps", "Dust_" + RandInt(1, 5), false);


AddTimer("", 4, "TimerEvent_6");


}





void TimerEvent_6(string &in asTimer)


{


PlaySoundAtEntity("", "/custom_mod/sounds/door_break2.snt", "Dust_1", 0, false);


PlaySoundAtEntity("", "/custom_mod/sounds/door_break1.snt", "Dust_1", 0, false);


    CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "Dust_" + RandInt(1, 5), false);


CreateParticleSystemAtEntity("", "ps_break_wood.ps", "Dust_" + RandInt(1, 5), false);


AddTimer("", 4, "TimerEvent_7");


}





void TimerEvent_7(string &in asTimer)


{


PlaySoundAtEntity("", "/custom_mod/sounds/door_break2.snt", "Dust_1", 0, false);


PlaySoundAtEntity("", "/custom_mod/sounds/door_break1.snt", "Dust_1", 0, false);


    CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "Dust_" + RandInt(1, 5), false);


CreateParticleSystemAtEntity("", "ps_break_wood.ps", "Dust_" + RandInt(1, 5), false);


AddTimer("", 4, "TimerEvent_8");


}





void TimerEvent_8(string &in asTimer)


{


PlaySoundAtEntity("", "/custom_mod/sounds/door_break2.snt", "Dust_1", 0, false);


PlaySoundAtEntity("", "/custom_mod/sounds/door_break1.snt", "Dust_1", 0, false);


    CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "Dust_" + RandInt(1, 5), false);


CreateParticleSystemAtEntity("", "ps_break_wood.ps", "Dust_" + RandInt(1, 5), false);


AddTimer("", 4, "TimerEvent_9");


}





void TimerEvent_9(string &in asTimer)


{


PlaySoundAtEntity("", "/custom_mod/sounds/door_break2.snt", "Dust_1", 0, false);


PlaySoundAtEntity("", "/custom_mod/sounds/door_break1.snt", "Dust_1", 0, false);


    CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "Dust_" + RandInt(1, 5), false);


CreateParticleSystemAtEntity("", "ps_break_wood.ps", "Dust_" + RandInt(1, 5), false);


AddTimer("", 4, "TimerEvent_10");


}





void TimerEvent_10(string &in asTimer)


{


PlaySoundAtEntity("", "/custom_mod/sounds/door_break2.snt", "Dust_1", 0, false);


PlaySoundAtEntity("", "/custom_mod/sounds/door_break1.snt", "Dust_1", 0, false);


    CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "Dust_" + RandInt(1, 5), false);


CreateParticleSystemAtEntity("", "ps_break_wood.ps", "Dust_" + RandInt(1, 5), false);


AddTimer("", 4, "TimerEvent_11");


}





void TimerEvent_11(string &in asTimer)


{


PlaySoundAtEntity("", "/custom_mod/sounds/door_break2.snt", "Dust_1", 0, false);


PlaySoundAtEntity("", "/custom_mod/sounds/door_break1.snt", "Dust_1", 0, false);


    CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "Dust_" + RandInt(1, 5), false);


CreateParticleSystemAtEntity("", "ps_break_wood.ps", "Dust_" + RandInt(1, 5), false);


AddTimer("", 4, "TimerEvent_12");


}





void TimerEvent_12(string &in asTimer)


{


PlaySoundAtEntity("", "/custom_mod/sounds/door_break2.snt", "Dust_1", 0, false);


PlaySoundAtEntity("", "/custom_mod/sounds/door_break1.snt", "Dust_1", 0, false);


    CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "Dust_" + RandInt(1, 5), false);


CreateParticleSystemAtEntity("", "ps_break_wood.ps", "Dust_" + RandInt(1, 5), false);


AddTimer("", 4, "TimerEvent_13");


}





void TimerEvent_13(string &in asTimer)


{


PlaySoundAtEntity("", "/custom_mod/sounds/door_break2.snt", "Dust_1", 0, false);


PlaySoundAtEntity("", "/custom_mod/sounds/door_break1.snt", "Dust_1", 0, false);


PlaySoundAtEntity("", "break_wood_metal.snt", "Dust_1", 0, false);


    CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "Dust_" + RandInt(1, 5), false);


CreateParticleSystemAtEntity("", "ps_break_wood.ps", "Dust_" + RandInt(1, 5), false);


SetEntityActive("grunt", true);


SetEntityActive("grunt_1", true);


SetEntityActive("grunt_2", true);


SetEntityActive("door1", false);


SetEntityActive("door1_effect", false);


ShowEnemyPlayerPosition("grunt");


ShowEnemyPlayerPosition("grunt_1");


ShowEnemyPlayerPosition("grunt_2");


}





void AreaHelmet1(string &in asParent, string &in asChild, int alState) 


{


SetEntityPlayerLookAtCallback("helmet_look", "AreaHelmet2", true);


}








void AreaHelmet2(string &in asEntity, int alState) 


{


SetEntityActive("helmet", true);


}





void AreaHelmet3(string &in asEntity, int alState) 


{


SetEntityActive("helmet2", false);


SetEntityActive("skull1", true);


}



RE: FATAL ERROR: Could not load script file. - DnALANGE - 01-19-2014

I dont get ant crashes.. the scipt loads fine.
Altho, why all those big empty spaces?
-
/custom_mod/music/grandbedroom.ogg <-- Does it even work like that?
You only have to do : grandbedroom.ogg <-- the game will find it.
-
We will need the map for this probly..
The scripts dont crash for me..
I'll look again, but i can;t remaked what you are doing offcourse.
What enemy's are you using?

Also, i dont understand now..
Could not load script file OR is the script just not working for you?


RE: FATAL ERROR: Could not load script file. - daortir - 01-19-2014

The RemoveTimer function is, according to your script, supposed to remove a timer called "TimerEvent_*"
And your timers are not named TimerEvent, TimerEvent is the function they call. Fill in the "" in your AddTimer functions, and then you will be able to use the remove timer function on your named timers.

Not sure if I made it clear x) 
Basically in AddTimer("name_of_the_timer", time until function is called, "name_of_the_function");
you have to add name_of_the_timer because this is how the RemoveTimer function will know which timer to stop, instead of searching for the function.