Frictional Games Forum (read-only)
Script help. Again. - 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: Script help. Again. (/thread-24773.html)

Pages: 1 2


Script help. Again. - Neelke - 03-07-2014

Man, so painful. When you make a 1000 lines long script and then get unexpected end of file. 30 minutes later, it then changed the error message to Expected ) or ,

I still don't know. I'm not entirely sure where to put it. But according to the game, it's in this.

Code:
void SetLightVisibleOutside(bool abLit)
{
    if(abLit == false)
    {
        SetLampLit("candle_floor_4", abLit, false);
        SetLampLit("torch_static01_1", abLit, false);
        
        FadeLightTo("PointLight_10", 0.0f, 0.0f, 0.0f, 0.0f, 4.5f, 0.0f);
        FadeLightTo("SpotLight_3", 0.0f, 0.0f, 0.0f, 0.0f, 8.0f, 0.0f);
        FadeLightTo("PointLight_3", 0.0f, 0.0f, 0.0f, 0.0f, 3.0f, 0.0f);
    }
    else
    {
        SetLampLit("candle_floor_4", true, false);
        
        FadeLightTo("PointLight_10", 0.28f, 0.13f, 0.0f, 0.0f, 4.5f, 0.0f);
        FadeLightTo("SpotLight_3", 0.3f, 0.2f, 0.0f, 1.0f, 8.0f, 0.0f);
        
        if(GetLocalVarInt("TorchLit")==1)
        {
            SetLampLit("torch_static01_1", true, false);
        }
    }
}

//If this torch was never lit, we don't want to be lit unintentionally
void LitVisibleTorch(string &in asEntity, string &in asType)
{
    SetLocalVarInt("TorchLit", 1);
}

