Frictional Games Forum (read-only)
Issue making script work - 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: Issue making script work (/thread-17903.html)



Issue making script work - LiVam - 08-22-2012

Been trying to make a simple script that activates a few torches when the player enters an area.
I've made sure the area has the same name as what is being called. I've recreated that area too.

Tried a few different settings for the Lit command. None of the torches change at all.

The script:
Code:
    // This runs when the map first starts
    void OnStart()
    {
    AddEntityCollideCallback("Player", "AreaLightsOn01", "LightsOn01", true, 1);
    
    }
    
    void LightsOn01(string& asName, bool abLit, bool abEffects)
    {
    SetLampLit("torch_static01_1", true, false);
    SetLampLit("torch_static01_2", true, false);
    SetLampLit("torch01", true, true);
    SetLampLit("torch_static01_4", true, true);
    SetLampLit("torch_static01_5", true, false);
    SetLampLit("torch_static01_6", false, true);
    SetLampLit("torch_static01_7", true, false);
    SetLampLit("torch_static01_8", true, false);
    SetLampLit("torch_static01_9", true, false);
    }

    //===========================================
    // This runs when the player enters the map
    void OnEnter()
    {
    }

    //===========================================
    // This runs when the player leaves the map
    void OnLeave()
    {
    }

Any ideas? Smile


Edit: I tried adding a screen function to the event. Nothing happened. So I'm assuming the script isn't being called at all. Though I couldn't start the map when I wrote in incorrect syntax, so it should be loading the script file OK.


RE: Issue making script work - FlawlessHappiness - 08-22-2012

How about void LightsOn01(string &in asParent, string &in asChild, int alState)

This is the one you should use everytime you call a function when colliding with an area.


RE: Issue making script work - Robby - 08-22-2012

(08-22-2012, 12:28 PM)beecake Wrote: How about void LightsOn01(string &in asParent, string &in asChild, int alState)

This is the one you should use everytime you call a function when colliding with an area.
That appears to be the right one.


RE: Issue making script work - LiVam - 08-22-2012

(08-22-2012, 12:28 PM)beecake Wrote: How about void LightsOn01(string &in asParent, string &in asChild, int alState)

This is the one you should use everytime you call a function when colliding with an area.
Thank you so much! Smile

Works like a charm now!


RE: Issue making script work - FlawlessHappiness - 08-22-2012

No problem Wink