Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Issue making script work
Author Message
LiVam Offline
Junior Member

Posts: 10
Joined: Jan 2012
Reputation: 0
Post: #1
Issue making script work
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:
    // 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.
(This post was last modified: 08-22-2012 12:21 PM by LiVam.)
08-22-2012 12:20 PM
Find all posts by this user Quote this message in a reply
BeeKayK Offline
Posting Freak

Posts: 1,941
Joined: Mar 2012
Reputation: 75
Post: #2
RE: Issue making script work
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.

We fear what we cannot undo
We fear what we don't know
(This post was last modified: 08-22-2012 12:28 PM by BeeKayK.)
08-22-2012 12:28 PM
Find all posts by this user Quote this message in a reply
Nemet Robert Offline
Posting Freak

Posts: 2,377
Joined: Jun 2009
Reputation: 42
Post: #3
RE: Issue making script work
(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.

Signature Gas Mask
08-22-2012 12:30 PM
Visit this user's website Find all posts by this user Quote this message in a reply
LiVam Offline
Junior Member

Posts: 10
Joined: Jan 2012
Reputation: 0
Post: #4
RE: Issue making script work
(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!
08-22-2012 12:30 PM
Find all posts by this user Quote this message in a reply
BeeKayK Offline
Posting Freak

Posts: 1,941
Joined: Mar 2012
Reputation: 75
Post: #5
RE: Issue making script work
No problem Wink

We fear what we cannot undo
We fear what we don't know
08-22-2012 12:58 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)