Frictional Games Forum (read-only)

Full Version: lamp question
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
is it possible to make a script that wend i lit a lamp... for example other lights will turn on?
Yes, but you'll have to record if they have a tinderbox or not when they click on it.

You could simply have this, except it might not always work:

Code:
void OnStart()
{
     SetEntityPlayerInteractCallback("Lamp_1", "Func01", true);
}
void Func01(string &in asEntity)
{
     SetLightVisible("Lamp_2", true);
     SetLightVisible("Lamp_3", true);
}

Lamp_1 is the name of the candle or light that the player lights with a tinderbox and Lamp_2 and Lamp_3 are the ones that get set lit after you light Lamp_1. You can add many as you would like to it, but like I said, it won't completely work if the player touches the lamp without a tinderbox.
(07-15-2011, 11:32 PM)Kyle Wrote: [ -> ]Yes, but you'll have to record if they have a tinderbox or not when they click on it. You could simply have this, except it might not always work:
- snip -
Well to remedy that I would suggest doing it this way.

Select the entity you want the function to be triggered on and then go into the entity tab. In the "Callback Func" box write a function name, my example will be "IgniteLamp1"

Now, in your .hps file, place this not inside any of the main functions...

Code:
void IgniteLamp1(string &in asEntityName, string &in asType)
     {
          if(asType=="OnIgnite") {
                SetLampLit("Lamp2", true, false);
                SetLampLit("Lamp3", true, false);
            }
     }

When you are done with that, go to every lamp you want lit and place in the "Callback Func" box the same function name. Of course you'll need to edit the correct names and such Smile