Frictional Games Forum (read-only)
[SCRIPT] Unexpected end of file issue - Printable Version

+- Frictional Games Forum (read-only) (
+-- Forum: Amnesia: The Dark Descent (
+--- Forum: Custom Stories, TCs & Mods - Development (
+---- Forum: Development Support (
+---- Thread: [SCRIPT] Unexpected end of file issue (/thread-25600.html)

Unexpected end of file issue - Neelke - 07-02-2014

So, a very common script issue here, but for some reason I cannot find it anywhere in the code. For some reason I'm blind watching it. The only thing I know is that the issue is somewhere in these lines.

void CollideWallWorm(string &in asParent, string &in asChild, int alState)
    if(asChild == "AreaWallWorm_1"){
        CreateWormAtArea("wallworm_1", "character_rockworm_attack_cutscene.ent", "AreaCreateWallWorm_1");
        InitAreaForDeath("DeathArea_1", true);
        CreateParticleSystemAtEntity("cavein", "ps_break_cavein_local", "stone_large01_1", false);
        PlaySoundAtEntity("caveins", "explosion_rock_large", "stone_large01_1", 0.0f, false);
        AddTimer("resetworm1", 3.5f, "TimerWallWorm");
        //The stone + debris
        SetEntityActive("stone_large01_1", false);
        for(int i=1; i<=3; ++i) SetEntityActive("stone_debris_"+i, true);
        for(int i=1; i<=3; ++i) AddPropForce("stone_debris_"+i, 0.0f, 150.0f, 100.0f, "World");
        AddTimer("stones01", 1.0f, "TimerDisintegrateStones"); //Reset them straight away
    if(asChild == "AreaWallWorm_2"){
        for(int i=2; i<=3; ++i) CreateWormAtArea("wallworm_"+i, "character_rockworm_attack_cutscene.ent", "AreaCreateWallWorm_"+i);
        InitAreaForDeath("DeathArea_2", true);
        for(int i=2; i<=3; ++i) CreateParticleSystemAtEntity("cavein", "ps_break_cavein_local", "stone_large01_"+i, false);
        for(int i=2; i<=3; ++i) PlaySoundAtEntity("caveins", "explosion_rock_large", "stone_large01_"+i, 0.0f, false);
        AddTimer("resetworm2", 3.5f, "TimerWallWorm");
        for(int i=2; i<=3; ++i) SetEntityActive("stone_large01_"+i, false);
        for(int i=4; i<=8; ++i) SetEntityActive("stone_debris_"+i, true);
        for(int i=4; i<=6; ++i) AddPropForce("stone_debris_"+i, 0.0f, 150.0f, -100.0f, "World");
        for(int i=7; i<=8; ++i) AddPropForce("stone_debris_"+i, 0.0f, 150.0f, 100.0f, "World");
        AddTimer("stones02", 1.0f, "TimerDisintegrateStones");
    if(asChild == "AreaWallWorm_3"){
        for(int i=4; i<=6; ++i) CreateWormAtArea("wallworm_"+i, "character_rockworm_attack_cutscene.ent", "AreaCreateWallWorm_"+i);
        InitAreaForDeath("DeathArea_3", true);
        for(int i=4; i<=6; ++i) CreateParticleSystemAtEntity("cavein", "ps_break_cavein_local", "stone_large01_"+i, false);
        for(int i=4; i<=6; ++i) PlaySoundAtEntity("caveins", "explosion_rock_large", "stone_large01_"+i, 0.0f, false);
        AddTimer("resetworm3", 3.5f, "TimerWallWorm");
        for(int i=4; i<=6; ++i) SetEntityActive("stone_large01_"+i, false);
        for(int i=9; i<=14; ++i) SetEntityActive("stone_debris_"+i, true);
        for(int i=9; i<=10; ++i) AddPropForce("stone_debris_"+i, 0.0f, 150.0f, 100.0f, "World");
        for(int i=11; i<=12; ++i) AddPropForce("stone_debris_"+i, 0.0f, 150.0f, -100.0f, "World");
        AddTimer("stones03", 1.0f, "TimerDisintegrateStones");

void TimerWallWorm(string &in asTimer)
    if(asTimer == "resetworm1"){
        InitAreaForDeath("DeathArea_1", false);
        SetEntityActive("wallworm_1", false);
        SetLocalVarString("", "wallworm_1");
    if(asTimer == "resetworm2"){
        InitAreaForDeath("DeathArea_2", false);
        for(int i=2; i<=3; ++i) SetEntityActive("wallworm_"+i, false);
        //for(int i=2; i<=3; ++i) SetLocalVarString("", "wallworm_"+i);
    if(asTimer == "resetworm3"){
        InitAreaForDeath("DeathArea_3", false);
        for(int i=4; i<=6; ++i) SetEntityActive("wallworm_"+i, false);
        //for(int i=4; i<=6; ++i) SetLocalVarString("", "wallworm_"+i);

void TimerDisintegrateStones(string &in asTimer)
    if(asTimer == "stones01"){
        for(int i=1; i<=3; ++i) SetPropActiveAndFade("stone_debris_"+i, false, 0.5f);
    }else if(asTimer == "stones02"){
        for(int i=4; i<=8; ++i) SetPropActiveAndFade("stone_debris_"+i, false, 0.5f);
    }else if(asTimer == "stones03"){
        for(int i=9; i<=14; ++i) SetPropActiveAndFade("stone_debris_"+i, false, 0.5f);

And in case the custom scripts are needed to fix the problem.

void ActivateWorm(string &in asWorm, string &in asMoveBox, float fState, float fMoveBoxSpeed, bool abChasing)
    //If abChasing is false, dont continue. The other worms are activated normally
    if(!abChasing) return;
    SetEntityActive(asWorm, true);
    SetMoveObjectStateExt(asMoveBox, fState, fMoveBoxSpeed, fMoveBoxSpeed, 0.0f, false);

void InitAreaForDeath(string &in asArea, bool abLethal)
    //If abLethal is false, we need to turn off the certain area
        SetLocalVarString("", asArea);
    SetLocalVarString("CurrentDeathArea", asArea);

void CreateWormAtArea(string &in asEntity, string &in asFile, string &in asArea)
    //Check first if there is a worm already in this area, if so, reset the worm
        CreateEntityAtArea(asEntity, asFile, asArea, true);
        SetLocalVarString("ActiveWorm1", asEntity);

RE: Unexpected end of file issue - Daemian - 07-02-2014

You're missing an extra } in your function CollideWallWorm

Your last } closes your condition, but the function is still open, it needs another }

RE: Unexpected end of file issue - Neelke - 07-02-2014

Wow. That simple. Thanks Big Grin