Hello I'm trying to make lamps go out when a player goes into an area but it doesn't work
(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 (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!
Thank you SO much
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
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.
also, PlaySoundAtEntity and PlayMusic works too