Frictional Games Forum (read-only)

Full Version: How do you make cave in roar?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
In the laboratory part of the original amnesia, you go near this cave in with rocks and it starts making a moan sound and lots of dust comes out of it! Now I used this code from the original script of the lab into my script
Code:
void CollideScreamCave(string &in asParent, string &in asChild, int alState)
{
    PlaySoundAtEntity("monster_scream","04_scream.snt", "AreaCaveMonster", 0, false);
    
    StartScreenShake(0.02f, 2.0f, 0.5f, 2.0f);
    
    CreateParticleSystemAtEntity("breathps", "ps_cave_monster_scream.ps", "AreaCaveMonster", false);    
    
    AddTimer("scream1", 0.5f, "TimerCaveScream");
    AddTimer("scream2", 1.0f, "TimerCaveScream");
    AddTimer("scream3", 3.0f, "TimerCaveScream");
    AddTimer("scream4", 5.0f, "TimerCaveScream");
}
void TimerCaveScream(string &in asTimer)
{
    if(asTimer == "scream1"){
        PlayGuiSound("react_scare", 0.8f);
        GiveSanityDamage(10.0f, false);
        FadeSepiaColorTo(0.5f, 0.025f);
        FadeRadialBlurTo(0.1f, 0.025f);
        SetRadialBlurStartDist(0.2f);
    }
    else if(asTimer == "scream2"){
    
    }
    else if(asTimer == "scream3"){
        PlayGuiSound("react_creath", 0.8f);
        FadeSepiaColorTo(0, 0.1f);
        FadeRadialBlurTo(0, 0.1f);
    }
    else{
        PlayGuiSound("react_creath", 0.6f);
    }
}

and I made a script box called "Areascreamcave" just like the original but when I go play in my level, the script is not working? does anybody know why? oh and how do you make random sounds just like in the prison?
Post your map .hps file.
Code:
void OnStart()
{
    PlayMusic("12_amb.ogg", true, 1, 4, 1, true);
    AddTimer("AreaRock_", RandFloat(3.0f,10.f), "TimerAreaRock");
    GetPlayerHealth();
    FadePlayerFOVMulTo(1, 1.0f);
        SetPlayerMoveSpeedMul(1.0f);
        SetPlayerRunSpeedMul(1.0f);
    AddEntityCollideCallback("JumpscareDoor", "AreaJumpscare", "SanityDec", true, 1);
}

void PickUpOil(string &in asEntity, string &in type)
{
    AddQuest("Oil", "pickupoil");
    CompleteQuest("lantern", "pickuplantern");
}

void EventCollide(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("DungeonGrunt", true);
AddEnemyPatrolNode("DungeonGrunt", "Node_1",0.001f, "");
AddEnemyPatrolNode("DungeonGrunt", "Node_4",0.001f, "");
AddEnemyPatrolNode("DungeonGrunt", "Node_6",0.001f, "");
AddEnemyPatrolNode("DungeonGrunt", "Node_10",0.001f, "");
AddEnemyPatrolNode("DungeonGrunt", "Node_15",0.001f, "");
AddEnemyPatrolNode("DungeonGrunt", "Node_18",0.001f, "");
AddEnemyPatrolNode("DungeonGrunt", "Node_26",0.001f, "");
}

void SanityDec(string &in asParent, string &in asChild, int alState)
{
PlayGuiSound("react_scare3.ogg", 1);
SetEntityActive("DungeonGrunt", true);
GiveSanityDamage(15, true);
}

void TimerAreaRock(string &in asTimer)
{
    int iRand = RandInt(1, 6);

    PlaySoundAtEntity(asTimer+iRand, "24_rock.snt", asTimer+iRand, 1, false);

    StartScreenShake(0.007f, 0.0f, 4.0f, 2.0f);
    SetRadialBlurStartDist(0.8f);
    FadeRadialBlurTo(0.1f, 0.03f);

    AddTimer("EndRadial", 4.0f, "TimerEndRadial");
    AddTimer(asTimer, RandFloat(15.0f, 30.0f), "TimerAreaRock");
}
void TimerEndRadial(string &in asTimer)
{
FadeRadialBlurTo(0.0f, 0.1f);
}


void CollideScreamCave(string &in asParent, string &in asChild, int alState)
{
    PlaySoundAtEntity("monster_scream","04_scream.snt", "AreaCaveMonster", 0, false);
    
    StartScreenShake(0.02f, 2.0f, 0.5f, 2.0f);
    
    CreateParticleSystemAtEntity("breathps", "ps_cave_monster_scream.ps", "AreaCaveMonster", false);    
    
    AddTimer("scream1", 0.5f, "TimerCaveScream");
    AddTimer("scream2", 1.0f, "TimerCaveScream");
    AddTimer("scream3", 3.0f, "TimerCaveScream");
    AddTimer("scream4", 5.0f, "TimerCaveScream");
}
void TimerCaveScream(string &in asTimer)
{
    if(asTimer == "scream1"){
        PlayGuiSound("react_scare", 0.8f);
        GiveSanityDamage(10.0f, false);
        FadeSepiaColorTo(0.5f, 0.025f);
        FadeRadialBlurTo(0.1f, 0.025f);
        SetRadialBlurStartDist(0.2f);
    }
    else if(asTimer == "scream2"){
    
    }
    else if(asTimer == "scream3"){
        PlayGuiSound("react_creath", 0.8f);
        FadeSepiaColorTo(0, 0.1f);
        FadeRadialBlurTo(0, 0.1f);
    }
    else{
        PlayGuiSound("react_creath", 0.6f);
    }
}
The callback mentions the AreaJumpscare, yet you said you named your area Areascreamcave. If there's a callback for that collision, it is never called.

There are probably quite a few other errors, because that's what happens when you directly copy the code Frictional used.
Ok, so what am i supposed to do to make it work?
Well, you need to add a callback for it. Something like AddEntityCollideCallback("Player", "Areascreamcave", "CollideScreamCave", true, 1); to OnStart. That might work, but without analyzing the whole script I can't say for sure if it will.