Frictional Games Forum (read-only)

Full Version: N00B needs help AGAIN
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello I'm trying to make lamps go out when a player goes into an area but it doesn't work Sad (No errors)

AddEntityCollideCallback("Player", "ScriptArea_1", "Function01", true, 1);

. . .

void Function01(string &in asEntity)
{
SetEntityActive("candlestick01_1", false);
SetEntityActive("PointLight_1", false);
}
(05-01-2011, 01:28 PM)X4anco Wrote: [ -> ]Hello I'm trying to make lamps go out when a player goes into an area but it doesn't work Sad (No errors)

AddEntityCollideCallback("Player", "ScriptArea_1", "Function01", true, 1);

. . .

void Function01(string &in asEntity)
{
SetEntityActive("candlestick01_1", false);
SetEntityActive("PointLight_1", false);
}
Code:
void OnStart()
{
AddEntityCollideCallback("Player", "LightsOut", "LightsOut", true, 1);
}
[...]

void LightsOut(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candles", false, false); //Lamp inactive
SetLightVisible("BoxLight_1", false); //Light inactive
}
Try that and see if it works, change the names to your correct ones, of course! Smile
Thank you SO much Big Grin Big Grin Big Grin Big Grin
Oh one quick question how would I get a sound to play at the same time ? :/
coDe
_________________


PlaySoundAtEntity("", "guardian_activated1", "player", 0, true);
(05-01-2011, 02:05 PM)X4anco Wrote: [ -> ]Thank you SO much Big Grin Big Grin Big Grin Big Grin
Oh one quick question how would I get a sound to play at the same time ? :/
coDe
_________________


PlaySoundAtEntity("", "guardian_activated1", "player", 0, true);

I would use:
Code:
void OnStart()
{
AddEntityCollideCallback("Player", "LightsOut", "LightsOut", true, 1);
}
[...]

void LightsOut(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candles", false, false); //Lamp inactive
SetLightVisible("BoxLight_1", false); //Light inactive
PlayGuiSound("guardian/guardian_activated1.ogg", 1);
}

I didn't test it, but it should work.
Thankyou Big Grin Big Grin Big Grin
also, PlaySoundAtEntity and PlayMusic works too