X4anco
Member
Posts: 157
Threads: 66
Joined: Apr 2011
Reputation:
0
|
N00B needs help AGAIN
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 |
|
Roenlond
Senior Member
Posts: 331
Threads: 3
Joined: Apr 2011
Reputation:
0
|
RE: N00B needs help AGAIN
(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);
} 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!
(This post was last modified: 05-01-2011, 01:51 PM by Roenlond.)
|
|
05-01-2011, 01:51 PM |
|
X4anco
Member
Posts: 157
Threads: 66
Joined: Apr 2011
Reputation:
0
|
RE: N00B needs help AGAIN
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);
...
(This post was last modified: 05-01-2011, 02:09 PM by X4anco.)
|
|
05-01-2011, 02:05 PM |
|
Roenlond
Senior Member
Posts: 331
Threads: 3
Joined: Apr 2011
Reputation:
0
|
RE: N00B needs help AGAIN
(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:
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.
(This post was last modified: 05-01-2011, 03:00 PM by Roenlond.)
|
|
05-01-2011, 03:00 PM |
|
X4anco
Member
Posts: 157
Threads: 66
Joined: Apr 2011
Reputation:
0
|
RE: N00B needs help AGAIN
...
|
|
05-01-2011, 09:43 PM |
|
ricky horror
Member
Posts: 54
Threads: 8
Joined: Apr 2011
Reputation:
0
|
RE: N00B needs help AGAIN
also, PlaySoundAtEntity and PlayMusic works too
|
|
05-02-2011, 12:11 AM |
|
|