//This is the brute walking towards the ritual prisoner room
void DoBruteStep()
{
    AddLocalVarInt("Step", 1);
    
    PlaySoundAtEntity("bwalk", "metal_walk.snt", "AreaStep_"+GetLocalVarInt("Step")+", 0.0f, false);
    
    if(GetLocalVarInt("Step)==12) ResumeEventTimer("TimerRitualVision", 0.1f);
                                  return;
    
    AddTimer("loopstep", RandFloat(1.0f, 2.0f), "TimerLoopBruteStep"); //So it feels more random
}

void TimerLoopBruteStep(string &in asTimer)
{
    DoBruteStep();
}

//Resumes an event timer after a step is over
void ResumeEventTimer(string &in asTimer, float afTime)
{
    AddTimer(asTimer, afTime, asTimer);
}

Give me a hand, please?


RE: Script help. Again. - Mudbill - 03-07-2014

Missing a quote by line 39:
Code:
if(GetLocalVarInt("Step)==12)



RE: Script help. Again. - Neelke - 03-07-2014

Oh, you gotta be kidding me. Thanks Mudbill.


RE: Script help. Again. - Slanderous - 03-07-2014

Mudbill saves another mortal... again Tongue


RE: Script help. Again. - Mudbill - 03-07-2014

Haha xD


RE: Script help. Again. - Putmalk - 03-08-2014

Might I recommend testing periodically to avoid an issue? Much easier to debug 20 lines of code then 400


RE: Script help. Again. - Neelke - 03-08-2014

Well, before I got the unexpected end thing, my script was like 700 lines long and it worked then. Then I added this cutscene and this happened. Besides, it's still not entirely working, there's something else that is wrong. And I'm fully certain that the issue is somewhere here.

I changed it a little bit

Code:
//During ritual cutscene, the lights outside needs to be unlit (if lit)
void SetLightVisibleOutside(bool abLit)
{
    if(abLit == false)
    {
        SetLampLit("candle_floor_4", abLit, false);
        SetLampLit("torch_static01_1", abLit, false);
        
        FadeLightTo("PointLight_10", 0.0f, 0.0f, 0.0f, 0.0f, 4.5f, 0.0f);
        FadeLightTo("SpotLight_3", 0.0f, 0.0f, 0.0f, 0.0f, 8.0f, 0.0f);
        FadeLightTo("PointLight_3", 0.0f, 0.0f, 0.0f, 0.0f, 3.0f, 0.0f);
    }
    else
    {
        SetLampLit("candle_floor_4", true, false);
        
        FadeLightTo("PointLight_10", 0.28f, 0.13f, 0.0f, 0.0f, 4.5f, 0.0f);
        FadeLightTo("SpotLight_3", 0.3f, 0.2f, 0.0f, 1.0f, 8.0f, 0.0f);
        
        if(GetLocalVarInt("TorchLit")==1)
        {
            SetLampLit("torch_static01_1", true, false);
        }
    }
}

//If this torch was never lit, we don't want to be lit unintentionally
void LitVisibleTorch(string &in asEntity, string &in asType)
{
    SetLocalVarInt("TorchLit", 1);
}

//This is the brute walking towards the ritual prisoner room
void DoBruteStep()
{
    AddLocalVarInt("Step", 1);
    
    PlaySoundAtEntity("bwalk", "metal_walk.snt", "AreaStep_"+GetLocalVarInt("Step")+", 0.0f, false);
    
    if(GetLocalVarInt("Step")==12)
    {    
        ResumeEventTimer("TimerRitualVision", 0.1f);
        return;
    }
    
    AddTimer("loopstep", RandFloat(1.0f, 2.0f), "TimerLoopBruteStep"); //So it feels more random
}

void TimerLoopBruteStep(string &in asTimer)
{
    DoBruteStep();
}

//Resumes an event timer after a step is over
void ResumeEventTimer(string &in asTimer, float afTime)
{
    AddTimer(asTimer, afTime, asTimer);
}



RE: Script help. Again. - PutraenusAlivius - 03-08-2014

(03-08-2014, 11:07 AM)Neelke Wrote: Well, before I got the unexpected end thing, my script was like 700 lines long and it worked then. Then I added this cutscene and this happened. Besides, it's still not entirely working, there's something else that is wrong. And I'm fully certain that the issue is somewhere here.

I changed it a little bit

Code:
//During ritual cutscene, the lights outside needs to be unlit (if lit)
void SetLightVisibleOutside(bool abLit)
{
    if(abLit == false)
    {
        SetLampLit("candle_floor_4", abLit, false);
        SetLampLit("torch_static01_1", abLit, false);
        
        FadeLightTo("PointLight_10", 0.0f, 0.0f, 0.0f, 0.0f, 4.5f, 0.0f);
        FadeLightTo("SpotLight_3", 0.0f, 0.0f, 0.0f, 0.0f, 8.0f, 0.0f);
        FadeLightTo("PointLight_3", 0.0f, 0.0f, 0.0f, 0.0f, 3.0f, 0.0f);
    }
    else
    {
        SetLampLit("candle_floor_4", true, false);
        
        FadeLightTo("PointLight_10", 0.28f, 0.13f, 0.0f, 0.0f, 4.5f, 0.0f);
        FadeLightTo("SpotLight_3", 0.3f, 0.2f, 0.0f, 1.0f, 8.0f, 0.0f);
        
        if(GetLocalVarInt("TorchLit")==1)
        {
            SetLampLit("torch_static01_1", true, false);
        }
    }
}

//If this torch was never lit, we don't want to be lit unintentionally
void LitVisibleTorch(string &in asEntity, string &in asType)
{
    SetLocalVarInt("TorchLit", 1);
}

//This is the brute walking towards the ritual prisoner room
void DoBruteStep()
{
    AddLocalVarInt("Step", 1);
    
    PlaySoundAtEntity("bwalk", "metal_walk.snt", "AreaStep_"+GetLocalVarInt("Step")[b]+"[/b], 0.0f, false);
    
    if(GetLocalVarInt("Step")==12)
    {    
        ResumeEventTimer("TimerRitualVision", 0.1f);
        return;
    }
    
    AddTimer("loopstep", RandFloat(1.0f, 2.0f), "TimerLoopBruteStep"); //So it feels more random
}

void TimerLoopBruteStep(string &in asTimer)
{
    DoBruteStep();
}

//Resumes an event timer after a step is over
void ResumeEventTimer(string &in asTimer, float afTime)
{
    AddTimer(asTimer, afTime, asTimer);
}

Pretty sure that it shouldn't be there. Delete it. (Marked it with bold)


RE: Script help. Again. - Neelke - 03-08-2014

http://www.youtube.com/watch?v=usfiAsWR4qU


RE: Script help. Again. - PutraenusAlivius - 03-08-2014

(03-08-2014, 11:26 AM)Neelke Wrote: http://www.youtube.com/watch?v=usfiAsWR4qU

"No problem random citizen, JustAnotherPlayer SomethingRidiculous to the rescue!"