Frictional Games Forum (read-only)
Need help with script - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Need help with script (/thread-6603.html)



Need help with script - Zuror - 02-15-2011

when you pick up the lantern a monster is supposed to spawn and a door is supposed to bang but there is some problem with the script.

Code:
void Interact_Lantern(string &in asEntity, string &in asType)
{
    SetEntityActive("servant_grunt_1" , true);
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0.0f, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0.0f, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0.0f, "");
    PlaySoundAtEntity("snd_monst", "amb_alert.snt", "servant_grunt_1", 0, false);

    
    PlaySoundAtEntity("bangs", "05_event_door_bang", "mansion_16", 1, false);
    PlaySoundAtEntity("whineaa", "scare_whine_loop", "Player", 0.5f, false);

    StartPlayerLookAt("mansion_16", 6, 40, "");
    StartPlayerLookAt("servant_grunt_1", 6, 40, "");
    StartPlayerLookAt("mansion_16", 6, 40, "");
        
    FadeSepiaColorTo(0.75f, 0.3f);
    FadeImageTrailTo(1.5, 0.5);
    
    AddTimer("bang1", 0.6f, "TimerBangDoor");
    AddTimer("bang2", 1.6f, "TimerBangDoor");
    AddTimer("bang3", 2.5f, "TimerBangDoor");
    AddTimer("bang4", 3.0f, "TimerBangDoor");
}
void TimerBangDoor(string &in asTimer)
{    
    if(asTimer == "bang1"){
        AddPropImpulse("mansion_16", 0, 0, 5, "World");
        PlaySoundAtEntity("scare", "react_scare", "Player", 0.25f, false);
        CreateParticleSystemAtEntity("bang1", "ps_dust_impact_vert.ps", "mansion_16", false);
        StartScreenShake(0.008, 0.5f, 0.1f,0.3f);
        GiveSanityDamage(10, true);
    }
    else if(asTimer == "bang2") {
        AddPropImpulse("mansion_16", 0, 0, 5, "World");
        CreateParticleSystemAtEntity("bang1", "ps_dust_impact_vert.ps", "mansion_16", false);
        StartScreenShake(0.008, 0.5f, 0.1f,0.3f);
    }
    else if(asTimer == "bang3") {
        AddPropImpulse("mansion_16", 0, 0, 5, "World");
        PlaySoundAtEntity("scare", "react_breath", "Player", 0.5f, false);
        CreateParticleSystemAtEntity("bang1", "ps_dust_impact_vert.ps", "mansion_16", false);
        StartScreenShake(0.008, 0.5f, 0.1f,0.3f);
    }
    else {
        SetSwingDoorLocked("mansion_16", false, false);
        FadeSepiaColorTo(0, 0.3f);
        FadeImageTrailTo(0, 0.1);
        StopSound("whineaa", 4);
        AddTimer("timerRes", 5.0f, "TimerResetPlayer");
    }
}