Frictional Games Forum (read-only)

Full Version: How do I - disable all hints/turn on lights with a switch?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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;
}
}
All the functions can be found here.
But here's the script:

Code:
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
(08-05-2013, 07:49 AM)Smoke Wrote: [ -> ]All the functions can be found here.
But here's the script:

Code:
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);
}
}
Oh, you want to lit/unlit a lamp?

Use this:
Code:
SetLampLit(string& asName, bool abLit, bool abEffects);
(08-05-2013, 08:29 AM)Smoke Wrote: [ -> ]Oh, you want to lit/unlit a lamp?

Use this:
Code:
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);
}
}
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)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!!!
No probs Wink
(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?
Are the lights off when you enter the room or are you trying to switch them off?
Pages: 1 2