Frictional Games Forum (read-only)
[Solved]Case Timer only works when opening the level by itself - 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: [Solved]Case Timer only works when opening the level by itself (/thread-29915.html)



[Solved]Case Timer only works when opening the level by itself - Radical Batz - 05-11-2015

I have this casetimer that will start running by an addtimer from a function which looks something like this

PHP Code:
void lockdoor(string &in asParentstring &in asChildint alState)
{
    
StartScreenShake(0.01f0.5f0.5f1.0f);
    
SetEntityActive("lockdoor"false);
    
PlayGuiSound("scare_slam_door.snt"0.7f);
    
AddPropForce("cellar_wood01_4"00, -50000"world");
    
AddTimer(""0.4"lockit");
}

void lockit(string &in asTimer)
{
    
float fEventSpeed=0;
    
AddLocalVarInt("TimerEvent"1);
    switch(
GetLocalVarInt("TimerEvent"))
    {
        
        case 
1:
                
SetSwingDoorLocked("cellar_wood01_4"truefalse);
                
PlayGuiSound("lock_door"1.6);
                
SetEntityActive("male_arm_1"false);
                
fEventSpeed 3.0f;
                break;
        
        case 
2:
                
PlayGuiSound("amb_hunt04.ogg"1.6);
                
PlayMusic("att_grunt"true151true);
                
SetPlayerRunSpeedMul(0.5f);
                
SetPlayerMoveSpeedMul(0.5f);
                
fEventSpeed 2.0f;
                break;
        
        case 
3:
                
StartScreenShake(0.1f0.5f0.1f,0.3f);
                
AddPropImpulse("cellar_wood01_4"00, -10"World");
            
PlaySoundAtEntity("""21_bang_door""cellar_wood01_4"0.25ffalse);
            
CreateParticleSystemAtEntity("bang1""ps_dust_impact_vert.ps""cellar_wood01_4"false);
                
fEventSpeed 3.0f;
                break;
        
        case 
4:
                
StartScreenShake(0.1f0.5f0.1f,0.3f);
                
AddPropImpulse("cellar_wood01_4"00, -10"World");
            
PlaySoundAtEntity("""21_bang_door""cellar_wood01_4"0.25ffalse);
            
CreateParticleSystemAtEntity("bang1""ps_dust_impact_vert.ps""cellar_wood01_4"false);
                
fEventSpeed 0.6f;
                break;
        
        case 
5:
                
AddEffectVoice("voices""Ch01L09.ogg""Voice""HolyGesus",
                
false"EventDoor"11);
                
SetEntityActive("corpse_male_arm_1"true);
                
StartPlayerLookAt("corpse_male_arm_1"104"");
                
fEventSpeed 1.0f;
                break;
        
        case 
6:
                
AddEffectVoice("voices""Ch01L08.ogg""Voice""HolyGesus",
                
false"EventDoor"11);
                
StopPlayerLookAt();
                
fEventSpeed 2.0f;
                break;
        
        case 
7:
                
PlayGuiSound("react_breath"0.7f);
                
fEventSpeed 2.0f;
                break;
            }
        
        if(
GetLocalVarInt("TimerEvent") <7AddTimer("TimerEvent",fEventSpeed"lockit");


The problem is as I said, the case timer doesnt work when entering this level from another level from a lever door.
it only starts working when loading this level from start or by the debug menu. Again, the lockdoor function works when colliding with an area but the case timer doesn't want to, doesnt function when entering this level from another level

Any ideas pls? I have no idea what the hell is causing this and never happened to me before Huh

Nevermind guys, it has been fixed by DnAlange!
It was such an easy fix lol yet so frustrating xD


RE: Case Timer only works when opening the level by itself - DnALANGE - 05-11-2015

Wink
We are all here to help BadCat, you are a bit more Lucky you have some guys of us on Skype, so things will get fixed quicker.
Good luck with the story!