Frictional Games Forum (read-only)
Remove Timer Problem - 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: Remove Timer Problem (/thread-23920.html)



Remove Timer Problem - RaideX - 11-21-2013

So basically i want to not go through certain parts of the script when the debug menu is turned on. My script looks like this:

PHP Code:
void OnStart(){
    
    
AddTimer ("MainInit", 0.1f, "MainStart");
    
AddDebugMessage ("START", true);
    
    
//Script Debug Setup
    
if(ScriptDebugOn()){
        
GiveItemFromFile("lantern_pig", "lantern_pig.ent");
        
RemoveTimer("MainStart");
        
AddDebugMessage ("Debug Activated!", true);
    }
    
    
//Collide Callbacks
    
AddEntityCollideCallback("Player", "HatchOpen", "HatchUnlock", true, 1);
}

void MainStart (string &in asTimer) {
        
FadeOut(0.1f);
        
AddTimer ("GameInit", 10.0f, "GameStart");
        
PlayGuiSound ("intro_pig_attack_temp.snt", 1.0f);
    
}

void HatchUnlock (string &in asParent, string &in asChild, int alState) {
        
SetSwingDoorClosed("attic_floor_ladderhatch_1", false, true);
        
AddDebugMessage("Hatch Unlocked!", true);
        
StartPlayerLookAt ("attic_floor_ladderhatch_1", 10.0f, 50.0f, "LookAtStop");
        
PlaySoundAtEntity ("HatchScare", "react_scare.snt", "Player", 0.15f, false);
        
StopSound ("Ambience01", 0.0f);
}

void LookAtStop () {
        
StopPlayerLookAt();
}

void GameStart (string &in asTimer) {
        
PlaySoundAtEntity ("IntroScare", "react_breath.snt", "Player", 0.1f, false);
        
StartEffectFlash(0.1f, 1.0f, 0.2f);
        
FadeIn (0.1f);
        
AddTimer ("PianoInit", 2.0f, "PianoStart");
}

void PianoStart (string &in asTimer) {
        
PlaySoundAtEntity ("Ambience01", "amb_mansion_gallery_piano_2D.snt", "attic_floor_ladderhatch_1", 1.0f, true);
} 

The important part is right at the start.
Maybe the game can't catch up (add and remove timers that fast) with that or i made a misstake that i can't find. Thanks in advance! :3

_________________

Welp i'm an idiot.