Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I - disable all hints/turn on lights with a switch?
GoreGrinder99 Offline
Member

Posts: 166
Threads: 47
Joined: Feb 2013
Reputation: 1
#1
How do I - disable all hints/turn on lights with a switch?

As the title states, how do I go about doing so? Is there a global script for disabling hints? Do the lights run on the same process as using a switch to open a door or passage?

The script I have now is giving me a crash error:

ERR :No matching signatures to 'SetLampLit(string@&, const bool, string@&)'

This is the script pertaining too:

void OnStart()
{
SetEntityConnectionStateChangeCallback("candlestick_wall_1", "LightsFunction");
}


void LightsFunction(string &in asEntity, int alState)
{
{
SetLampLit("candlestick_wall_1", true, "");
return;
}
}

-Grind to the Gore-
(This post was last modified: 08-05-2013, 02:38 PM by GoreGrinder99.)
08-05-2013, 05:52 AM
Find
OriginalUsername Offline
Posting Freak

Posts: 896
Threads: 42
Joined: Feb 2013
Reputation: 34
#2
RE: How do I - disable all hints/turn on lights with a switch?

All the functions can be found here.
But here's the script:

void OnStart()
{
    SetLocalVarInt("lamp_1", 1);
    SetEntityPlayerInteractCallback("nameofyourswitch", "lamp_onoff", false);
}

void lamp_onoff(string &in asEntity)
{
    if(GetLocalVarInt("lamp_1")==0)
    {
    SetLightVisible("nameofyourlight", true);
    AddLocalVarInt("lamp_1", 1);
    }
    else if(GetLocalVarInt("lamp_1")==1)
    {
    SetLightVisible("nameofyourlight", false);
    AddLocalVarInt("lamp_1", -1);
    }
}

There, that should do it
(This post was last modified: 08-05-2013, 07:54 AM by OriginalUsername.)
08-05-2013, 07:49 AM
Find
GoreGrinder99 Offline
Member

Posts: 166
Threads: 47
Joined: Feb 2013
Reputation: 1
#3
RE: How do I - disable all hints/turn on lights with a switch?

(08-05-2013, 07:49 AM)Smoke Wrote: All the functions can be found here.
But here's the script:

void OnStart()
{
    SetLocalVarInt("lamp_1", 1);
    SetEntityPlayerInteractCallback("nameofyourswitch", "lamp_onoff", false);
}

void lamp_onoff(string &in asEntity)
{
    if(GetLocalVarInt("lamp_1")==0)
    {
    SetLightVisible("nameofyourlight", true);
    AddLocalVarInt("lamp_1", 1);
    }
    else if(GetLocalVarInt("lamp_1")==1)
    {
    SetLightVisible("nameofyourlight", false);
    AddLocalVarInt("lamp_1", -1);
    }
}

There, that should do it

I copied what you had pasted and replaced the names but still no action. I'm testing this with a candle for the time being before I replace the entity with a custom lamp and confuse myself even more. The candle is not lit, has it's original name "candlestick_wall_1", my lever has the interact callback in it "LightsFunction" and I don't have any lights so left it blank.

This is the script now:

void OnStart
{
SetLocalVarInt("candlestick_wall_1", 1);
SetEntityPlayerInteractCallback("lever_nice01_1", "LightsFunction", false);
}


void LightsFunction(string &in asEntity)
{
if(GetLocalVarInt("candlestick_wall_1")==0)
{
SetLightVisible("", true);
AddLocalVarInt("candlestick_wall_1", 1);
}
else if(GetLocalVarInt("candlestick_wall_1")==1)
{
SetLightVisible("", false);
AddLocalVarInt("candlestick_wall_1", -1);
}
}

-Grind to the Gore-
(This post was last modified: 08-05-2013, 08:30 AM by GoreGrinder99.)
08-05-2013, 08:10 AM
Find
OriginalUsername Offline
Posting Freak

Posts: 896
Threads: 42
Joined: Feb 2013
Reputation: 34
#4
RE: How do I - disable all hints/turn on lights with a switch?

Oh, you want to lit/unlit a lamp?

Use this:
SetLampLit(string& asName, bool abLit, bool abEffects);
08-05-2013, 08:29 AM
Find
GoreGrinder99 Offline
Member

Posts: 166
Threads: 47
Joined: Feb 2013
Reputation: 1
#5
RE: How do I - disable all hints/turn on lights with a switch?

(08-05-2013, 08:29 AM)Smoke Wrote: Oh, you want to lit/unlit a lamp?

Use this:
SetLampLit(string& asName, bool abLit, bool abEffects);

This is what it looks like now and now it's crashing again with the same error before but on more lines.

void OnStart()
{
SetLocalVarInt("candlestick_wall_1", 1);
SetEntityPlayerInteractCallback("lever_nice01_1", "LightsFunction", false);
}


void LightsFunction(string &in asEntity)
{
if(GetLocalVarInt("candlestick_wall_1")==0)
{
SetLampLit("candlestick_wall_1", true, "");
AddLocalVarInt("candlestick_wall_1", 1);
}
else if(GetLocalVarInt("candlestick_wall_1")==1)
{
SetLampLit("candlestick_wall_1", false, "");
AddLocalVarInt("candlestick_wall_1", -1);
}
}

-Grind to the Gore-
08-05-2013, 08:32 AM
Find
OriginalUsername Offline
Posting Freak

Posts: 896
Threads: 42
Joined: Feb 2013
Reputation: 34
#6
RE: How do I - disable all hints/turn on lights with a switch?

A boolean is only true or false, not "". So do you want effects, true or false?
And could you give me the other errors?
08-05-2013, 08:35 AM
Find
GoreGrinder99 Offline
Member

Posts: 166
Threads: 47
Joined: Feb 2013
Reputation: 1
#7
RE: How do I - disable all hints/turn on lights with a switch?

(08-05-2013, 08:35 AM)Smoke Wrote: A boolean is only true or false, not "". So do you want effects, true or false?
And could you give me the other errors?

I fixed what you said and works like a charm, you saved me a lot! Thanks man!!!

-Grind to the Gore-
08-05-2013, 08:38 AM
Find
OriginalUsername Offline
Posting Freak

Posts: 896
Threads: 42
Joined: Feb 2013
Reputation: 34
#8
RE: How do I - disable all hints/turn on lights with a switch?

No probs Wink
08-05-2013, 08:40 AM
Find
GoreGrinder99 Offline
Member

Posts: 166
Threads: 47
Joined: Feb 2013
Reputation: 1
#9
RE: How do I - disable all hints/turn on lights with a switch?

(08-05-2013, 08:40 AM)Smoke Wrote: No probs Wink

Sorry dude, but I found a small bug. The initial up and/or down doesn't do anything but the second time around and afterwords works fine, except that all it takes to turn on and off the lights is a simple click on the lever. Any way to fix that so it's only on when up and off when down and no in between?

-Grind to the Gore-
08-05-2013, 08:45 AM
Find
OriginalUsername Offline
Posting Freak

Posts: 896
Threads: 42
Joined: Feb 2013
Reputation: 34
#10
RE: How do I - disable all hints/turn on lights with a switch?

Are the lights off when you enter the room or are you trying to switch them off?
08-05-2013, 09:01 AM
Find




Users browsing this thread: 1 Guest(s)